/* Tokens ------------------------------------------------------------------
   One soft pink sky: Blossom page, Petal panels, Plum ink, Rose headings,
   Rosebud stars and bars. Lucky gold belongs to the lucky star alone
   (drawn in sky.js from --lucky). */
:root {
  color-scheme: light;
  --page: #fff6f9;
  --panel: #fdeaf2;
  --panel-soft: rgba(253, 234, 242, 0.82);
  --rule: #f4d3e1;
  --ink: #4a2338;
  --ink-2: #6e3f57;
  --muted: #82576d;
  --heading: #a8386c;
  --link: #a8386c;
  --focus: #a8386c;
  --rosebud: #d4608f;
  --line: #f0b9cf;
  --btn: #fbd6e5;
  --btn-ink: #6b1e45;

  /* Read by sky.js */
  --dust-1: #e48fb6;
  --dust-2: #c9a0e0;
  --dust-3: #f0b48a;
  --lucky: #f2b632;
  --lucky-glow: rgba(255, 214, 120, 0.55);
  --lucky-edge: #e39b1f;

  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --wrap: 70rem;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #22111b;
    --panel: #2e1825;
    --panel-soft: rgba(46, 24, 37, 0.82);
    --rule: #4a2a3c;
    --ink: #fbe8f0;
    --ink-2: #f0cddd;
    --muted: #cfa3b8;
    --heading: #ffb3d1;
    --link: #ffb3d1;
    --focus: #ffb3d1;
    --rosebud: #f08fb8;
    --line: #6a3c55;
    --btn: #4a2238;
    --btn-ink: #ffe3ee;
    --dust-1: #f3a6c8;
    --dust-2: #c9a4e6;
    --dust-3: #ffd0a8;
    --lucky: #ffd36b;
    --lucky-glow: rgba(255, 211, 107, 0.45);
    --lucky-edge: rgba(0, 0, 0, 0);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #22111b;
  --panel: #2e1825;
  --panel-soft: rgba(46, 24, 37, 0.82);
  --rule: #4a2a3c;
  --ink: #fbe8f0;
  --ink-2: #f0cddd;
  --muted: #cfa3b8;
  --heading: #ffb3d1;
  --link: #ffb3d1;
  --focus: #ffb3d1;
  --rosebud: #f08fb8;
  --line: #6a3c55;
  --btn: #4a2238;
  --btn-ink: #ffe3ee;
  --dust-1: #f3a6c8;
  --dust-2: #c9a4e6;
  --dust-3: #ffd0a8;
  --lucky: #ffd36b;
  --lucky-glow: rgba(255, 211, 107, 0.45);
  --lucky-edge: rgba(0, 0, 0, 0);
}

/* Base ------------------------------------------------------------------- */
/* Every size is in rem, so these steps scale the whole page on big screens
   (1920-wide monitors, 2560 QHD and 4K on a 32-inch display) without changing laptops or phones.
   sky.js and app.js read the same factor for the canvas and the constellation. */
@media (min-width: 1600px) { html { font-size: 112.5%; } }
@media (min-width: 2200px) { html { font-size: 137.5%; } }
@media (min-width: 2400px) { html { font-size: 150%; } }
@media (min-width: 3200px) { html { font-size: 200%; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--page); }
body {
  margin: 0;
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, dl, dd, figure, ul { margin: 0; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.1875rem; }
a:not(:hover) { text-decoration: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 0.1875rem; border-radius: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0.5rem; z-index: 40; padding: 0.5rem 0.75rem; background: var(--page); color: var(--ink); }
.skip:focus { left: 0.5rem; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 2rem; }

/* The flowing sky sits behind every section. */
.sky-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.top, main, .contact { position: relative; z-index: 1; }

h2 {
  color: var(--heading);
  font-size: 2.25rem;
  line-height: 1.1;
  font-weight: 700;
  font-variation-settings: "wdth" 110;
  letter-spacing: -0.015em;
}
.note { color: var(--muted); font-size: 0.9375rem; margin-top: 0.5rem; max-width: 60ch; }
.section { padding-top: 6rem; }

/* Top ------------------------------------------------------------------- */
.top { padding-bottom: 1rem; }
.bar { display: flex; align-items: center; gap: 1.75rem; height: 4.75rem; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; color: var(--ink); font-weight: 700; font-variation-settings: "wdth" 110; font-size: 1.125rem; letter-spacing: -0.01em; }
.brand:hover { text-decoration: none; }
.brand img { width: 2.5rem; height: 2.5rem; }
.copyright img { width: 2rem; height: 2rem; }
.btn svg, .channels svg { width: 1em; height: 1em; }
.theme-toggle svg { width: 1.125rem; height: 1.125rem; }
.brand img, .copyright img { border-radius: 50%; box-shadow: 0 0 0 2px #ffffff, 0 2px 0.625rem rgba(212, 96, 143, 0.25); flex: none; }
.bar nav { display: flex; gap: 1.5rem; margin-left: auto; }
.bar nav a { color: var(--ink-2); font-size: 0.9375rem; }
.bar nav a:hover { color: var(--heading); }
.theme-toggle {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; flex: none;
  color: var(--ink-2); background: transparent; border: 1px solid var(--rule); border-radius: 50%; cursor: pointer;
}
.theme-toggle:hover { color: var(--heading); border-color: var(--line); }

.intro-block { padding-top: 3.5rem; max-width: 51.25rem; }
#name {
  color: var(--heading);
  font-size: clamp(2.75rem, 11.5vw, 7.75rem);
  line-height: 0.92;
  font-weight: 700;
  font-variation-settings: "wdth" 118;
  letter-spacing: -0.03em;
  margin-left: -0.04em;
}
.headline { margin-top: 1.25rem; font-size: 1.5rem; line-height: 1.3; font-weight: 500; color: var(--ink); }
.intro { margin-top: 0.875rem; max-width: 60ch; color: var(--ink-2); font-size: 1.0625rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 1.75rem; }
.btn {
  display: inline-flex; align-items: center; gap: 0.625rem; height: 2.75rem;
  padding: 0 1.125rem; border-radius: 62.4375rem; font-weight: 600; font-size: 0.9375rem;
  color: var(--btn-ink); border: 1px solid var(--line); background: transparent;
}
.btn:hover { text-decoration: none; border-color: var(--rosebud); }
.btn.primary { background: var(--btn); border-color: var(--btn); }
.btn.primary:hover { border-color: var(--rosebud); }
.status { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9375rem; color: var(--ink-2); margin-left: 0.5rem; }
.status::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--rosebud); box-shadow: 0 0 0 0.1875rem var(--btn); }

/* Constellation --------------------------------------------------------- */
.sky { margin-top: 2.25rem; }
.sky-caption { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted); }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.link-line { stroke: var(--line); stroke-width: 1.25; fill: none; }
.star { fill: var(--rosebud); }
.star.on { fill: var(--heading); }
.star-hit { fill: transparent; cursor: pointer; }
.cluster-label { font: 600 0.8125rem var(--sans); fill: var(--ink-2); cursor: pointer; }
.cluster-label:hover, .cluster-label:focus-visible { fill: var(--heading); text-decoration: underline; outline: none; }

@media (prefers-reduced-motion: no-preference) {
  .lighting .star { opacity: 0; transform-box: fill-box; transform-origin: center; animation: twinkle 520ms cubic-bezier(.2, .9, .3, 1.4) forwards; animation-delay: calc(var(--i) * 28ms); }
  .lighting .link-line { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 700ms ease-out forwards; animation-delay: calc(400ms + var(--c) * 90ms); }
}
@keyframes twinkle { from { opacity: 0; transform: scale(0.2) rotate(-72deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Lede ------------------------------------------------------------------ */
.lede-block { padding-top: 3.5rem; }
.lede {
  max-width: 34ch; font-size: 1.875rem; line-height: 1.3; font-weight: 400;
  font-variation-settings: "wdth" 104; color: var(--ink); letter-spacing: -0.01em;
}

/* What I build ---------------------------------------------------------- */
.build { display: grid; grid-template-columns: 18.75rem 1fr; gap: 3rem; padding-top: 6rem; align-items: start; }
.areas { display: grid; gap: 0.25rem; }
.area-row {
  all: unset; box-sizing: border-box; cursor: pointer;
  display: grid; grid-template-columns: minmax(9.375rem, 13.75rem) 1fr 6.875rem; align-items: center; gap: 1rem;
  padding: 0.625rem 0.75rem; margin: 0 -12px; border-radius: 0.625rem;
}
.area-row:hover { background: var(--panel-soft); }
.area-row[aria-pressed="true"] { background: var(--panel-soft); box-shadow: inset 0.1875rem 0 0 var(--rosebud); }
.area-row:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.area-row .label { font-weight: 600; color: var(--ink); }
.area-row .bar-fill { display: block; height: 0.75rem; border-radius: 0 0.375rem 0.375rem 0; background: var(--rosebud); }
.area-row .nums { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.area-row .nums b { color: var(--ink); font-weight: 700; font-size: 1rem; margin-right: 0.375rem; }

/* Filters --------------------------------------------------------------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: end; gap: 0.75rem 1rem;
  margin-top: 4.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--rule);
}
.field { display: grid; gap: 0.375rem; font-size: 0.8125rem; color: var(--muted); }
.field.grow { flex: 1 1 15rem; }
.field select, .field input {
  font: inherit; font-size: 0.9375rem; color: var(--ink);
  background: var(--page); border: 1px solid var(--rule); border-radius: 0.625rem;
  height: 2.5rem; padding: 0 0.75rem; min-width: 12.5rem;
}
.field input { width: 100%; }
.count { margin-left: auto; font-size: 0.875rem; color: var(--muted); padding-bottom: 0.625rem; font-variant-numeric: tabular-nums; }

/* Projects -------------------------------------------------------------- */
.block-title { margin: 3rem 0 1.25rem; font-size: 0.9375rem; font-weight: 600; color: var(--muted); }
.featured { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.feature { display: flex; flex-direction: column; gap: 0.75rem; padding: 1.75rem 1.75rem 1.875rem; border-radius: 1rem; background: var(--panel-soft); }
.feature h4, .entry h4 { margin: 0; color: var(--heading); }
.feature h4 { font-size: 1.5rem; line-height: 1.2; font-weight: 680; font-variation-settings: "wdth" 106; letter-spacing: -0.01em; }
.area-name { font-size: 0.875rem; color: var(--muted); }
.feature .summary { color: var(--ink-2); max-width: 46ch; font-size: 1.125rem; line-height: 1.5; }

.group { padding-top: 0.5rem; }
.group + .group { margin-top: 2.5rem; }
.group-head { display: flex; align-items: baseline; gap: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--rule); }
.group-head h4 { margin: 0; font-size: 1.125rem; font-weight: 680; color: var(--heading); font-variation-settings: "wdth" 106; }
.group-head span { font-size: 0.875rem; color: var(--muted); }
.entries { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem 2.5rem; padding-top: 1.5rem; }
.entry { display: flex; flex-direction: column; gap: 0.5rem; }
.entry h4 { font-size: 1.125rem; line-height: 1.25; font-weight: 650; }
.entry .summary { font-size: 0.9375rem; color: var(--ink-2); }
.feature:target, .entry:target, .flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0%, 30% { box-shadow: 0 0 0 0.1875rem var(--rosebud); border-radius: 0.75rem; } 100% { box-shadow: 0 0 0 0.1875rem transparent; } }
.empty { padding: 3rem 0; color: var(--muted); }

/* Toolbox --------------------------------------------------------------- */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.625rem, 1fr)); gap: 2rem 2.25rem; margin-top: 2rem; }
.skills div { border-top: 2px solid var(--line); padding-top: 0.875rem; }
.skills dt { font-size: 0.9375rem; font-weight: 650; color: var(--heading); margin-bottom: 0.375rem; }
.skills dd { color: var(--ink); font-size: 1rem; line-height: 1.6; }

/* Poem ------------------------------------------------------------------ */
/* The opening verse: centred as a block so its initials still line up and spell the name. */
.poem-top { padding-top: 2.75rem; }
.poem { display: grid; gap: 1.375rem; width: fit-content; max-width: 100%; margin: 0 auto; }
.stanza {
  display: grid; gap: 2px;
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(1rem, calc(2.4vw + 0.375rem), 2.125rem); line-height: 1.45; color: var(--ink-2);
  font-variation-settings: "opsz" 36, "SOFT" 100;
}
.stanza .line { display: block; padding-left: 1em; text-indent: -1em; }
.stanza .initial { font-style: normal; font-weight: 700; font-size: 1.14em; color: var(--heading); font-variation-settings: "opsz" 48, "SOFT" 100; }

/* The poem flows: each line sways a beat behind the one above, so a slow wave rolls down
   the verse, and a gold glint passes down the initials, L to R, like the star going by. */
@media (prefers-reduced-motion: no-preference) {
  .stanza .line { --sway: 0.4375rem; will-change: transform; animation: sway 9s ease-in-out infinite; animation-delay: calc(var(--n) * -0.55s); }
  .stanza .initial { animation: glint 9s ease-in-out infinite; animation-delay: calc(var(--n) * 0.32s); }
}
@keyframes sway {
  0%, 100% { transform: translate(calc(var(--sway) * -1), 1px); }
  50% { transform: translate(var(--sway), -1px); }
}
@keyframes glint {
  0%, 12%, 100% { text-shadow: none; }
  5% { text-shadow: 0 0 0.375rem var(--lucky-glow), 0 0 1.125rem var(--lucky-glow); }
}

/* Contact --------------------------------------------------------------- */
.contact { padding: 7.5rem 0 2.5rem; }
.contact-panel { padding: 3.5rem 3.5rem 3.75rem; border-radius: 1.75rem; background: var(--panel-soft); }
.contact h2 { font-size: clamp(2.5rem, 7vw, 4.5rem); font-variation-settings: "wdth" 116; font-weight: 700; letter-spacing: -0.03em; }
.pitch { margin-top: 0.875rem; max-width: 52ch; font-size: 1.1875rem; color: var(--ink-2); }
.channels { list-style: none; padding: 0; margin-top: 2.5rem; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem; max-width: 56.25rem; }
.channels li { display: grid; gap: 0.375rem; border-top: 1px solid var(--line); padding-top: 1.125rem; }
.channels .label { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: var(--muted); }
.channels a { color: var(--heading); font-size: 1.625rem; line-height: 1.2; font-weight: 650; font-variation-settings: "wdth" 104; overflow-wrap: anywhere; }
.channels a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.copyright { display: flex; align-items: center; gap: 0.625rem; margin-top: 2.5rem; font-size: 0.8125rem; color: var(--muted); }

/* Tooltip --------------------------------------------------------------- */
.tooltip {
  position: fixed; z-index: 30; pointer-events: none; min-width: 7.5rem; max-width: 17.5rem;
  padding: 0.5rem 0.75rem; border-radius: 0.625rem; font-size: 0.8125rem;
  background: var(--page); color: var(--ink);
  box-shadow: 0 0 0 1px var(--rule), 0 0.5rem 1.5rem rgba(168, 56, 108, 0.18);
}
.tooltip .tv { font-size: 0.9375rem; font-weight: 700; line-height: 1.3; }
.tooltip .tl { color: var(--muted); margin-top: 2px; }

/* Responsive ------------------------------------------------------------ */
@media (max-width: 980px) {
  .build { grid-template-columns: 1fr; gap: 2rem; }
  .entries { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .wrap { padding-inline: 1.25rem; }
  .bar nav { display: none; }
  .theme-toggle { margin-left: auto; }
  .intro-block { padding-top: 2rem; }
  .headline { font-size: 1.25rem; }
  .lede { font-size: 1.5rem; }
  .lede-block { padding-top: 2.5rem; }
  .build, .section { padding-top: 4.5rem; }
  h2 { font-size: 1.875rem; }
  .featured, .entries { grid-template-columns: 1fr; }
  .feature { padding: 1.375rem; }
  .area-row { grid-template-columns: 1fr auto; row-gap: 0.5rem; }
  .area-row .bar-cell { grid-column: 1 / -1; grid-row: 2; }
  .count { margin-left: 0; }
  .contact { padding-top: 5.5rem; }
  .contact-panel { padding: 2rem 1.375rem 2.25rem; border-radius: 1.375rem; }
  .channels { grid-template-columns: 1fr; gap: 1.25rem; }
  .channels a { font-size: 1.3125rem; }
  .stanza .line { --sway: 0.1875rem; }
  .poem-top { padding-top: 1.5rem; }
  .stanza { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .flash, .feature:target, .entry:target { animation: none; } }
@media (forced-colors: active) { .sky-bg { display: none; } .area-row .bar-fill, .star { forced-color-adjust: none; } }
