/* Tao of GPT-2 — styled after b0y.eu */

/* ===== reset ===== */
*, ::before, ::after { box-sizing: border-box; border: 0 solid currentColor; }
html, body { margin: 0; padding: 0; }
h1, h2, h3, p, ul, figure { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; text-decoration: inherit; }
button { background: none; font: inherit; color: inherit; cursor: pointer; padding: 0; }
img, svg { display: block; max-width: 100%; height: auto; }
input { margin: 0; }

/* ===== theme ===== */
[data-theme="black"] { --bg: #000; --fg: #fff; --sec: #e5e5e5; --dim: #888; --faint: #555; }
[data-theme="lofi"]  { --bg: #fff; --fg: #000; --sec: #1a1a1a; --dim: #666; --faint: #aaa; }
body {
  background-color: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
}

/* ===== b0y components ===== */
.collapse { position: relative; display: flex; flex-direction: column; width: 100%; border-radius: 1rem; }
.collapse > input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  position: absolute; top: 0; left: 0; width: 100%; height: 3.75rem;
  opacity: 0; cursor: pointer; z-index: 1;
}
.collapse-title { position: relative; min-height: 3.75rem; padding: 1rem 3rem 1rem 1rem; width: 100%;
  font-weight: 800; letter-spacing: -0.025em; }
.collapse-arrow > .collapse-title::after {
  content: ""; position: absolute; top: 1.9rem; right: 1.4rem;
  height: 0.5rem; width: 0.5rem; box-shadow: 2px 2px;
  transform: translateY(-100%) rotate(45deg);
  transition: transform 0.25s ease; pointer-events: none;
}
.collapse-arrow > input:checked ~ .collapse-title::after {
  transform: translateY(-50%) rotate(225deg);
}
.collapse-content {
  max-height: 0; overflow: hidden; padding: 0 1rem;
  transition: max-height 0.7s cubic-bezier(0.4, 0, 0.2, 1), padding 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}
.collapse > input:checked ~ .collapse-content { max-height: 9999px; padding-bottom: 1rem; }

.card { position: relative; display: flex; flex-direction: column; border-radius: 1rem; overflow: hidden;
  border: 1px solid var(--sec); transition: box-shadow 0.2s; }
.card:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
.card-body { display: flex; flex-direction: column; flex: 1 1 auto; gap: 0.5rem; padding: 1.25rem; text-align: left; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 1.9rem; border: 1px solid currentColor;
  padding: 0 0.563rem; height: 1.25rem; width: fit-content;
  font-size: 0.75rem; line-height: 1.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; flex-wrap: nowrap;
  height: 3rem; min-height: 3rem; padding: 0 1rem;
  border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600;
  text-align: center; user-select: none;
  border: 1px solid currentColor; background-color: transparent;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background-color: var(--fg); color: var(--bg); border-color: var(--fg); }

.toggle {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  border-radius: 9999px; border: 1px solid var(--sec);
  --tglbg: var(--bg); --handleoffset: 0.75rem;
  box-shadow: calc(var(--handleoffset) * -1) 0 0 2px var(--tglbg) inset,
              0 0 0 2px var(--tglbg) inset;
  transition: box-shadow 0.2s;
  flex-shrink: 0; width: 2rem; height: 1.25rem;
  background-color: var(--sec); margin: 0 0.25rem;
}
.toggle:checked {
  box-shadow: var(--handleoffset) 0 0 2px var(--tglbg) inset,
              0 0 0 2px var(--tglbg) inset;
}

.link { text-decoration: underline; cursor: pointer; }
.link-hover { text-decoration: none; }
.link-hover:hover { text-decoration: underline; }
svg.icon { display: inline-block; vertical-align: middle; fill: currentColor; flex-shrink: 0; }

/* ===== layout ===== */
.theme-corner { display: flex; align-items: center; position: absolute;
  top: 1rem; right: 1rem; z-index: 10; }
@media (min-width: 768px) { .theme-corner { top: 1.5rem; right: 1.5rem; } }

header.site { margin: 0 auto; padding: 1.5rem 1rem 0.5rem; text-align: center; }
main.site { margin: 0 auto; flex-grow: 1; width: 95vw; max-width: 48rem; padding: 0.5rem 0 1rem; }
footer.site { display: flex; justify-content: center; align-items: center; padding: 1rem;
  font-weight: 300; font-size: 0.875rem; color: var(--dim); text-align: center; }

.title { font-size: 1.875rem; line-height: 2.25rem; font-weight: 800; letter-spacing: -0.025em; position: relative; display: inline-block; }
.title .badge { position: absolute; top: -1rem; left: 100%; margin-left: 0.5rem; font-weight: 300; }
.subtitle { font-size: 1.125rem; color: var(--dim); margin-top: 0.5rem; font-weight: 300; }

/* taijitu halo (cover) */
.halo { position: relative; width: 8.5rem; height: 8.5rem; flex-shrink: 0; margin: 0 auto 1rem; }
.halo svg.tai { position: absolute; inset: 22%; width: 56%; height: 56%; animation: orbit 240s linear infinite; }
.halo svg.ring { position: absolute; inset: 0; width: 100%; height: 100%; animation: orbit 40s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
@media (min-width: 768px) { .halo { width: 10rem; height: 10rem; } }

/* chapter grid (cover) */
.ch-grid { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.4rem; margin: 1.5rem 0; }
.ch-grid a {
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1; border: 1px solid var(--sec); border-radius: 0.5rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  transition: background-color 0.2s, color 0.2s;
}
.ch-grid a:hover { background-color: var(--fg); color: var(--bg); }
@media only screen and (max-width: 480px) {
  .ch-grid { grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 0.25rem; }
  .ch-grid a { font-size: 0.65rem; border-radius: 0.3rem; }
}

/* epigraph */
.epigraph { font-family: Georgia, 'Times New Roman', serif; font-style: italic;
  color: var(--dim); text-align: center; margin: 1rem auto; max-width: 34rem;
  white-space: pre-wrap; line-height: 1.6; cursor: pointer; }
.epigraph:hover { color: var(--fg); }

/* chapter page */
.ch-nav { display: flex; align-items: center; justify-content: center; gap: 1.5rem; margin: 0.5rem 0 1rem; }
.ch-nav .num { font-size: 3rem; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }
.ch-nav a.arrow { font-size: 1.5rem; padding: 0.5rem 1rem; border: 1px solid var(--sec); border-radius: 0.5rem;
  transition: background-color 0.2s, color 0.2s; }
.ch-nav a.arrow:hover { background-color: var(--fg); color: var(--bg); }
.home-link { font-weight: 800; letter-spacing: -0.025em; font-size: 0.875rem;
  position: absolute; top: 1.25rem; left: 1.25rem; z-index: 10; color: var(--dim); }
.home-link:hover { color: var(--fg); }

/* passages */
.passage { font-family: Georgia, 'Times New Roman', serif; font-size: 1.125rem;
  line-height: 1.7; white-space: pre-wrap; }
.passage-meta { display: flex; justify-content: flex-end; }
.passage-meta a.badge { color: var(--faint); border-color: var(--faint); }
.passage-meta a.badge:hover { color: var(--fg); border-color: var(--fg); }
#main-passage .passage { font-size: 1.25rem; }
.others-grid { display: flex; flex-direction: column; gap: 1rem; margin: 1rem 0; }
.others-grid .passage { font-size: 1rem; color: var(--sec); }

/* deeper strata: receding ink */
.strata .card { border-color: var(--faint); }
.strata .passage { color: var(--dim); font-size: 0.95rem; }
/* noise floor: the machine's unconscious */
.noise .card { border-style: dashed; border-color: var(--faint); }
.noise .passage { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem; color: var(--faint); line-height: 1.5; }
.section-note { font-size: 0.8rem; font-weight: 300; color: var(--faint); font-style: italic; }

/* original (legge) */
.original .passage { color: var(--dim); font-size: 0.95rem; }

.reshuffle-row { display: flex; justify-content: center; margin: 1.25rem 0; }

.prose { color: var(--sec); font-weight: 300; line-height: 1.6; }
.prose p { margin: 0.75em 0; }
.prose a { text-decoration: underline; }
.prose ul { list-style: disc; padding-left: 1.625em; margin: 0.75em 0; }
.prose li { margin: 0.25em 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

@media only screen and (max-width: 480px) {
  .ch-nav .num { font-size: 2.25rem; }
  #main-passage .passage { font-size: 1.1rem; }
}
