/* ==========================================================================
   justfoura.dev v2 — dark default, light on request
   The default block is the dark palette; `:root[data-theme="light"]` below
   overrides it. `data-theme` is always set by the inline script in <head>, so
   no media query is needed and the two themes can never disagree.
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #0e0b1c;
  --surface: #1d1744;
  --ink: #f1eefc;
  --body: #c6c0dd;
  --muted: #978fbd;
  --rule: #2e2454;
  --rule-faint: #191237;
  --accent: #b9a8ff;
  --live: #ff5c47;
  --ok: #e8a04e;
  --no: #f2555a;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #e2e4e5;
  --surface: #d5d8da;
  --ink: #101315;
  --body: #363c41;
  --muted: #575e64;
  --rule: #b6bbbf;
  --rule-faint: #ccd0d3;
  --accent: #1b39d4;
  --live: #c4372f;
  --ok: #8a5316;
  --no: #bb332c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--body);
  overflow-x: clip;
  font-family: "Archivo", ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Shell ---------- */

.shell {
  max-width: 62rem;
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}

/* Post pages carry one column of prose, not a label gutter — a narrower shell
   keeps the measure from floating in dead space on wide screens. */
.shell--post {
  max-width: 46rem;
}

/* ---------- Nav ---------- */

.nav {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.25rem;
  font-size: 0.8125rem;
  line-height: 1.8;
  letter-spacing: 0.02em;
  margin-bottom: 3rem;
}

.nav a {
  color: var(--muted);
}

.nav a:hover {
  color: var(--ink);
}

.nav a[aria-current="page"] {
  color: var(--ink);
}

/* ---------- Theme toggle ---------- */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  font: inherit;
  font-size: 0.75rem;
  line-height: 1;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 50%;
  cursor: pointer;
  transition:
    color 0.15s ease,
    border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: var(--muted);
}

.theme-toggle svg {
  width: 0.85rem;
  height: 0.85rem;
  flex: none;
}

/* Show the icon for the mode this control switches TO. */
.theme-opt {
  display: none;
  align-items: center;
  gap: 0.4rem;
}

:root .theme-opt[data-mode="dark"] {
  display: inline-flex;
}

:root[data-theme="light"] .theme-opt[data-mode="dark"] {
  display: none;
}

:root[data-theme="light"] .theme-opt[data-mode="light"] {
  display: inline-flex;
}

/* ---------- Hero ---------- */

.hero {
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 3.5rem;
}

.hero .tag {
  margin: 0 0 1.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(3rem, 12vw, 7.5rem);
  font-weight: 700;
  font-variation-settings: "wdth" 92;
  letter-spacing: -0.045em;
  line-height: 0.9;
  color: var(--ink);
}

.hero .aliases {
  margin: 1rem 0 0;
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--muted);
}

/* ---------- Live banner (reserved slot — SPEC.md §7) ---------- */

#live-banner {
  display: none;
}

body[data-live="true"] #live-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 2.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

#live-banner:hover {
  text-decoration: none;
  border-color: var(--accent);
}

#live-banner .dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--live);
  animation: live-pulse 1.6s ease-in-out infinite;
}

@keyframes live-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ---------- Learn banner (cross-link to #learn) ----------
   Full-width bar below the nav and, on the home page, the Portfolio V2 tag.
   The page reveals it after 2.5 seconds. */

#learn-banner {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100vw;
  max-height: 0;
  min-height: 0;
  margin: 0 calc(50% - 50vw);
  padding: 0 max(1rem, calc((100vw - 62rem) / 2 + 2rem));
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-0.35rem);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--ink);
  background: var(--surface);
  border-block: 0 solid var(--rule);
  text-decoration: none;
  transition:
    max-height 0.3s ease,
    min-height 0.3s ease,
    margin-bottom 0.3s ease,
    padding 0.3s ease,
    border-width 0.3s ease,
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0s linear 0.3s;
}

#learn-banner.is-visible {
  max-height: 6rem;
  min-height: 5.5rem;
  margin-bottom: 1.5rem;
  padding-block: 1.5rem;
  border-block-width: 1px;
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition:
    max-height 0.3s ease,
    min-height 0.3s ease,
    margin-bottom 0.3s ease,
    padding 0.3s ease,
    border-width 0.3s ease,
    opacity 0.25s ease,
    transform 0.25s ease,
    visibility 0s;
}

#learn-banner .arrow {
  margin-left: auto;
  color: var(--muted);
  font-size: 1.2rem;
}

#learn-banner .dot {
  width: 0.55rem;
  height: 0.55rem;
  flex: none;
  border-radius: 50%;
  background: var(--ok);
}

#learn-banner .soon {
  flex: none;
  padding: 0.15rem 0.6rem;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 999px;
}

/* ---------- Section scaffolding: label gutter + body ---------- */

.section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: 1.25rem;
  padding: 3rem 0;
  border-top: 1px solid var(--rule-faint);
}

/* The hero already draws a rule; the first section must not add a second. */
.section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.section > .label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
}

.section > .body {
  min-width: 0;
  max-width: 36rem;
}

@media (min-width: 62rem) {
  .section {
    grid-template-columns: 6.5rem minmax(0, 1fr);
    column-gap: 5.5rem;
    row-gap: 0;
    position: relative;
  }

  /* Hairline down the gutter, separating the section label from its content.
     The gutter is 6.5rem but the longest label ("QUESTIONS") only measures
     about 5.3rem, so the midpoint of the column gap would look shoved right.
     This sits at the midpoint between the end of the label text and the start
     of the content, which is what "in the middle" actually means visually.
     Recheck it if a section label is ever much longer than those two. */
  .section::before {
    content: "";
    position: absolute;
    left: 8.65rem;
    top: 0;
    bottom: 0;
    width: 1px;
    background: var(--rule-faint);
  }

  .section > .label {
    grid-column: 1;
    padding-top: 0.55rem;
  }

  .section > .body {
    grid-column: 2;
  }
}

/* ---------- Project entries ---------- */

.entry + .entry {
  margin-top: 2.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule-faint);
}

/* Title and status sit together on the left. This was `space-between`, which
   flung the status to the far edge of the 36rem column, roughly 30rem from the
   name it describes. */
.entry-head {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  flex-wrap: wrap;
}

.entry h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
}

.entry h3 a {
  color: var(--ink);
}

.entry h3 a:hover {
  color: var(--accent);
}

.entry > p {
  margin: 0.6rem 0 0;
}

/* ---------- Status: a dot and a word, never a tooltip ----------
   Two colours only, as of 2026-10-02. Beige means available, red means not.
   The earlier hollow-ring and grey-dot variants are gone: three dot styles for
   two meanings made the reader decode the shape as well as the colour. */

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  color: var(--no);
  white-space: nowrap;
}

.status::before {
  content: "";
  width: 0.4rem;
  height: 0.4rem;
  flex: none;
  border-radius: 50%;
  background: var(--no);
}

.status[data-state="available"] {
  color: var(--ok);
}

.status[data-state="available"]::before {
  background: var(--ok);
}

.status[data-state="available"] a {
  color: var(--ok);
}

.status[data-state="available"] a:hover {
  text-decoration: underline;
  text-decoration-color: var(--ok);
}

/* ---------- Scope: plain muted text, not a boxed tag ---------- */

.scope {
  display: block;
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* ---------- Why / Learned: inline prose, not a definition grid ---------- */

.notes {
  margin: 1rem 0 0;
}

.note {
  margin: 0 0 0.4rem;
  font-size: 0.9375rem;
  color: var(--muted);
}

.note strong {
  color: var(--body);
  font-weight: 600;
}

/* ---------- Facts ---------- */

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin: 0 0 2.75rem;
  padding-bottom: 2.75rem;
  border-bottom: 1px solid var(--rule-faint);
}

.facts div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.facts dt {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.facts dd {
  margin: 0;
  color: var(--ink);
}

/* ---------- Q&A ---------- */

.qa + .qa {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule-faint);
}

.qa h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
}

.qa p {
  margin: 0;
}

/* ---------- Blog index ----------
   The `.post-list` / `.post-meta` / `.post-status` / `.title` / `.date` rules
   and the `.back` / `.page-head` / `.prose` rules further down are UNUSED while
   the blog is empty. They are kept deliberately: they are the template for the
   first post, so writing one is a copy of `blog/index.html` rather than a
   re-derivation of the CSS. Do not "clean them up" — see SPEC.md section 5. */

/* Empty state, shown until the first post exists. */
.empty {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--muted);
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-list li + li {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule-faint);
}

.post-list .title {
  display: inline-block;
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--ink);
}

.post-list .title:hover {
  color: var(--accent);
}

/* Date + reading time, spaced rather than dot-separated. */
.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Project status, with the reason spelled out beside it. */
.post-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.6rem 0 0;
  font-size: 0.8125rem;
}

/* ---------- Page header (post pages) ---------- */

.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.back:hover {
  color: var(--ink);
}

.page-head {
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(2rem, 7vw, 3rem);
  font-weight: 700;
  font-variation-settings: "wdth" 92;
  letter-spacing: -0.035em;
  line-height: 1;
  color: var(--ink);
}

.page-head .sub {
  margin: 0.75rem 0 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Prose ---------- */

.prose {
  max-width: 36rem;
  font-size: 1.0625rem;
  line-height: 1.7;
}

.prose > *:first-child {
  margin-top: 0;
}

.prose p {
  margin: 0 0 1.35rem;
}

.prose h2 {
  margin: 2.75rem 0 0.9rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.prose h3 {
  margin: 2rem 0 0.6rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
}

.prose ul,
.prose ol {
  margin: 0 0 1.35rem;
  padding-left: 1.15rem;
}

.prose li {
  margin-bottom: 0.45rem;
}

.prose li::marker {
  color: var(--rule);
}

.prose blockquote {
  margin: 1.75rem 0;
  padding: 0 0 0 1.15rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}

.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  color: var(--ink);
  background: var(--surface);
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
}

.prose pre {
  margin: 1.75rem 0;
  padding: 1rem;
  overflow-x: auto;
  background: var(--surface);
  border-radius: 4px;
}

.prose pre code {
  padding: 0;
  background: none;
  font-size: 0.825rem;
  line-height: 1.6;
}

.prose strong {
  color: var(--ink);
  font-weight: 600;
}

.prose hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--rule-faint);
}

.prose a {
  text-decoration: underline;
  text-decoration-color: var(--rule);
}

.prose a:hover {
  text-decoration-color: var(--accent);
}

/* ---------- Footer ---------- */

.footer {
  margin-top: 3rem;
  padding-top: 1.75rem;
  border-top: 2px solid var(--ink);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  font-size: 0.8125rem;
}

.footer-links a {
  color: var(--muted);
}

.footer-links a:hover {
  color: var(--ink);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  a {
    transition: none;
  }

  #learn-banner {
    transition: none;
    transform: none;
  }

  #live-banner .dot {
    animation: none;
  }
}
