/* Layout: one long, left-aligned page in alternating bands, modelled on a
   clean light engineering portfolio. The memorable element is the journey
   chart; everything else stays quiet.
   Colour: cool paper, ink, solder-mask green accent, gold for milestones. */

:root {
  --paper: #f5f7f5;
  --band: #ebf0ec;
  --surface: #ffffff;
  --ink: #142019;
  --ink-2: #4a5a51;
  --ink-3: #6b7a72;
  --rule: #d6ded8;
  --mask: #1d5a44;
  --mask-ink: #ffffff;
  --mask-soft: #dfece5;
  --pad: #b08718;
  --pad-soft: #f5edd3;
  --study: #8aa79a;
  --work: #1d5a44;
  --project: #b08718;
  --term: #0f1a15;
  --term-ink: #d8e6de;
  --term-dim: #8fa99b;
  --term-accent: #7fd1ac;

  --f-text: "Archivo", "Helvetica Neue", Arial, sans-serif;
  /* Display face for the big titles only. Swap this one line to change it. */
  --f-display: "Bricolage Grotesque", "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --t-xs: 0.8125rem; --t-sm: 0.9375rem; --t-md: 1.0625rem; --t-lg: 1.3125rem; --t-xl: 1.625rem; --t-2xl: 2.25rem;
  --measure: 66ch;
  --page: 1160px;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1512; --band: #121c18; --surface: #16211c; --ink: #e2ebe6; --ink-2: #a6b6ad; --ink-3: #86978e; --rule: #283630;
    --mask: #7fd1ac; --mask-ink: #0e1512; --mask-soft: #193128; --pad: #ddb952; --pad-soft: #2b2611;
    --study: #4f6b5e; --work: #7fd1ac; --project: #ddb952; --term: #09100d; --term-ink: #d8e6de; --term-dim: #8fa99b; --term-accent: #7fd1ac;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1512; --band: #121c18; --surface: #16211c; --ink: #e2ebe6; --ink-2: #a6b6ad; --ink-3: #86978e; --rule: #283630;
  --mask: #7fd1ac; --mask-ink: #0e1512; --mask-soft: #193128; --pad: #ddb952; --pad-soft: #2b2611;
  --study: #4f6b5e; --work: #7fd1ac; --project: #ddb952; --term: #09100d; --term-ink: #d8e6de; --term-dim: #8fa99b; --term-accent: #7fd1ac;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-text); font-size: var(--t-md); line-height: 1.6; }
img, video, iframe { max-width: 100%; display: block; }
img, video { height: auto; }
a { color: var(--mask); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--mask); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
code { font-family: var(--f-mono); font-size: 0.88em; background: var(--mask-soft); padding: 0.05em 0.35em; border-radius: 4px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: max(16px, env(safe-area-inset-left, 0px)); }

.wrap { max-width: var(--page); margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.section { padding-block: 5rem; }
.band { background: var(--band); padding-block: 5rem; border-block: 1px solid var(--rule); }
.section-head { display: grid; gap: 0.6rem; max-width: 46rem; margin-bottom: 2.25rem; }
.section-head h2 { font-family: var(--f-display); font-size: clamp(1.9rem, 3.8vw, 2.6rem); font-weight: 750; letter-spacing: -0.025em; }
.section-head p { color: var(--ink-2); font-size: var(--t-md); }

/* Header */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--paper); }
.site-header { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--paper) 90%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; font-variation-settings: "wdth" 115; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--mask); color: var(--mask-ink); font-family: var(--f-mono); font-weight: 600; font-size: 1rem; }
.brand-dot { color: var(--pad); }
.nav { display: flex; align-items: center; gap: 0.4rem; }
.nav-list { display: flex; gap: 0.15rem; list-style: none; }
.nav-list a { display: block; padding: 0.45rem 0.65rem; color: var(--ink-2); text-decoration: none; font-size: var(--t-sm); border-radius: 6px; }
.nav-list a:hover { color: var(--ink); background: var(--mask-soft); }
.nav-cta .btn { min-height: 2.3rem; padding-block: 0.3rem; }
.icon-btn { appearance: none; border: 1px solid var(--rule); background: transparent; color: var(--ink); border-radius: 8px; width: 2.4rem; height: 2.4rem; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--mask-soft); }
.icon-btn svg { width: 18px; height: 18px; }
.menu { display: none; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
@media (max-width: 960px) {
  .desktop { display: none !important; }
  .menu { display: block; position: relative; }
  .menu-panel { position: absolute; right: 0; top: calc(100% + 0.5rem); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 0.5rem; min-width: 14rem; box-shadow: 0 12px 32px color-mix(in srgb, var(--ink) 14%, transparent); }
  .menu-panel ul { list-style: none; display: grid; }
  .menu-panel a { display: block; padding: 0.6rem 0.75rem; color: var(--ink); text-decoration: none; border-radius: 6px; }
  .menu-panel a:hover { background: var(--mask-soft); }
  .menu-cta { padding: 0.5rem 0.25rem 0.25rem; border-top: 1px solid var(--rule); margin-top: 0.4rem; }
  .menu-cta .btn { width: 100%; justify-content: center; color: var(--mask-ink); }
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.btn { display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem; padding: 0.5rem 1.05rem; border-radius: 8px; border: 1px solid var(--rule); color: var(--ink); background: var(--surface); text-decoration: none; font: inherit; font-size: var(--t-sm); font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--mask); border-color: var(--mask); color: var(--mask-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn svg { width: 16px; height: 16px; flex: none; }
.copy-row { display: inline-flex; align-items: stretch; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); overflow: hidden; max-width: 100%; }
.copy-row .addr { padding: 0.6rem 0.9rem; font-family: var(--f-mono); font-size: var(--t-sm); align-self: center; user-select: all; overflow-wrap: anywhere; }
.copy-row button { appearance: none; border: 0; border-left: 1px solid var(--rule); background: transparent; color: var(--ink); font: inherit; font-size: var(--t-sm); font-weight: 650; padding: 0 1rem; cursor: pointer; }
.copy-row button:hover { background: var(--mask-soft); }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.9fr); gap: 3.5rem; align-items: center; padding-block: 4.5rem 5rem; }
.badge { display: inline-flex; align-items: center; gap: 0.55rem; padding: 0.35rem 0.85rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: var(--t-sm); font-weight: 600; color: var(--ink-2); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #2fa36b; box-shadow: 0 0 0 0 color-mix(in srgb, #2fa36b 50%, transparent); }
@media (prefers-reduced-motion: no-preference) { .pulse { animation: pulse 2.4s ease-out infinite; } @keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, #2fa36b 45%, transparent); } 80%, 100% { box-shadow: 0 0 0 9px transparent; } } }
.hero h1 { font-family: var(--f-display); font-size: clamp(4.25rem, 13vw, 9rem); font-weight: 800; letter-spacing: -0.05em; line-height: 0.9; margin-top: 1.4rem; }
.hero .role { font-family: var(--f-display); font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 650; color: var(--mask); margin-top: 0.6rem; letter-spacing: -0.01em; }
.intro { display: grid; gap: 0.8rem; margin-top: 1.4rem; max-width: 38rem; color: var(--ink-2); font-size: 1.125rem; line-height: 1.65; }
.hero .actions { margin-top: 1.9rem; }
.meta-line { margin-top: 1.25rem; font-size: var(--t-sm); color: var(--ink-3); }

.snapshot { background: var(--term); color: var(--term-ink); border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px -20px color-mix(in srgb, #0f1a15 45%, transparent); font-family: var(--f-mono); font-size: 0.86rem; }
.snap-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.7rem 1rem; border-bottom: 1px solid color-mix(in srgb, var(--term-ink) 12%, transparent); }
.snap-bar i { width: 10px; height: 10px; border-radius: 50%; background: color-mix(in srgb, var(--term-ink) 25%, transparent); }
.snap-bar span { margin-left: 0.6rem; color: var(--term-dim); font-size: 0.78rem; }
.snap-body { padding: 1.25rem 1.25rem 1.4rem; display: grid; gap: 0.2rem; }
.cmd { color: var(--term-ink); }
.prompt { color: var(--term-accent); }
.out { color: var(--term-dim); margin-bottom: 0.7rem; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin: 0.5rem 0 0; }
.stats div { padding: 0.85rem; border: 1px solid color-mix(in srgb, var(--term-ink) 12%, transparent); border-radius: 8px; }
.stats dt { font-family: var(--f-text); font-variation-settings: "wdth" 115; font-weight: 750; font-size: 1.35rem; color: #fff; letter-spacing: -0.01em; }
:root[data-theme="dark"] .stats dt { color: var(--term-ink); }
.stats dd { margin: 0.2rem 0 0; color: var(--term-dim); font-size: 0.76rem; line-height: 1.45; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 2.5rem; padding-block: 3rem 4rem; } }
@media (max-width: 340px) { .stats { grid-template-columns: 1fr; } }

/* Journey: a single line with stops, cards alternating above and below */
.legend { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: var(--t-sm); color: var(--ink-2); margin-bottom: 1.5rem; }
.lg { display: inline-flex; align-items: center; gap: 0.45rem; }
.lg::before { content: ""; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
.lg-study::before { border: 3px solid var(--study); background: var(--surface); }
.lg-work::before { background: var(--work); }
.lg-project::before { background: var(--project); }
.lg-milestone::before { width: 14px; height: 14px; border-radius: 3px; transform: rotate(45deg); background: var(--surface); border: 3px solid var(--pad); }
.metro { position: relative; }
.line { list-style: none; position: relative; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); }
.line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--study) 0%, var(--work) 22%, var(--work) 80%, var(--pad) 100%); transform-origin: left center; }
.stop { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr 3.25rem 1fr; justify-items: center; min-width: 0; }
.stop-dot { grid-row: 2; align-self: center; width: 20px; height: 20px; border-radius: 50%; position: relative; z-index: 1; background: var(--c); border: 4px solid var(--band); box-shadow: 0 0 0 2px var(--c); }
.stop-study { --c: var(--study); } .stop-work { --c: var(--work); } .stop-project { --c: var(--project); }
.stop-study .stop-dot { background: var(--surface); }
.stop-milestone { --c: var(--pad); }
.stop-milestone .stop-dot { width: 24px; height: 24px; border-radius: 5px; transform: rotate(45deg); background: var(--pad); }
.stop-now .stop-dot::after { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 2px solid var(--project); opacity: 0; }
.stop-card { grid-row: 1; align-self: end; width: 180%; display: grid; gap: 0.25rem; padding: 0.95rem 1.05rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); position: relative; z-index: 2; }
.stop:nth-child(even) .stop-card { grid-row: 3; align-self: start; }
.stop-card::after { content: ""; position: absolute; left: 50%; width: 2px; height: 0.85rem; background: var(--rule); transform: translateX(-50%); top: 100%; }
.stop:nth-child(even) .stop-card::after { top: auto; bottom: 100%; }
.stop:first-child .stop-card { justify-self: start; width: 150%; }
.stop:first-child .stop-card::after { left: calc(100% / 3); }
.stop:last-child .stop-card { justify-self: end; width: 150%; }
.stop:last-child .stop-card::after { left: auto; right: calc(100% / 3); transform: translateX(50%); }
.stop-when { font-family: var(--f-mono); font-size: 0.74rem; color: var(--ink-3); }
.stop-card h3 { font-family: var(--f-display); font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.stop-card p { font-size: 0.84rem; color: var(--ink-2); line-height: 1.45; }
.stop-milestone .stop-card { border-color: var(--pad); background: var(--pad-soft); }
.stop-now .stop-card { border-color: var(--project); }
.stop-now .stop-when { color: var(--project); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .js .metro:not(.in) .line::before { transform: scaleX(0); }
  .js .metro:not(.in) .stop-dot { transform: scale(0); }
  .js .metro:not(.in) .stop-milestone .stop-dot { transform: rotate(45deg) scale(0); }
  .js .metro .line::before { transition: transform 1.4s cubic-bezier(.4,.1,.2,1); }
  .js .metro .stop-dot { transition: transform 0.35s cubic-bezier(.3,1.6,.5,1) calc(var(--i) * 160ms + 120ms); }
  .stop-now .stop-dot::after { animation: ring 2.2s ease-out infinite; }
  @keyframes ring { 0% { transform: scale(0.6); opacity: 0.9; } 100% { transform: scale(1.5); opacity: 0; } }
}
@media (max-width: 980px) {
  .line { grid-template-columns: 1fr; gap: 1rem; padding-left: 2.5rem; }
  .line::before { left: 0.85rem; right: auto; top: 0.5rem; bottom: 0.5rem; width: 4px; height: auto; margin: 0; background: linear-gradient(180deg, var(--study) 0%, var(--work) 22%, var(--work) 80%, var(--pad) 100%); transform-origin: center top; }
  .js .metro:not(.in) .line::before { transform: scaleY(0); }
  .stop { display: block; }
  .stop-dot { position: absolute; left: -2.5rem; top: 1.1rem; margin-left: calc(0.85rem + 2px - 10px); }
  .stop-milestone .stop-dot { margin-left: calc(0.85rem + 2px - 12px); }
  .stop-card, .stop:first-child .stop-card, .stop:last-child .stop-card { width: auto; max-width: 34rem; }
  .stop-card::after { display: none; }
}

/* Karios */
.karios-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2rem; align-items: end; margin-bottom: 2.25rem; }
.karios-head .section-head { margin-bottom: 0; }
.karios-badge { display: grid; grid-template-columns: auto auto auto; grid-template-rows: auto auto; column-gap: 0.75rem; align-items: center; padding: 1rem 1.25rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); }
.karios-badge span:not(.kb-arrow) { grid-row: 2; font-family: var(--f-mono); font-size: var(--t-xs); color: var(--ink-3); }
.karios-badge span:last-child { grid-column: 3; }
.karios-badge strong { grid-row: 1; font-family: var(--f-display); font-size: var(--t-xl); font-weight: 700; letter-spacing: -0.015em; }
.karios-badge strong:last-of-type { grid-column: 3; color: var(--mask); }
.kb-arrow { grid-row: 1 / span 2; grid-column: 2; color: var(--pad); }
.kb-arrow svg { width: 26px; height: 26px; display: block; }
.track { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: relative; gap: 1.5rem; padding-top: 2rem; }
.track::before { content: ""; position: absolute; top: 0.55rem; left: 0.5rem; right: 0; height: 3px; border-radius: 2px; background: linear-gradient(90deg, var(--mask) 0 75%, var(--pad) 75%); }
.step { position: relative; display: grid; gap: 0.35rem; align-content: start; }
.step::before { content: ""; position: absolute; top: -1.8rem; left: 0; width: 16px; height: 16px; border-radius: 50%; background: var(--paper); border: 3px solid var(--mask); }
.step.up::before { background: var(--pad); border-color: var(--pad); width: 20px; height: 20px; top: -2rem; }
.step .when { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--ink-3); }
.step h3 { font-size: var(--t-lg); font-weight: 720; font-variation-settings: "wdth" 108; }
.step p { font-size: var(--t-sm); color: var(--ink-2); }
.promo { display: inline-block; vertical-align: middle; margin-left: 0.3rem; padding: 0.05rem 0.5rem; border-radius: 999px; background: var(--pad-soft); color: var(--pad); font-size: var(--t-xs); font-weight: 700; }
.people { margin-top: 2.25rem; padding: 1rem 1.25rem; border-left: 3px solid var(--pad); background: var(--pad-soft); border-radius: 0 8px 8px 0; max-width: 46rem; font-size: var(--t-sm); }
@media (max-width: 900px) {
  .karios-head { grid-template-columns: 1fr; }
  .karios-badge { justify-self: start; }
  .track { grid-template-columns: 1fr; padding: 0 0 0 2rem; gap: 1.6rem; }
  .track::before { top: 0.4rem; bottom: 0.4rem; left: 0.45rem; right: auto; width: 3px; height: auto; background: linear-gradient(180deg, var(--mask) 0 75%, var(--pad) 75%); }
  .step::before { top: 0.15rem; left: -2rem; }
  .step.up::before { top: 0; left: -2.1rem; }
}

/* Selected work */
.work-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; }
.work-card { display: grid; gap: 0.9rem; align-content: start; padding: 1.6rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); min-width: 0; }
.work-card .when { font-family: var(--f-mono); font-size: var(--t-xs); color: var(--ink-3); }
.work-card h3 { font-size: var(--t-xl); font-weight: 760; font-variation-settings: "wdth" 110; letter-spacing: -0.015em; margin-top: -0.4rem; }
.work-card > p { color: var(--ink-2); font-size: var(--t-sm); }
.mypart { font-size: var(--t-sm) !important; color: var(--ink) !important; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; list-style: none; }
.tags li { font-family: var(--f-mono); font-size: var(--t-xs); padding: 0.15rem 0.5rem; background: var(--mask-soft); border-radius: 5px; }
.viz { padding: 1rem 1.1rem; border-radius: 10px; background: var(--band); }
.vrows { position: relative; display: grid; gap: 0.6rem; }
.vrow { display: grid; grid-template-columns: 3.6rem minmax(0, 1fr); align-items: center; gap: 0.6rem; }
.vlabel { font-size: var(--t-xs); color: var(--ink-2); font-weight: 600; }
.vtrack { position: relative; height: 22px; margin-right: 6.5rem; }
.vbar { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 4px; background: var(--ink-3); opacity: 0.55; }
.vbar.range { opacity: 0.3; border-radius: 0 4px 4px 0; }
.vbar.good { background: var(--mask); opacity: 1; }
.vbar.good.range { opacity: 1; }
.vval { position: absolute; z-index: 1; top: 50%; transform: translateY(-50%); background: var(--band); padding: 0 4px; font-family: var(--f-mono); font-size: var(--t-xs); font-weight: 600; white-space: nowrap; color: var(--ink-2); }
.vval.good { color: var(--mask); }
.vref { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 1.5px dashed var(--ink-3); }
.vscale { white-space: nowrap; display: flex; justify-content: space-between; margin: 0.45rem 6.5rem 0 4.2rem; font-family: var(--f-mono); font-size: 0.7rem; color: var(--ink-3); }
.flow-steps { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.fstep { padding: 0.35rem 0.75rem; border-radius: 999px; border: 1.5px solid var(--ink-3); font-size: var(--t-xs); font-weight: 650; background: var(--surface); }
.fstep.good { border-color: var(--mask); color: var(--mask); }
.farrow svg { width: 16px; height: 16px; color: var(--ink-3); display: block; }
.flow-fail { margin-top: 0.6rem; font-size: var(--t-xs); color: var(--ink-2); padding-left: 0.75rem; border-left: 2px solid var(--pad); }
.checks { list-style: none; display: grid; gap: 0.45rem; }
.checks li { display: flex; align-items: center; gap: 0.6rem; font-size: var(--t-sm); }
.checks .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--mask); }
.checks .off { color: var(--ink-3); }
.checks .off .dot { background: transparent; border: 2px solid var(--ink-3); }
.more-work { margin-top: 1.75rem; max-width: 52rem; color: var(--ink-2); font-size: var(--t-sm); }
.more-work strong { color: var(--ink); }
@media (max-width: 860px) { .work-grid { grid-template-columns: 1fr; } .work-card { padding: 1.25rem; } }

/* Projects */
.library { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; margin-bottom: 1.75rem; border-radius: 12px; border: 1px dashed var(--mask); background: var(--mask-soft); color: var(--ink); text-decoration: none; max-width: 40rem; }
.library > svg { width: 24px; height: 24px; flex: none; color: var(--mask); }
.library > svg:last-child { width: 18px; height: 18px; margin-left: auto; }
.library span { display: grid; font-size: var(--t-sm); color: var(--ink-2); }
.library strong { color: var(--ink); font-size: var(--t-md); }
.library:hover { border-style: solid; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1.25rem; }
.pgrid.featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 720px) { .pgrid.featured { grid-template-columns: 1fr; } }
.pitem { display: grid; }
.pcard { position: relative; display: grid; grid-template-rows: auto 1fr; border-radius: 14px; overflow: hidden; background: var(--surface); border: 1px solid var(--rule); min-width: 0; }
.pcard:hover { border-color: var(--ink-3); }
.pthumb { aspect-ratio: 16 / 9; background: var(--term); overflow: hidden; display: grid; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; }
.pthumb .ascii { margin: 0; padding: 1rem; place-self: center; font-size: clamp(0.55rem, 1.3vw, 0.78rem); line-height: 1.3; overflow: hidden; }
.pthumb .media-tile { border: 0; border-radius: 0; }
.pbody { display: grid; gap: 0.5rem; padding: 1.25rem; align-content: start; }
.context { font-size: var(--t-xs); color: var(--ink-3); }
.pcard h3 { font-size: var(--t-lg); font-weight: 720; font-variation-settings: "wdth" 106; }
.pcard h3 a { color: var(--ink); text-decoration: none; }
.pcard h3 a::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.pcard .media-tile { position: relative; z-index: 2; }
.pcard p { font-size: var(--t-sm); color: var(--ink-2); }
.pfoot { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin-top: 0.35rem; }
.pdate { font-size: var(--t-xs); color: var(--ink-3); }
.status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: var(--t-xs); font-weight: 650; color: var(--ink-2); }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mask); }
.status[data-s="active"]::before { background: var(--pad); }
.status[data-s="proto"]::before { background: transparent; border: 1.5px solid var(--ink-3); }
.all-link { margin-top: 1.75rem; }

.ascii { font-family: var(--f-mono); color: var(--term-ink); background: var(--term); white-space: pre; overflow-x: auto; border-radius: 10px; padding: 1.25rem; font-size: 0.8rem; line-height: 1.35; }
.media-tile { display: grid; place-content: center; justify-items: center; gap: 0.6rem; min-height: 12rem; height: 100%; padding: 1.5rem; text-align: center; background: var(--band); color: var(--mask); font-weight: 650; font-size: var(--t-sm); text-decoration: none; border: 1px dashed var(--rule); border-radius: 10px; }
.media-tile svg { width: 28px; height: 28px; }
.media-tile:hover { background: var(--mask-soft); }

/* Toolkit */
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.tool { padding: 1.4rem; border-radius: 14px; background: var(--surface); border: 1px solid var(--rule); display: grid; gap: 0.85rem; align-content: start; }
.tool h3 { font-size: var(--t-md); font-weight: 720; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips li { padding: 0.25rem 0.65rem; border-radius: 999px; border: 1px solid var(--rule); font-size: var(--t-sm); color: var(--ink-2); background: var(--paper); }
@media (max-width: 900px) { .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tool-grid { grid-template-columns: 1fr; } }

/* Contact */
.contact-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.contact-card { display: grid; gap: 1.1rem; padding: 2.25rem; border-radius: 16px; background: var(--mask); color: var(--mask-ink); }
.contact-card h2 { font-family: var(--f-display); font-size: clamp(2rem, 4vw, 2.75rem); font-weight: 750; letter-spacing: -0.02em; }
.contact-card p { opacity: 0.92; }
.contact-card .btn { background: var(--paper); color: var(--ink); border-color: transparent; }
.contact-card .btn.primary { background: var(--ink); color: var(--paper); }
.contact-card .copy-row { background: var(--paper); color: var(--ink); border-color: transparent; }
.creds { display: grid; gap: 1.75rem; }
.creds h3 { font-size: var(--t-sm); font-weight: 750; color: var(--ink-3); margin-bottom: 0.6rem; }
.cred { display: grid; gap: 0.1rem; padding-block: 0.5rem; border-bottom: 1px solid var(--rule); }
.cred strong { font-weight: 680; }
.cred strong a { color: var(--ink); }
.cred span { font-size: var(--t-sm); color: var(--ink-2); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } .contact-card { padding: 1.5rem; } }

/* Project pages */
.page-head { display: grid; gap: 0.9rem; max-width: 52rem; margin-bottom: 2.25rem; }
.page-head h1 { font-family: var(--f-display); font-size: clamp(2.3rem, 5vw, 3.6rem); font-weight: 750; letter-spacing: -0.025em; }
.page-head .lede { font-size: var(--t-lg); color: var(--ink-2); max-width: var(--measure); line-height: 1.5; }
.crumb { font-size: var(--t-sm); color: var(--ink-2); }
.crumb a { color: inherit; }
.gallery { display: grid; gap: 1rem; margin-bottom: 3rem; grid-template-columns: minmax(0, 1fr); }
.gallery.many { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery.many figure.lead { grid-column: 1 / -1; }
.gallery.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .gallery.two { grid-template-columns: 1fr; } }
.gallery figure { margin: 0; display: grid; gap: 0.5rem; min-width: 0; align-content: start; }
.gallery img, .gallery video { width: 100%; border-radius: 10px; border: 1px solid var(--rule); background: var(--band); }
.gallery.many figure:not(.lead) img { aspect-ratio: 4 / 3; object-fit: cover; }
.gallery figure.lead img { max-height: 640px; object-fit: contain; }
.gallery .ascii { margin: 0; }
figcaption { font-size: var(--t-sm); color: var(--ink-3); }
.embed { position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: hidden; border: 1px solid var(--rule); background: var(--term); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 760px) { .gallery.many { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 460px) { .gallery.many { grid-template-columns: 1fr; } }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) 18rem; gap: 3.5rem; align-items: start; }
.detail-body { display: grid; gap: 2.25rem; min-width: 0; }
.detail-body section { display: grid; gap: 0.75rem; max-width: var(--measure); }
.detail-body h2 { font-size: var(--t-xl); font-weight: 740; font-variation-settings: "wdth" 110; }
.points { display: grid; gap: 0.55rem; padding-left: 1.2rem; }
.points li::marker { color: var(--pad); }
.part { padding: 1rem 1.25rem; border-left: 3px solid var(--pad); background: var(--pad-soft); border-radius: 0 8px 8px 0; max-width: var(--measure); }
.components { display: grid; margin: 0; border-top: 1px solid var(--rule); }
.components div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1rem; padding-block: 0.6rem; border-bottom: 1px solid var(--rule); }
.components dt { font-weight: 680; }
.components dd { margin: 0; color: var(--ink-2); }
@media (max-width: 520px) { .components div { grid-template-columns: 1fr; gap: 0.1rem; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: 10px; }
table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); min-width: 30rem; }
th, td { text-align: left; padding: 0.6rem 0.85rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { background: var(--band); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
.codefig { margin: 0; display: grid; gap: 0.5rem; }
.code { margin: 0; padding: 1.1rem 1.25rem; border-radius: 10px; background: var(--term); color: var(--term-ink); font-family: var(--f-mono); font-size: 0.82rem; line-height: 1.55; overflow-x: auto; }
.code code { background: none; padding: 0; font-size: inherit; }
.aside { position: sticky; top: 5.5rem; display: grid; gap: 1.25rem; padding: 1.4rem; border: 1px solid var(--rule); border-radius: 14px; background: var(--surface); font-size: var(--t-sm); }
.aside dl { display: grid; gap: 0.8rem; margin: 0; }
.aside dt { color: var(--ink-3); font-size: var(--t-xs); }
.aside dd { margin: 0.1rem 0 0; }
.aside h2 { font-size: var(--t-sm); font-weight: 720; margin-bottom: 0.5rem; }
.links { list-style: none; display: grid; gap: 0.55rem; }
.links a { display: inline-flex; gap: 0.5rem; align-items: flex-start; }
.links svg { width: 16px; height: 16px; flex: none; margin-top: 0.2rem; }
@media (max-width: 900px) { .detail { grid-template-columns: 1fr; gap: 2rem; } .aside { position: static; } }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.pager a { display: grid; gap: 0.2rem; text-decoration: none; color: var(--ink); }
.pager span { font-size: var(--t-xs); color: var(--ink-3); }
.pager a:hover strong { color: var(--mask); text-decoration: underline; }
.pager .next { text-align: right; }

/* Directory filters */
.filters { display: grid; gap: 0.9rem; margin-bottom: 1.75rem; }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pill { appearance: none; font: inherit; font-size: var(--t-sm); padding: 0.3rem 0.8rem; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.pill:hover { color: var(--ink); border-color: var(--ink-3); }
.pill[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.search { position: relative; max-width: 28rem; }
.search input { width: 100%; font: inherit; padding: 0.65rem 0.9rem 0.65rem 2.4rem; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); color: var(--ink); }
.search svg { position: absolute; left: 0.8rem; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--ink-3); }
.count { font-size: var(--t-sm); color: var(--ink-3); }
.empty { padding: 2rem; border: 1px dashed var(--rule); border-radius: 10px; color: var(--ink-2); margin-top: 1rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding-block: 2rem calc(2rem + env(safe-area-inset-bottom, 0px)); font-size: var(--t-sm); color: var(--ink-2); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; align-items: center; }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; }
.foot-links a { color: var(--ink-2); }
.to-top { display: inline-flex; gap: 0.35rem; align-items: center; }
.to-top svg { width: 15px; height: 15px; }

.toast { position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 0.55rem 1rem; border-radius: 8px; font-size: var(--t-sm); z-index: 60; }
