/* knowthybody.com — shared look for every topic page (tokens, type, chart, sections, footer). */
:root {
  color-scheme: light;
  --paper: #faf6ee;            /* same cream as the illustrations' ground */
  --paper-deep: oklch(0.935 0.018 75);
  --ink: oklch(0.30 0.035 50);
  --ink-soft: oklch(0.47 0.03 55);
  --ink-faint: oklch(0.62 0.025 60);
  --rule: oklch(0.86 0.02 70);
  --cocoa: oklch(0.52 0.08 50);

  /* the band: red, orange, green, green, yellow, orange, red */
  --t-red: oklch(0.66 0.14 25);
  --t-orange: oklch(0.74 0.12 58);
  --t-yellow: oklch(0.84 0.11 92);
  --t-green: oklch(0.70 0.12 150);
  --t-red-ink: oklch(0.48 0.13 25);
  --t-orange-ink: oklch(0.50 0.10 55);
  --t-yellow-ink: oklch(0.50 0.08 85);
  --t-green-ink: oklch(0.45 0.10 150);

  --display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --body: -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;

  --r-sm: 6px; --r-md: 12px; --r-lg: 20px; --r-pill: 999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: max(16px, env(safe-area-inset-left));
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.75 var(--body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
}
img { display: block; max-width: 100%; height: auto; }
a { color: var(--cocoa); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--cocoa); outline-offset: 3px; border-radius: var(--r-sm); }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
.prose { max-width: 34em; }

h1, h2, h3 { font-family: var(--display); font-weight: 700; color: var(--ink); margin: 0; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }

/* ---------- masthead ---------- */
.mast {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 13px; color: var(--ink-soft); letter-spacing: 0.08em;
}
.mast .brand { font-family: var(--display); font-weight: 700; font-size: 17px; color: var(--ink); letter-spacing: 0.04em; text-decoration: none; }

/* ---------- hero ---------- */
.hero { padding: 40px 0 8px; display: grid; gap: 4px 32px; grid-template-columns: 1fr; }
.hero h1 { font-size: clamp(44px, 12vw, 80px); line-height: 1.05; letter-spacing: -0.02em; }
.hero .nb { display: inline-block; } /* if the title must wrap, break only between these spans */
.hero .lead { font-size: 17px; color: var(--ink-soft); margin-top: 16px; max-width: 26em; }
@media (min-width: 760px) {
  .hero { grid-template-columns: 1.1fr 1fr; align-items: end; padding-top: 64px; }
  .hero .lead { margin: 0 0 10px; }
}

/* ---------- the chart: tiles + band ---------- */
.chart { padding: 28px 0 0; }
.ask { font-family: var(--display); font-size: 21px; margin: 0 0 12px; letter-spacing: -0.01em; }
.ask small { font-family: var(--body); font-size: 13px; color: var(--ink-faint); margin-left: 8px; letter-spacing: 0; }

.tiles {
  list-style: none; margin: 0 calc(-1 * var(--gutter)); padding: 4px var(--gutter) 8px;
  display: grid; grid-auto-flow: column; grid-auto-columns: 100px; gap: 8px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter);
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.tiles::-webkit-scrollbar { display: none; }
@media (min-width: 760px) {
  .tiles { margin: 0; padding: 4px 0 8px; grid-auto-flow: row; grid-template-columns: repeat(var(--n, 7), 1fr); overflow: visible; }
}
.tiles li { scroll-snap-align: start; }

.tile {
  position: relative; width: 100%; padding: 0 0 10px; border: 0; background: transparent;
  border-radius: var(--r-md); cursor: pointer; color: inherit; font: inherit; text-align: center;
  transition-property: transform, background-color, box-shadow;
  transition-duration: 180ms; transition-timing-function: var(--ease);
}
.tile img { width: 100%; aspect-ratio: 1; border-radius: var(--r-md); mix-blend-mode: darken; } /* the art's cream ground melts into whatever is behind */
.tile .sw { display: grid; place-items: center; width: 100%; aspect-ratio: 1; }
.tile .sw svg { width: 78%; height: auto; }
.tile .sw .blob { width: 46%; aspect-ratio: 1; }
.tile .n { display: block; font-family: var(--display); font-size: 22px; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .name { display: block; font-size: 12px; color: var(--ink-soft); line-height: 1.4; margin-top: 4px; }
.tile:active { transform: scale(0.96); }
@media (hover: hover) { .tile:hover { background: var(--paper-deep); } }
.tile[aria-pressed="true"] { background: var(--paper-deep); box-shadow: inset 0 0 0 1.5px var(--sel, var(--cocoa)); }

.band-wrap { position: relative; margin-top: 14px; padding-top: 12px; }
.band { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); height: 14px; border-radius: var(--r-pill); overflow: hidden; outline: 1px solid oklch(0.4 0.03 60 / 0.10); outline-offset: -1px; } /* keeps pale cells visible on the paper */
.band button { border: 0; padding: 0; cursor: pointer; position: relative; }
.band button::after { content: ""; position: absolute; inset: -14px 0; } /* 42px hit area */
.band-legend { display: grid; grid-template-columns: repeat(var(--n, 7), 1fr); font-size: 11px; color: var(--ink-faint); margin-top: 6px; text-align: center; font-variant-numeric: tabular-nums; }
.band-ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.pointer {
  position: absolute; top: 0; left: 0; width: calc(100% / var(--n, 7)); display: flex; justify-content: center;
  transform: translateX(var(--px, 300%)); opacity: var(--po, 0);
  transition-property: transform, opacity; transition-duration: 420ms; transition-timing-function: var(--ease);
}
.pointer::before { content: ""; border: 7px solid transparent; border-top-color: var(--ink); border-bottom-width: 0; }

.c-red { background: var(--t-red); } .c-orange { background: var(--t-orange); }
.c-yellow { background: var(--t-yellow); } .c-green { background: var(--t-green); }

/* ---------- reading of the chosen type ---------- */
.reading {
  margin-top: 22px; min-height: 120px; padding: 22px 20px 20px;
  background: #fffdf8; border-radius: var(--r-lg);
  box-shadow: 0 1px 2px oklch(0.4 0.04 60 / 0.08), 0 6px 24px -8px oklch(0.4 0.05 60 / 0.18);
}
.reading-inner { transition-property: opacity, transform; transition-duration: 260ms; transition-timing-function: var(--ease); }
.reading-inner.out { opacity: 0; transform: translateY(6px); }
.verdict { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; padding: 3px 12px 3px 8px; border-radius: var(--r-pill); }
.verdict::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.v-red { color: var(--t-red-ink); background: oklch(0.94 0.035 25); }
.v-orange { color: var(--t-orange-ink); background: oklch(0.95 0.035 60); }
.v-yellow { color: var(--t-yellow-ink); background: oklch(0.96 0.05 95); }
.v-green { color: var(--t-green-ink); background: oklch(0.95 0.04 150); }
.reading h3 { font-size: 28px; margin: 10px 0 6px; letter-spacing: -0.012em; }
.reading h3 .k { display: block; font-family: var(--body); font-size: 13px; font-weight: 400; color: var(--ink-faint); letter-spacing: 0.06em; margin-bottom: 2px; }
.reading .meaning { color: var(--ink); }
.reading .todo { color: var(--ink-soft); font-size: 15px; }
.reading .todo b { color: var(--ink); font-weight: 600; }
.reading .note { font-size: 13px; color: var(--ink-faint); margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--rule); }
.reading .empty { color: var(--ink-faint); margin: 0; }
@media (min-width: 760px) {
  .reading { padding: 28px 32px; display: grid; }
  .reading-inner.has { display: grid; grid-template-columns: 220px 1fr; gap: 0 32px; }
  .reading-inner.has .note { grid-column: 2; }
}

/* ---------- sections ---------- */
section.part { padding: 72px 0 0; }
.part-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 20px; }
.part-head .k { font-family: var(--display); font-size: 15px; color: var(--cocoa); font-variant-numeric: tabular-nums; }
.part-head h2 { font-size: clamp(30px, 7vw, 42px); line-height: 1.15; letter-spacing: -0.02em; }

/* journey */
.route { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 0; }
.route li { display: grid; grid-template-columns: 76px 20px 1fr; gap: 0 12px; }
.route .t { font-size: 13px; color: var(--ink-faint); text-align: right; padding-top: 3px; font-variant-numeric: tabular-nums; line-height: 1.5; }
.route .dot { position: relative; display: flex; justify-content: center; }
.route .dot::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--paper); box-shadow: inset 0 0 0 2.5px var(--cocoa); margin-top: 7px; position: relative; z-index: 1; }
.route .dot::after { content: ""; position: absolute; top: 14px; bottom: -8px; width: 2px; background: var(--rule); }
.route li:last-child .dot::after { display: none; }
.route .s { padding-bottom: 20px; }
.route .s b { font-family: var(--display); font-weight: 700; font-size: 20px; display: block; line-height: 1.4; }
.route .s span { color: var(--ink-soft); font-size: 15px; }
.route li.key .dot::before { background: var(--cocoa); }
.speedo { margin-top: 12px; padding: 18px 18px 14px; border-radius: var(--r-lg); background: var(--paper-deep); }
.speedo p { margin: 0 0 12px; }
@media (min-width: 760px) {
  .journey { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
  .speedo { margin-top: 8px; }
}

/* composition */
.stack { display: flex; height: 54px; border-radius: var(--r-md); overflow: hidden; margin: 8px 0 8px; }
.stack .water { flex: 75; background: oklch(0.86 0.04 220); display: flex; align-items: center; padding-left: 14px; color: oklch(0.36 0.06 230); font-weight: 600; }
.stack .solid { flex: 25; background: var(--cocoa); color: #fff8ee; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; }
.stack-cap { font-size: 13px; color: var(--ink-faint); margin-bottom: 22px; }
.solids { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.solids li { display: grid; grid-template-columns: 14px 1fr; gap: 12px; }
.solids li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--cocoa); margin-top: 9px; opacity: var(--o, 1); }
.solids b { font-weight: 600; }
.solids span { color: var(--ink-soft); }
@media (min-width: 760px) { .comp { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; } }

/* frequency */
.freq { font-family: var(--display); font-size: clamp(40px, 11vw, 76px); line-height: 1.1; letter-spacing: -0.02em; margin: 4px 0 16px; }
.freq em { font-style: normal; color: var(--cocoa); }

/* colours */
.swatches { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .swatches { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .swatches { grid-template-columns: repeat(3, 1fr); } }
.swatches li { display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; padding: 14px; border-radius: var(--r-md); background: #fffdf8; box-shadow: 0 1px 3px oklch(0.4 0.04 60 / 0.10); }
.chip { width: 44px; height: 44px; border-radius: 50% 50% 46% 54% / 58% 52% 48% 42%; box-shadow: inset -4px -5px 0 oklch(0 0 0 / 0.12), inset 3px 3px 0 oklch(1 0 0 / 0.18); }
.blob { display: block; border-radius: 50% 50% 46% 54% / 58% 52% 48% 42%; box-shadow: inset -4px -5px 0 oklch(0 0 0 / 0.12), inset 3px 3px 0 oklch(1 0 0 / 0.25); }
.blob.clear { box-shadow: inset 0 0 0 1.5px oklch(0.75 0.03 230), inset -4px -5px 0 oklch(0.5 0.03 230 / 0.12), inset 3px 3px 0 oklch(1 0 0 / 0.6); }
.swatches b { display: block; font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.4; }
.swatches span { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.swatches .flag { display: inline; color: var(--t-red-ink); font-weight: 600; }

/* things that change it: painted objects with a caption */
.things { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .things { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .things { grid-template-columns: repeat(3, 1fr); } }
.things li { display: grid; grid-template-columns: 84px 1fr; gap: 14px; align-items: center; padding: 8px 0; }
.things img { width: 84px; height: 84px; mix-blend-mode: darken; }
.things b { display: block; font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.4; }
.things span { display: block; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.chip[data-cup] { box-shadow: none; border-radius: 0; background: none; }
.chip[data-cup] svg { width: 100%; height: 100%; }

/* a myth, struck through and corrected */
.myth { margin: 4px 0 0; padding: 22px 20px; border-radius: var(--r-lg); background: oklch(0.95 0.04 150); }
.myth .big { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 7vw, 40px); line-height: 1.25; margin: 0 0 12px; letter-spacing: -0.012em; }
.myth .big s { text-decoration-thickness: 3px; text-decoration-color: var(--t-red); color: var(--ink-soft); }
.myth p { margin: 0 0 10px; }
.myth p:last-child { margin: 0; }
.facts { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 18px; }
.facts li { display: grid; grid-template-columns: 4.6em 1fr; gap: 12px; align-items: baseline; }
.facts .num { font-family: var(--display); font-weight: 700; font-size: 30px; color: var(--cocoa); line-height: 1.1; font-variant-numeric: tabular-nums; }
.facts span { color: var(--ink-soft); }
.facts b { color: var(--ink); }
.note-box { margin-top: 16px; padding: 14px 16px; border-radius: var(--r-md); background: oklch(0.95 0.03 30); font-size: 15px; }
.note-box b { color: var(--t-red-ink); }
.facts { margin-bottom: 28px; }
@media (min-width: 760px) { .facts { margin-bottom: 0; } }
.sub { font-size: 20px; margin: 0 0 14px; }

/* red flags */
.flags { background: oklch(0.95 0.03 30); border-radius: var(--r-lg); padding: 24px 20px; }
.flags h2 { font-size: clamp(28px, 7vw, 38px); margin-bottom: 14px; }
.flags ul { margin: 0 0 18px; padding-left: 1.2em; }
.flags li { margin-bottom: 6px; }
.flags li::marker { color: var(--t-red); }
.urgent { display: grid; gap: 10px; }
.urgent p { margin: 0; padding: 12px 14px; border-radius: var(--r-md); background: #fffaf6; font-size: 15px; }
.urgent b { color: var(--t-red-ink); }
@media (min-width: 760px) { .flags { padding: 36px 40px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 0 40px; } .flags h2 { grid-column: 1 / -1; } }

/* footer */
footer { margin-top: 72px; padding: 28px 0 max(40px, env(safe-area-inset-bottom)); border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-soft); }
footer h3 { font-size: 17px; margin-bottom: 8px; }
footer ol { padding-left: 1.3em; margin: 0 0 20px; }
footer li { margin-bottom: 4px; }
.disclaimer { font-size: 14px; color: var(--ink); background: var(--paper-deep); padding: 12px 14px; border-radius: var(--r-md); }
.more { margin-top: 28px; }
.more h3 { margin-bottom: 10px; }
.more ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.more a { display: inline-block; padding: 8px 14px; border-radius: var(--r-pill); background: #fffdf8; color: var(--ink); text-decoration: none; font-size: 14px; box-shadow: 0 1px 3px oklch(0.4 0.04 60 / 0.12); transition-property: transform; transition-duration: 160ms; }
.more a:active { transform: scale(0.96); }

/* entrance */
.rise { opacity: 0; transform: translateY(12px); filter: blur(4px); animation: rise 700ms var(--ease) forwards; animation-delay: calc(var(--i, 0) * 100ms); }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }
@media (prefers-reduced-motion: reduce) {
  .rise { animation: none; opacity: 1; transform: none; filter: none; }
  .pointer, .reading-inner, .tile { transition-duration: 0ms; }
}
