/* Paradolia: one stylesheet for every page.
   Colours come from the tokens below and nowhere else, so the whole site can be retuned here.
   The look follows Glyph's "carved stone with lit mana" (docs/STYLE.md): dark flat stone,
   plates with 45 degree cut corners, and colour only where something is live. */

@font-face { font-family: "Cinzel"; src: url("/fonts/cinzel.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("/fonts/outfit.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("/fonts/cormorant-italic.woff2") format("woff2"); font-weight: 500; font-style: italic; font-display: swap; }

:root {
  color-scheme: dark;
  /* Surfaces, from the page up */
  --bg: #0f1113; --panel: #15181b; --raised: #1d2125; --lift: #262b30;
  /* Lines */
  --line: #2a3035; --edge: #434c54;
  /* Text */
  --text: #eeede7; --muted: #a0a8ab; --faint: #6c757a; --dark: #0f1113;
  /* Lit things */
  --accent: #5fd3a6; --accent-dark: #2f9c79; --gold: #e8c15a;
  --brass: #c9a35c; --mana: #45f0d2;

  --cut: 12px;
  --font-title: "Cinzel", "Trajan Pro", Georgia, serif;
  --font-ui: "Outfit", "Segoe UI", system-ui, sans-serif;
  --font-lore: "Cormorant", Georgia, serif;
  --page: 1120px;
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--text); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--font-title); font-weight: 600; line-height: 1.15; margin: 0; }
h1 { font-size: 40px; }
h2 { font-size: 28px; }
h3 { font-size: 22px; }
p { margin: 0; }
.muted { color: var(--muted); }
.lore { font: italic 500 20px/1.4 var(--font-lore); color: var(--muted); }

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Plates: interface pieces with cut corners (rim drawn by the ::before layer) ---------- */
.plate {
  position: relative;
  isolation: isolate;
  clip-path: polygon(var(--cut) 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, var(--cut) 100%, 0 calc(100% - var(--cut)), 0 var(--cut));
  background: var(--rim, var(--line));
}
.plate::before {
  content: "";
  position: absolute; inset: 1px; z-index: -1;
  clip-path: inherit;
  background: var(--fill, var(--panel));
}

/* ---------- Buttons ---------- */
.btn {
  --cut: 8px; --fill: var(--raised); --rim: var(--edge);
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px;
  font: 600 16px/1 var(--font-ui);
  color: var(--text); text-decoration: none;
  transition: transform .12s ease;
}
.btn:hover { --fill: var(--lift); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { --fill: var(--accent); --rim: var(--accent); color: var(--dark); padding: 14px 28px; font-size: 18px; }
.btn-primary:hover { --fill: #7fe3bd; --rim: #7fe3bd; color: var(--dark); }
.btn-quiet { --fill: var(--bg); --rim: var(--bg); color: var(--muted); }
.btn-quiet:hover { --fill: var(--raised); --rim: var(--edge); color: var(--text); }
.btn svg { width: 16px; height: 16px; }

/* ---------- Top bar ---------- */
.top { padding: 20px 0; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand svg { width: 36px; height: 36px; }
.brand span { font: 600 22px/1 var(--font-title); }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; font-weight: 600; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); }

/* ---------- Intro ---------- */
.intro { padding-top: 48px; padding-bottom: 40px; }
.intro h1 { font-size: clamp(40px, 7vw, 64px); }
.intro .lore { margin-top: 12px; max-width: 34em; }

/* ---------- Sections ---------- */
section { padding: 32px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }

/* ---------- Projects grid: one <article class="project"> per project ---------- */
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.project { --cut: 16px; --fill: var(--panel); --rim: var(--line); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.project h3 a { color: inherit; text-decoration: none; }
.project h3 a:hover { color: var(--accent); }
.project .status { font-weight: 600; font-size: 14px; color: var(--muted); }
.project .status.live { color: var(--accent); }
.project .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 8px; }
.project .tags { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--faint); font-size: 14px; }

/* The featured project spans the whole row and carries its portal circle. */
.project.featured {
  grid-column: 1 / -1;
  --rim: #3a3324;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 420px); align-items: center; gap: 32px;
  padding: 40px;
}
.project.featured .body { display: flex; flex-direction: column; gap: 16px; }
.project.featured h3 { font-size: clamp(28px, 4vw, 40px); }
.project.featured .actions { margin-top: 8px; }
.portal { position: relative; display: block; aspect-ratio: 1; }

/* An empty socket: where the next project will go. */
.socket {
  --cut: 16px; --fill: var(--bg); --rim: var(--line);
  min-height: 200px; display: grid; place-items: center; text-align: center; padding: 24px;
  color: var(--faint);
}
.socket svg { width: 72px; height: 72px; margin: 0 auto 12px; }
.socket circle { fill: none; stroke: var(--line); stroke-width: 2; }

/* ---------- The sigil (portal circle) ---------- */
.sigil { width: 100%; height: auto; overflow: visible; }
.sigil .ln-brass, .sigil .ln-mana { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sigil .ln-brass { stroke: var(--brass); stroke-width: 2.5; }
.sigil .ln-mana { stroke: var(--mana); stroke-width: 3; }
.sigil .ln-thin { stroke-width: 1.5; }
.sigil .ln-rune { stroke-width: 1.8; }
.sigil .ln-dim { opacity: .45; }
.sigil .node { fill: var(--bg); stroke: var(--brass); stroke-width: 2.5; }
.sigil .dot { fill: var(--mana); }
.sigil .sigil-inner, .sigil .sigil-core { filter: drop-shadow(0 0 6px rgba(69, 240, 210, .45)); }
.sigil .sigil-outer, .sigil .sigil-inner { transform-origin: 240px 240px; transform-box: view-box; }

@media (prefers-reduced-motion: no-preference) {
  .sigil .sigil-outer { animation: spin 120s linear infinite; }
  .sigil .sigil-inner { animation: spin 80s linear infinite reverse; }
  .sigil .sigil-core { animation: breathe 6s ease-in-out infinite; transform-origin: 240px 240px; transform-box: view-box; }
  /* Hovering the portal lights it and turns it faster, like a circle about to cast in the game. */
  .portal:hover .sigil-outer, .portal:focus-visible .sigil-outer { animation-duration: 30s; }
  .portal:hover .sigil-inner, .portal:focus-visible .sigil-inner { animation-duration: 18s; }
}
.portal .sigil { transition: filter .3s ease; }
.portal:hover .sigil, .portal:focus-visible .sigil { filter: drop-shadow(0 0 18px rgba(69, 240, 210, .35)); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: .7; transform: scale(.96); } }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 32px; }
.about .text { display: flex; flex-direction: column; gap: 16px; max-width: 38em; }
.about ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.about li span { display: block; color: var(--faint); font-size: 14px; }

/* ---------- Project page ---------- */
.project-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 360px); gap: 40px; align-items: center; padding-top: 40px; padding-bottom: 40px; }
.project-hero .body { display: flex; flex-direction: column; gap: 16px; }
.project-hero .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 24px; }
.facts dt { color: var(--faint); font-size: 14px; }
.facts dd { margin: 4px 0 0; font-weight: 600; }
.log { display: flex; flex-direction: column; gap: 32px; max-width: 44em; }
.log article { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 16px; }
.log time { color: var(--faint); font-variant-numeric: tabular-nums; font-size: 14px; padding-top: 4px; }
.log h3 { font-size: 18px; margin-bottom: 8px; }
.log p + p { margin-top: 8px; }

/* ---------- Footer ---------- */
footer { padding: 48px 0 40px; color: var(--faint); font-size: 14px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 760px) {
  :root { --gutter: 16px; }
  .intro { padding-top: 24px; padding-bottom: 24px; }
  .project.featured { grid-template-columns: 1fr; padding: 24px; gap: 24px; }
  .project.featured .portal { order: -1; width: min(280px, 80%); margin: 0 auto; }
  .projects { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .project-hero { grid-template-columns: 1fr; padding: 16px 0; }
  .project-hero .portal { order: -1; width: min(240px, 70%); margin: 0 auto; }
  .log article { grid-template-columns: 1fr; gap: 4px; }
  .top nav a { padding: 8px; }
}
