/* Thumb-Zone Mobile First — antjanus.com redesign 076
   Rule of the system: navigation and every control a page owns live in the bottom
   third of the screen. The top of the screen is for reading, never for tapping. */

:root {
  --ground: #eceff3;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --ink: #0f1720;
  --ink-2: #334150;
  --muted: #566272;
  --line: #d8dee6;
  --tint: #364f6a;
  --tint-2: #4a6d8c;
  --tint-soft: #dde6ef;
  --on-tint: #ffffff;
  --reach: #b5441c;
  --reach-soft: #fbe7dd;
  --zone-easy: #1d7a55;
  --zone-ok: #9a6a06;
  --zone-hard: #b3372b;
  --glass: rgba(255, 255, 255, 0.82);
  --shadow: 0 1px 2px rgba(15, 23, 32, 0.06), 0 8px 24px rgba(15, 23, 32, 0.08);
  --shadow-lift: 0 2px 6px rgba(15, 23, 32, 0.08), 0 18px 40px rgba(15, 23, 32, 0.16);
  --code-bg: #111821;
  --code-ink: #dbe4ee;

  --radius: 22px;
  --radius-sm: 14px;
  --gutter: 16px;
  --dock-h: 68px;
  --bar-h: 0px;
  --safe-b: env(safe-area-inset-bottom, 0px);

  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #090c11;
    --surface: #141a22;
    --surface-2: #1b232e;
    --ink: #eef2f7;
    --ink-2: #c6cfda;
    --muted: #97a4b4;
    --line: #29333f;
    --tint: #8fb3dc;
    --tint-2: #a9c5e6;
    --tint-soft: #1f2d3d;
    --on-tint: #0a1018;
    --reach: #f2915f;
    --reach-soft: #3a2218;
    --zone-easy: #4fbe93;
    --zone-ok: #ddb44a;
    --zone-hard: #ee8579;
    --glass: rgba(20, 26, 34, 0.84);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.55);
    --code-bg: #0b1016;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #090c11;
  --surface: #141a22;
  --surface-2: #1b232e;
  --ink: #eef2f7;
  --ink-2: #c6cfda;
  --muted: #97a4b4;
  --line: #29333f;
  --tint: #8fb3dc;
  --tint-2: #a9c5e6;
  --tint-soft: #1f2d3d;
  --on-tint: #0a1018;
  --reach: #f2915f;
  --reach-soft: #3a2218;
  --zone-easy: #4fbe93;
  --zone-ok: #ddb44a;
  --zone-hard: #ee8579;
  --glass: rgba(20, 26, 34, 0.84);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.5), 0 18px 40px rgba(0, 0, 0, 0.55);
  --code-bg: #0b1016;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 72px; scroll-padding-bottom: calc(var(--dock-h) + var(--bar-h) + 24px); }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink-2);
  font: 400 1.0625rem/1.55 var(--font-ui);
  overflow-x: hidden;
  padding-bottom: calc(var(--dock-h) + var(--bar-h) + var(--safe-b) + 28px);
  -webkit-font-smoothing: antialiased;
}
body.has-bar { --bar-h: 64px; }
img { max-width: 100%; display: block; }
a { color: var(--tint); text-underline-offset: 3px; }
h1, h2, h3, h4 { color: var(--ink); font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
p { margin: 0; }
code, kbd, pre { font-family: var(--font-mono); }
:focus-visible { outline: 3px solid var(--reach); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--tint); color: var(--on-tint); padding: 12px 16px; border-radius: 12px; z-index: 100; font-weight: 700; }
.skip:focus { top: 12px; }

/* ---------- top: reading only ---------- */
.appbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(18px);
  -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 150ms;
}
.appbar.scrolled { border-bottom-color: var(--line); }
.mark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.mark svg { width: 34px; height: 34px; flex: none; }
.mark small { display: block; font-size: 0.8125rem; font-weight: 600; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; line-height: 1.1; }
.mark span { line-height: 1.1; }
.appbar-title {
  margin-left: auto; font-weight: 700; color: var(--ink); font-size: 1rem;
  opacity: 0; transform: translateY(6px); transition: opacity 150ms, transform 150ms;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55vw;
}
.appbar.scrolled .appbar-title { opacity: 1; transform: none; }
.appbar-hint { margin-left: auto; font-size: 0.8125rem; color: var(--muted); font-weight: 600; display: none; }

.wrap { width: min(1200px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.narrow { width: min(760px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.large-title { padding: 18px 0 10px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font: 600 0.8125rem/1.2 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--reach);
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.large-title h1 { font-size: clamp(2.25rem, 7vw + 0.5rem, 4.5rem); margin-top: 8px; letter-spacing: -0.035em; }
.large-title .lede { margin-top: 12px; font-size: clamp(1.125rem, 0.6vw + 1rem, 1.375rem); color: var(--ink-2); max-width: 44ch; line-height: 1.5; }

/* ---------- bottom: the dock ---------- */
.dock {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  background: var(--glass);
  backdrop-filter: saturate(1.6) blur(20px);
  -webkit-backdrop-filter: saturate(1.6) blur(20px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  transition: transform 220ms ease;
}
.dock.tucked { transform: translateY(calc(100% + 2px)); }
.dock-tabs { display: grid; grid-template-columns: repeat(5, 1fr); height: var(--dock-h); max-width: 560px; margin: 0 auto; }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 48px; text-decoration: none; color: var(--muted);
  font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.01em; position: relative;
}
.tab svg { width: 24px; height: 24px; }
.tab .pill { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; transition: background 150ms; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"] .pill { background: var(--tint-soft); color: var(--tint); }
.tab:hover .pill { background: var(--surface-2); }
.tab[aria-current="page"]:hover .pill { background: var(--tint-soft); }
.dock-extra { display: none; }

.fab {
  position: fixed; z-index: 41; right: 16px;
  bottom: calc(var(--dock-h) + var(--bar-h) + var(--safe-b) + 14px);
  width: 56px; height: 56px; border-radius: 18px; border: 0;
  background: var(--tint); color: var(--on-tint); box-shadow: var(--shadow-lift);
  display: grid; place-items: center; cursor: pointer; transition: transform 220ms ease, bottom 220ms ease;
}
.fab svg { width: 26px; height: 26px; }
.fab:active { transform: scale(0.94); }
body.dock-hidden .fab { bottom: calc(var(--bar-h) + var(--safe-b) + 14px); }

/* context bar: a page's own controls, parked right above the tabs */
.ctxbar {
  position: fixed; z-index: 39; left: 0; right: 0;
  bottom: calc(var(--dock-h) + var(--safe-b));
  height: var(--bar-h);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; padding: 0 var(--gutter);
  transition: bottom 220ms ease;
}
body.dock-hidden .ctxbar { bottom: var(--safe-b); }
.ctxbar .scroller { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 8px 0; flex: 1; min-width: 0; scroll-snap-type: x proximity; }
.ctxbar .scroller::-webkit-scrollbar { display: none; }
.ctx-label { font: 600 0.8125rem var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: 700 1.0625rem var(--font-ui);
  text-decoration: none; cursor: pointer; transition: background 150ms, transform 150ms;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: var(--tint); border-color: var(--tint); color: var(--on-tint); }
.btn-primary:hover { background: var(--tint-2); }
.btn-reach { background: var(--reach); border-color: var(--reach); color: #fff; }
:root[data-theme="dark"] .btn-reach { color: #1a0d06; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-reach { color: #1a0d06; } }
.btn-ghost { background: transparent; border-color: transparent; color: var(--tint); text-decoration: underline; text-underline-offset: 4px; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  min-height: 44px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font: 700 0.9375rem var(--font-ui); text-decoration: none; cursor: pointer; scroll-snap-align: start; white-space: nowrap;
}
.chip .count { font: 600 0.8125rem var(--font-mono); color: var(--muted); }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip[aria-pressed="true"] .count { color: var(--surface); opacity: 0.8; }
.tag {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font: 500 0.8125rem var(--font-mono); color: var(--ink-2); text-decoration: none;
}
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font: 700 0.8125rem var(--font-ui); background: var(--reach-soft); color: var(--reach); }
.badge.new { background: var(--reach); color: #fff; }
:root[data-theme="dark"] .badge.new { color: #1a0d06; }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; flex: 1; min-width: 0; }
.seg button {
  flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: 700 0.9375rem var(--font-ui); cursor: pointer; white-space: nowrap; padding: 0 10px;
}
.seg button[aria-pressed="true"], .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.field {
  flex: 1; min-width: 0; min-height: 48px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: 500 1.0625rem var(--font-ui); padding: 0 14px 0 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23738090' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center; background-size: 20px;
}
.field::placeholder { color: var(--muted); }

/* ---------- surfaces ---------- */
.section { margin-top: 44px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2.125rem); }
.section-head p { color: var(--muted); margin-top: 4px; }
.see-all { font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; white-space: nowrap; }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
.card-pad { padding: 20px; }
.card h3 { font-size: 1.25rem; }

/* inset grouped list, the app-settings shape */
.list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.list > li + li { border-top: 1px solid var(--line); }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; min-height: 72px; text-decoration: none; color: inherit; transition: background 150ms;
}
.row:hover { background: var(--surface-2); }
.row:active { background: var(--tint-soft); }
.row .thumb { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; background: linear-gradient(135deg, var(--tint), var(--tint-2)); flex: none; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row .thumb.glyph { display: grid; place-items: center; color: var(--on-tint); font: 800 1.25rem var(--font-ui); }
.row .title { color: var(--ink); font-weight: 700; font-size: 1.0625rem; line-height: 1.3; display: block; }
.row .desc { color: var(--ink-2); font-size: 1rem; margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .meta { font: 500 0.8125rem var(--font-mono); color: var(--muted); margin-top: 6px; display: block; letter-spacing: 0.02em; }
.row .chev { color: var(--muted); width: 20px; height: 20px; }
.row.no-thumb { grid-template-columns: 1fr auto; }

/* horizontal shelves */
.shelf {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(82%, 340px); gap: 14px;
  overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px var(--gutter) 18px;
  margin-inline: calc(-1 * var(--gutter)); scrollbar-width: thin; overscroll-behavior-x: contain;
}
.shelf > * { scroll-snap-align: start; }
.tile { display: flex; flex-direction: column; text-decoration: none; color: inherit; height: 100%; transition: transform 150ms; }
.tile:active { transform: scale(0.985); }
.tile .media { aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--tint), var(--tint-2)); overflow: hidden; }
.tile .media img { width: 100%; height: 100%; object-fit: cover; }
.tile .body { padding: 16px 18px 20px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.tile h3 { font-size: 1.1875rem; line-height: 1.25; }
.tile p { font-size: 1rem; color: var(--ink-2); }
.tile .meta { font: 500 0.8125rem var(--font-mono); color: var(--muted); margin-top: auto; padding-top: 8px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 16px 14px; }
.stat b { display: block; font-size: clamp(1.625rem, 3vw + 0.8rem, 2.5rem); color: var(--ink); font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat span { font: 600 0.8125rem var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- sheet (dialog) ---------- */
dialog.sheet {
  margin: auto auto 0; width: min(640px, 100%); max-width: 100%; max-height: 86dvh;
  border: 0; padding: 0 0 calc(16px + var(--safe-b)); border-radius: 26px 26px 0 0;
  background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-lift); overflow: auto;
}
dialog.sheet[open] { animation: sheet-up 240ms cubic-bezier(0.2, 0.8, 0.2, 1); }
dialog.sheet::backdrop { background: rgba(6, 10, 16, 0.5); }
@keyframes sheet-up { from { transform: translateY(40%); opacity: 0.4; } to { transform: none; opacity: 1; } }
.grabber { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 10px auto 6px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 20px 10px; }
.sheet-head h2 { font-size: 1.375rem; }
.sheet-body { padding: 0 20px; display: grid; gap: 18px; }
.icon-btn { width: 48px; height: 48px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; flex: none; text-decoration: none; }
.icon-btn svg { width: 22px; height: 22px; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.sheet-link {
  display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-weight: 700;
}
.sheet-link svg { width: 22px; height: 22px; color: var(--tint); flex: none; }
.sheet-link small { display: block; font-weight: 500; color: var(--muted); font-size: 0.875rem; }
.sheet-label { font: 600 0.8125rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }

/* ---------- footer ---------- */
.foot { margin-top: 64px; padding: 32px 0 8px; border-top: 1px solid var(--line); }
.foot-grid { display: grid; gap: 28px; }
.foot h2 { font-size: 1.125rem; margin-bottom: 10px; }
.foot p, .foot li { color: var(--ink-2); }
.foot ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.foot ul a { display: inline-flex; min-height: 40px; align-items: center; text-decoration: none; color: var(--ink); font-weight: 600; }
.foot ul a:hover { color: var(--tint); text-decoration: underline; }
.news { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.news input { flex: 1 1 200px; min-height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 500 1.0625rem var(--font-ui); padding: 0 14px; }
.news-status { margin-top: 8px; font-weight: 600; color: var(--zone-easy); min-height: 1.4em; }
.copyright { margin-top: 28px; font-size: 0.9375rem; color: var(--muted); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- home ---------- */
.hero { display: grid; gap: 14px; }
.hero-photo { position: relative; border-radius: 28px; overflow: hidden; min-height: 460px; background: #1e2a36; box-shadow: var(--shadow-lift); isolation: isolate; }
.hero-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 22% 30%; z-index: -1; }
.hero-photo::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(8, 12, 18, 0) 30%, rgba(8, 12, 18, 0.62) 58%, rgba(8, 12, 18, 0.94) 100%); }
.hero-copy { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px; color: #eef2f7; }
.hero-copy h1 { color: #fff; font-size: clamp(2.125rem, 6vw + 0.4rem, 4.25rem); letter-spacing: -0.035em; line-height: 1.02; max-width: 13ch; }
.hero-copy p { margin-top: 12px; font-size: 1.125rem; color: #dbe3ec; max-width: 46ch; }
.hero-hi { font: 600 0.875rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: #ffc9ae; margin-bottom: 10px; display: block; }
.hero-actions { display: grid; gap: 10px; }
.hero-actions .btn-row .btn { flex: 1 1 160px; }

.widgets { display: grid; gap: 14px; grid-template-columns: repeat(2, 1fr); }
.widget { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; display: flex; flex-direction: column; gap: 8px; text-decoration: none; color: inherit; min-height: 150px; transition: transform 150ms; }
.widget:active { transform: scale(0.98); }
.widget .w-icon { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--tint-soft); color: var(--tint); }
.widget .w-icon svg { width: 24px; height: 24px; }
.widget h3 { font-size: 1.125rem; line-height: 1.25; }
.widget p { font-size: 1rem; color: var(--ink-2); }
.widget .w-type { font: 600 0.8125rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: auto; }
.widget.dark { background: var(--tint); border-color: var(--tint); color: var(--on-tint); }
.widget.dark h3, .widget.dark p { color: var(--on-tint); }
.widget.wide { grid-column: 1 / -1; }

.reach-card { display: grid; gap: 18px; align-items: center; }
.reach-card svg.phone { width: 100%; max-width: 220px; margin: 0 auto; height: auto; }
.legend { display: grid; gap: 8px; margin-top: 12px; }
.legend span { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--ink); }
.legend i { width: 14px; height: 14px; border-radius: 4px; flex: none; }

/* ---------- writing ---------- */
.year { font: 700 0.875rem var(--font-mono); color: var(--muted); letter-spacing: 0.08em; margin: 26px 4px 10px; display: flex; align-items: center; gap: 10px; }
.year::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.coll-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dg { background: var(--zone-easy); }
.dt { background: var(--zone-ok); }
.ai-c { background: var(--tint); }
.empty { padding: 28px 20px; text-align: center; }
.empty h3 { font-size: 1.25rem; }
.empty p { margin: 6px 0 14px; }
.duo { display: grid; gap: 14px; }

/* ---------- ai / stories ---------- */
.consult { display: grid; gap: 14px; align-items: center; padding: 20px; background: var(--reach-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.consult p { color: var(--ink); font-weight: 600; font-size: 1.125rem; }
.stories { grid-auto-columns: min(78%, 300px); }
.story { position: relative; aspect-ratio: 9 / 15; border-radius: 24px; overflow: hidden; background: #111a24; color: #fff; text-decoration: none; display: flex; flex-direction: column; justify-content: flex-end; isolation: isolate; box-shadow: var(--shadow-lift); }
.story img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; }
.story::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(5, 8, 12, 0.1) 20%, rgba(5, 8, 12, 0.92) 72%); }
.story .s-body { padding: 18px; display: grid; gap: 8px; }
.story .part { font: 600 0.8125rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: #ffc9ae; }
.story h3 { color: #fff; font-size: 1.3125rem; }
.story p { color: #d7dfe8; font-size: 1rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.story .progress-dots { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; gap: 4px; }
.story .progress-dots i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.35); }
.story .progress-dots i.on { background: #fff; }
.story.soon { background: repeating-linear-gradient(135deg, var(--surface-2) 0 14px, var(--surface) 14px 28px); color: var(--ink); border: 1px dashed var(--line); box-shadow: none; }
.story.soon::after { display: none; }
.story.soon h3 { color: var(--ink); }
.story.soon p { color: var(--ink-2); }
.story.soon .part { color: var(--reach); }
.notice { display: flex; gap: 12px; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--zone-ok); }

/* ---------- projects ---------- */
.feature { display: grid; }
.feature .media { background: #0e1a2a; aspect-ratio: 16 / 9; overflow: hidden; }
.feature .media img { width: 100%; height: 100%; object-fit: cover; }
.feature .stats { border-radius: 16px; margin-top: 16px; }
.techs { display: flex; flex-wrap: wrap; gap: 6px; }
.proj-grid { display: grid; gap: 14px; }
.proj { display: flex; flex-direction: column; }
.proj .media { aspect-ratio: 16 / 10; background: #0d1117; overflow: hidden; display: grid; place-items: center; }
.proj .media img { width: 100%; height: 100%; object-fit: cover; }
.proj .media.term { background: #0d1117 radial-gradient(circle at 20% 20%, rgba(143, 179, 220, 0.15), transparent 60%); }
.proj .media.term img { object-fit: contain; }
.proj .body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.proj h3 { font-size: 1.1875rem; }
.proj .foot-row { margin-top: auto; padding-top: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.stars { font: 600 0.875rem var(--font-mono); color: var(--ink); display: inline-flex; gap: 4px; align-items: center; }
.anchor-target { scroll-margin-top: 80px; }

/* ---------- about ---------- */
.profile { display: grid; gap: 18px; }
.profile-photo { border-radius: 28px; overflow: hidden; aspect-ratio: 4 / 5; background: #1f2b22; box-shadow: var(--shadow-lift); max-height: 520px; }
.profile-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.phase { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.phase summary { list-style: none; cursor: pointer; padding: 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; min-height: 72px; }
.phase summary::-webkit-details-marker { display: none; }
.phase summary .when { font: 700 0.875rem var(--font-mono); color: var(--reach); white-space: nowrap; }
.phase summary h3 { font-size: 1.1875rem; }
.phase summary .plus { width: 36px; height: 36px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; transition: transform 150ms; }
.phase[open] summary .plus { transform: rotate(45deg); }
.phase .phase-body { padding: 0 18px 18px; display: grid; gap: 12px; }
.role { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.role b { color: var(--ink); display: block; }
.role span { font: 500 0.875rem var(--font-mono); color: var(--muted); }
.role ul { margin: 8px 0 0; padding-left: 20px; }
.careerbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.careerbar span { flex: none; padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); font-weight: 700; color: var(--ink); font-size: 0.9375rem; }
.careerbar span small { display: block; font: 500 0.8125rem var(--font-mono); color: var(--muted); }
.careerbar span.now { background: var(--tint); color: var(--on-tint); border-color: var(--tint); }
.careerbar span.now small { color: var(--on-tint); opacity: 0.85; }
.proverbs { grid-auto-columns: min(84%, 380px); }
.proverb { background: var(--ink); color: var(--surface); border-radius: var(--radius); padding: 24px; min-height: 200px; display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.proverb q { font-size: 1.375rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.01em; quotes: "\201C" "\201D"; }
.proverb span { font: 600 0.8125rem var(--font-mono); opacity: 0.75; }
.caps { display: grid; gap: 14px; }
.cap h3 { font-size: 1.1875rem; }
.cap p { margin: 6px 0 12px; }

/* ---------- article ---------- */
.progress { position: fixed; top: 0; left: 0; height: 3px; background: var(--reach); width: 0; z-index: 60; }
.art-hero { margin-top: 8px; border-radius: 28px; overflow: hidden; background: #20303f; aspect-ratio: 16 / 9; box-shadow: var(--shadow); }
.art-hero img { width: 100%; height: 100%; object-fit: cover; }
.art-head { padding: 22px 0 6px; }
.crumb { display: inline-flex; min-height: 44px; align-items: center; gap: 8px; font-weight: 700; text-decoration: none; }
.art-head h1 { font-size: clamp(2rem, 4vw + 1rem, 3.5rem); letter-spacing: -0.03em; line-height: 1.08; margin-top: 4px; }
.art-head .desc { font-size: 1.25rem; margin-top: 12px; color: var(--ink-2); }
.art-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; font: 500 0.875rem var(--font-mono); color: var(--muted); align-items: center; }
.art-layout { display: grid; gap: 32px; }
.toc-side { display: none; }
.prose { font-size: 1.125rem; line-height: 1.7; color: var(--ink-2); }
.prose.size-l { font-size: 1.25rem; }
.prose.size-xl { font-size: 1.375rem; }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { font-size: 1.75rem; margin-top: 2.2em; scroll-margin-top: 80px; }
.prose h2 a.anchor { color: var(--muted); text-decoration: none; margin-left: 8px; font-weight: 500; opacity: 0; }
.prose h2:hover a.anchor, .prose h2 a.anchor:focus-visible { opacity: 1; }
.prose ol, .prose ul { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose code:not(pre code) { font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; color: var(--ink); }
.prose strong { color: var(--ink); }
.prose a { font-weight: 600; }
.codeblock { border-radius: 18px; overflow: hidden; background: var(--code-bg); border: 1px solid var(--line); margin-inline: calc(-1 * var(--gutter) + 4px); }
.codeblock .cb-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 16px; background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.codeblock .cb-lang { font: 600 0.8125rem var(--font-mono); color: #9fb0c3; letter-spacing: 0.06em; }
.codeblock .copy { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.16); background: transparent; color: #e6edf3; font: 700 0.875rem var(--font-ui); cursor: pointer; }
.codeblock .copy:hover { background: rgba(255, 255, 255, 0.08); }
.codeblock pre { margin: 0; padding: 16px; overflow-x: auto; font-size: 0.875rem; line-height: 1.65; color: var(--code-ink); tab-size: 2; }
.tk-k { color: #ff9f7a; } .tk-s { color: #a8d8a0; } .tk-c { color: #8494a6; font-style: italic; } .tk-t { color: #8fc1ff; }
.callout { border-radius: 16px; padding: 16px 18px; border: 1px solid var(--line); background: var(--surface); display: grid; gap: 6px; }
.callout .c-label { font: 700 0.8125rem var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; display: flex; gap: 8px; align-items: center; }
.callout.why { border-left: 5px solid var(--tint); }
.callout.why .c-label { color: var(--tint); }
.callout.ask { border-left: 5px solid var(--reach); background: var(--reach-soft); }
.callout.ask .c-label { color: var(--reach); }
.callout.note { border-left: 5px solid var(--zone-ok); }
.callout.note .c-label { color: var(--zone-ok); }
.callout.skill { border-left: 5px solid var(--zone-easy); }
.callout.skill .c-label { color: var(--zone-easy); }
.filed { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.toc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: toc; }
.toc-list a { display: flex; gap: 12px; align-items: center; min-height: 52px; padding: 8px 14px; border-radius: 14px; text-decoration: none; color: var(--ink); font-weight: 600; counter-increment: toc; }
.toc-list a::before { content: counter(toc, decimal-leading-zero); font: 600 0.8125rem var(--font-mono); color: var(--muted); }
.toc-list a:hover { background: var(--surface-2); }
.toc-list a.active { background: var(--tint-soft); color: var(--tint); }
.toc-list a.active::before { color: var(--tint); }
.readbar { justify-content: space-between; }
.readbar .rb-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; min-width: 48px; justify-content: center; padding: 0 12px; border-radius: 14px; border: 0; background: transparent; color: var(--ink); font: 700 0.9375rem var(--font-ui); cursor: pointer; text-decoration: none; }
.readbar .rb-btn:hover { background: var(--surface-2); }
.readbar .rb-btn svg { width: 22px; height: 22px; }
.ring { width: 36px; height: 36px; flex: none; }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--reach); stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 80ms linear; }
.pct { font: 700 0.875rem var(--font-mono); color: var(--ink); min-width: 3.2ch; }
.after-article { display: grid; gap: 14px; margin-top: 40px; }
.share-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.share-row .btn { padding: 0 10px; }

/* ---------- patterns ---------- */
.three-ways { display: grid; gap: 10px; }
.way { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.way .num { width: 40px; height: 40px; border-radius: 12px; background: var(--tint); color: var(--on-tint); display: grid; place-items: center; font: 700 1rem var(--font-mono); }
.way b { color: var(--ink); font-size: 1.0625rem; }
.pat-grid { display: grid; gap: 12px; }
.pat { display: grid; grid-template-columns: 92px 1fr; gap: 14px; padding: 12px; text-decoration: none; color: inherit; align-items: start; }
.pat:hover { background: var(--surface-2); }
.pat .p-thumb { aspect-ratio: 1; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.pat .p-thumb svg { width: 72%; height: 72%; }
.pat .p-cat { font: 600 0.8125rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pat h3 { font-size: 1.125rem; margin-top: 4px; line-height: 1.25; }
.pat p { font-size: 1rem; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.pat .p-date { font: 500 0.8125rem var(--font-mono); color: var(--muted); margin-top: 6px; display: block; }
.result-line { display: flex; justify-content: space-between; align-items: center; margin: 18px 4px 10px; font-weight: 700; color: var(--ink); gap: 12px; flex-wrap: wrap; }
.result-line select { min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 1rem var(--font-ui); padding: 0 10px; }
.searchbar { gap: 8px; }

/* pattern detail */
.uses { columns: 2 220px; padding-left: 1.2em; margin: 8px 0 0; }
.uses li { margin-bottom: 6px; break-inside: avoid; }
.panes { margin-top: 20px; }
.panes .seg { margin: 12px; }
.pane { padding: 0 16px 18px; }
.pane[hidden] { display: none; }
.stage { background: var(--ground); border-radius: 16px; padding: 18px; border: 1px solid var(--line); }
.pane pre { margin: 0; background: var(--code-bg); color: var(--code-ink); border-radius: 14px; padding: 16px; overflow-x: auto; font-size: 0.875rem; line-height: 1.6; }
.pane .prompt { font-size: 1.0625rem; line-height: 1.65; display: grid; gap: 1em; background: var(--surface-2); padding: 18px; border-radius: 14px; border: 1px solid var(--line); }
.pane-note { font-size: 1rem; margin-bottom: 12px; padding: 12px 14px; border-radius: 12px; background: var(--tint-soft); color: var(--ink); }
.cap-line { font-size: 1rem; color: var(--muted); margin: 0 0 10px; }
.hss-strip { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; grid-template-columns: 1fr; }
@container stage (min-width: 21rem) { .hss-strip { grid-template-columns: repeat(2, 1fr); } }
@container stage (min-width: 42rem) { .hss-strip.four { grid-template-columns: repeat(4, 1fr); } .hss-strip.five { grid-template-columns: repeat(5, 1fr); } }
.stage { container: stage / inline-size; }
.hss-tile { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; text-align: left; border: 0; font: inherit; color: inherit; min-width: 0; }
button.hss-tile { cursor: pointer; min-height: 72px; }
button.hss-tile[aria-pressed="true"] { background: color-mix(in srgb, var(--tint) 16%, var(--surface)); box-shadow: inset 0 -3px 0 var(--tint); }
.hss-label { font: 600 0.8125rem var(--font-mono); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); overflow-wrap: anywhere; }
.hss-fig { font-size: 1.6rem; font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.hss-fig.none { color: var(--muted); font-weight: 500; }
.hss-sub { font-size: 0.9375rem; color: var(--muted); }
.dl-list { list-style: none; margin: 12px 0 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.dl-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; color: var(--ink); flex-wrap: wrap; }
.dl-list li + li { border-top: 1px solid var(--line); }
.dl-list li span { font: 600 0.875rem var(--font-mono); color: var(--muted); }
.status-line { margin-top: 10px; font-weight: 600; color: var(--ink); }
.neighbors { display: grid; gap: 10px; margin-top: 28px; }

/* ---------- motion preference ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------- scale up: tablet ---------- */
@media (min-width: 700px) {
  :root { --gutter: 28px; }
  .widgets { grid-template-columns: repeat(4, 1fr); }
  .widget.span2 { grid-column: span 2; }
  .proj-grid { grid-template-columns: repeat(2, 1fr); }
  .duo { grid-template-columns: 1fr 1fr; }
  .pat-grid { grid-template-columns: repeat(2, 1fr); }
  .consult { grid-template-columns: 1fr auto; }
  .foot-grid { grid-template-columns: 1.3fr 1fr 1fr 1.5fr; }
  .reach-card { grid-template-columns: 220px 1fr; }
  .caps { grid-template-columns: 1fr 1fr; }
  .codeblock { margin-inline: 0; }
}

/* ---------- scale up: desktop — the bar becomes a floating dock, still at the bottom ---------- */
@media (min-width: 1000px) {
  :root { --dock-h: 64px; }
  body.has-bar { --bar-h: 0px; }
  .appbar-hint { display: block; }
  .appbar.scrolled .appbar-hint { display: none; }
  .dock {
    left: 50%; right: auto; bottom: 18px; transform: translateX(-50%);
    border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-lift); padding: 6px;
    display: flex; align-items: center; gap: 6px;
  }
  .dock.tucked { transform: translateX(-50%); }
  .dock-tabs { display: flex; height: auto; gap: 2px; max-width: none; }
  .tab { flex-direction: row; gap: 8px; min-height: 52px; padding: 0 16px 0 10px; border-radius: 18px; font-size: 1rem; }
  .tab .pill { width: auto; height: auto; background: none !important; }
  .tab svg { width: 22px; height: 22px; }
  .tab:hover { background: var(--surface-2); }
  .tab[aria-current="page"] { background: var(--tint); color: var(--on-tint); }
  .tab[aria-current="page"] .pill { color: var(--on-tint); }
  .dock-extra { display: flex; gap: 6px; align-items: center; padding-left: 6px; border-left: 1px solid var(--line); }
  .dock-extra .icon-btn { width: 52px; height: 52px; border-radius: 18px; }
  .fab { display: none; }

  .ctxbar {
    position: fixed; left: 50%; right: auto; transform: translateX(-50%);
    bottom: calc(18px + var(--dock-h) + 12px + 12px); height: 64px; width: min(880px, 100% - 64px);
    border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow-lift); background: var(--glass);
    backdrop-filter: saturate(1.6) blur(20px); -webkit-backdrop-filter: saturate(1.6) blur(20px);
  }
  body.has-bar { padding-bottom: 200px; }
  body { padding-bottom: 130px; }
  body.dock-hidden .ctxbar { bottom: calc(18px + var(--dock-h) + 24px); }

  .hero { grid-template-columns: 1.35fr 1fr; align-items: stretch; }
  .hero-photo { min-height: 600px; }
  .hero-actions { align-content: end; }
  .widgets { grid-template-columns: repeat(6, 1fr); }
  .widgets .widget { grid-column: span 2; }
  .widgets .widget.span3 { grid-column: span 3; }
  .widgets .widget.wide { grid-column: 1 / -1; }
  .shelf { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); grid-auto-columns: auto; overflow: visible; margin-inline: 0; padding-inline: 0; }
  .shelf.stories { grid-template-columns: repeat(5, 1fr); }
  .shelf.proverbs { grid-template-columns: repeat(5, 1fr); }
  .proverb q { font-size: 1.1875rem; }
  .proj-grid { grid-template-columns: repeat(3, 1fr); }
  .proj-grid.two { grid-template-columns: repeat(2, 1fr); }
  .feature { grid-template-columns: 1.15fr 1fr; }
  .feature .media { aspect-ratio: auto; min-height: 100%; }
  .profile { grid-template-columns: 380px 1fr; align-items: end; }
  .pat-grid { grid-template-columns: repeat(3, 1fr); }
  .three-ways { grid-template-columns: repeat(3, 1fr); }
  .art-layout { grid-template-columns: 250px minmax(0, 720px); justify-content: center; gap: 56px; }
  .toc-side { display: block; position: sticky; top: 84px; align-self: start; max-height: calc(100vh - 220px); overflow: auto; }
  .readbar .only-mobile { display: none; }
  .caps { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1000px) {
  .page-article .ctxbar { width: min(720px, 100% - 64px); }
}

/* ---------- fix pass ---------- */
.mark { flex: none; min-width: 0; }
.mark small { white-space: nowrap; }
.appbar-title { flex: 1; min-width: 0; text-align: right; }
.widgets { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.widget { min-width: 0; }
.sheet-link span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 699px) {
  .widget.full-mobile { grid-column: 1 / -1; }
  .reach-card { grid-template-columns: 104px 1fr; gap: 14px; }
  .reach-card svg.phone { max-width: 104px; }
  .reach-card h2 { font-size: 1.125rem !important; }
}
@media (min-width: 700px) { .widgets { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1000px) {
  .widgets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .art-hero { aspect-ratio: auto; height: 380px; max-width: 1026px; margin-inline: auto; }
}
[hidden] { display: none !important; }
.appbar-title { order: 1; }
.appbar-hint { order: 2; margin-left: 16px; }

/* gallery article */
.prose figure { margin: 0; }
.prose figure img { display: block; width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--line); }
.prose blockquote.callout { margin: 0; }
.prose .live-pattern .btn { white-space: normal; text-align: left; }
