/* Giovanni Callahan — personal site
   Concept: calibration. Graph paper, navy ink, a teal signal trace and an amber marker. */

@font-face {
  font-family: "Instrument Sans";
  src: url("../fonts/instrument-sans-var.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #eef3f2;
  --paper-2: #e2eae9;
  --grid: #d3dddc;
  --ink: #13233a;
  --ink-2: #3c4e62;
  --signal: #0b7574;
  --signal-bright: #14a3a1;
  --marker: #a8620c;
  --marker-bright: #e39a32;
  --error: #b42318;
  --ok: #0b7a4b;

  --measure: 64ch;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.625rem;
  --step-3: 2.0625rem;
  --step-4: clamp(2.4rem, 6.2vw, 4.25rem);
  --step-5: clamp(2.9rem, 8.4vw, 5.75rem);

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 1160px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  font-stretch: 100%;
}

img, svg, canvas { display: block; max-width: 100%; }
figure { margin: 0; }
a { color: var(--signal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--marker-bright); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3 {
  font-stretch: 78%;
  font-weight: 650;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
p { margin: 0 0 1em; max-width: var(--measure); text-wrap: pretty; }

.skip {
  position: absolute; left: -999px; top: 0.5rem;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; z-index: 50;
}
.skip:focus { left: 0.5rem; }

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

/* ── Navigation ─────────────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  border-bottom: 1px solid var(--grid);
}
.site-nav .wrap { display: flex; align-items: center; justify-content: space-between; min-height: 64px; gap: 1rem; }
.wordmark {
  font-stretch: 75%; font-weight: 700; font-size: 1.25rem; letter-spacing: 0.005em;
  color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 0.6rem;
}
.wordmark svg { width: 26px; height: 26px; }
.nav-links { display: flex; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: block; padding: 0.5rem 0.75rem; color: var(--ink-2); text-decoration: none;
  font-weight: 500; border-radius: var(--radius);
}
.nav-links a:hover { color: var(--ink); background: var(--paper-2); }
.nav-links a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--signal); border-radius: 0; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--grid); border-radius: var(--radius);
  font: inherit; font-weight: 600; color: var(--ink); padding: 0.45rem 0.8rem; cursor: pointer;
}
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column;
    background: var(--paper); border-bottom: 1px solid var(--grid); padding: 0.5rem var(--gutter) 1rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.85rem 0.5rem; font-size: 1.125rem; }
  .nav-links a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--signal); padding-left: 0.9rem; }
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 46px;
  padding: 0.7rem 1.25rem; border-radius: var(--radius); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 1.5px solid var(--ink);
  transition: background-color 0.15s, color 0.15s;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--signal); border-color: var(--signal); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.5rem; }

/* ── Home hero: the calibration plot ────────────────────── */
.hero { padding: clamp(2.5rem, 7vw, 5rem) 0 2rem; }
.hero h1 { max-width: 14ch; }
.hero .lede { font-size: var(--step-1); line-height: 1.5; color: var(--ink-2); max-width: 52ch; }
.plot {
  position: relative; margin-top: clamp(2rem, 5vw, 3.5rem);
  border: 1px solid var(--grid); border-radius: 10px; background: #f6f9f8;
  overflow: hidden;
}
.plot canvas { width: 100%; height: clamp(260px, 38vw, 420px); }
.plot figcaption {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem;
  padding: 0.85rem 1.1rem; border-top: 1px solid var(--grid); font-size: var(--step--1); color: var(--ink-2);
}
.stage-list { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.stage-list li { display: flex; align-items: center; gap: 0.45rem; transition: color 0.3s; }
.stage-list li::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid var(--grid); transition: all 0.3s;
}
.stage-list li.on { color: var(--ink); font-weight: 600; }
.stage-list li.on::before { background: var(--signal-bright); border-color: var(--signal-bright); }

/* ── Sections ───────────────────────────────────────────── */
.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section + .section { border-top: 1px solid var(--grid); }
.section-head { margin-bottom: 2rem; }
.section-head p { color: var(--ink-2); font-size: var(--step-1); line-height: 1.5; }

.about { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }
.facts { margin: 0; border-top: 1.5px solid var(--ink); }
.facts div { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--grid); }
.facts dt { font-weight: 600; font-stretch: 85%; }
.facts dd { margin: 0; color: var(--ink-2); }
@media (max-width: 480px) { .facts div { grid-template-columns: 1fr; gap: 0.15rem; } }
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; margin: 0.25rem 0 0; }
.tags li { border: 1px solid var(--grid); background: #f6f9f8; border-radius: 999px; padding: 0.15rem 0.7rem; font-size: var(--step--1); color: var(--ink); }

/* ── App showcase rows (home) ───────────────────────────── */
.apps { display: grid; gap: 1.5rem; }
.app-row {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: stretch;
  border-radius: 10px; overflow: hidden; border: 1px solid var(--grid);
}
.app-row .copy { padding: clamp(1.5rem, 4vw, 2.75rem); display: flex; flex-direction: column; justify-content: center; }
.app-row .copy p { color: inherit; opacity: 0.88; }
.app-row .visual { min-height: 260px; position: relative; }
.app-row .visual img { width: 100%; height: 100%; object-fit: contain; padding: 1.5rem; }
.app-row h3 { font-size: var(--step-3); }
.app-row.neuro { background: #141a3c; color: #e9ecf8; border-color: #141a3c; }
.app-row.neuro .visual { background: radial-gradient(ellipse at 50% 55%, #2a2f6e 0%, #141a3c 70%); }
.app-row.neuro .btn-primary { background: #e9ecf8; color: #141a3c; border-color: #e9ecf8; }
.app-row.neuro .btn-primary:hover { background: #8b6cff; border-color: #8b6cff; color: #fff; }
.app-row.neuro .btn-ghost { color: #e9ecf8; border-color: rgba(233, 236, 248, 0.5); }
.app-row.neuro .btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }
.app-row.paper { background: #f6f9f8; }
.app-row.paper .visual {
  background-color: #fbfcfc;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px; border-left: 1px solid var(--grid);
}
.app-row.paper .visual canvas { width: 100%; height: 100%; min-height: 260px; }
@media (max-width: 860px) {
  .app-row { grid-template-columns: 1fr; }
  .app-row .visual { order: -1; min-height: 220px; }
  .app-row.paper .visual { border-left: 0; border-bottom: 1px solid var(--grid); }
}
.note { font-size: var(--step--1); color: var(--ink-2); margin-top: 0.75rem; }

/* ── Project pages ──────────────────────────────────────── */
.page-hero { padding: clamp(2.5rem, 7vw, 4.5rem) 0 clamp(2rem, 5vw, 3rem); }
.page-hero .lede { font-size: var(--step-1); color: var(--ink-2); max-width: 54ch; line-height: 1.5; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1.5px solid currentColor; }
.feature-list li { padding: 1rem 0; border-bottom: 1px solid var(--line, var(--grid)); }
.feature-list strong { display: block; font-stretch: 85%; font-size: var(--step-1); line-height: 1.3; margin-bottom: 0.2rem; }
.feature-list span { color: var(--muted, var(--ink-2)); }
.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.75rem; }
.steps li { counter-increment: step; border-top: 3px solid var(--grid); padding-top: 0.75rem; transition: border-color 0.4s; }
.steps li.on { border-color: var(--signal-bright); }
.steps li::before { content: counter(step); font-stretch: 75%; font-weight: 700; font-size: var(--step-2); color: var(--signal); display: block; line-height: 1; margin-bottom: 0.35rem; }
.steps strong { display: block; }
.steps span { font-size: var(--step--1); color: var(--ink-2); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } .steps li { display: grid; grid-template-columns: 2.2rem 1fr; border-top: 0; border-left: 3px solid var(--grid); padding: 0.25rem 0 0.25rem 0.75rem; } .steps li.on { border-color: var(--signal-bright); } .steps li::before { grid-row: span 2; } }
.share { display: flex; gap: 1.25rem; align-items: center; flex-wrap: wrap; }
.share img { width: 132px; height: 132px; background: #fff; padding: 8px; border-radius: 8px; border: 1px solid var(--grid); }
.share code { font-family: inherit; font-weight: 600; font-size: var(--step-1); }
.copy-btn { margin-left: 0.25rem; }

/* Gyrafold page: the neuroscience theme */
body.neuro {
  --paper: #10153a; --paper-2: #1a2152; --grid: #2b3470; --ink: #eceffb; --ink-2: #b4bbdc;
  --signal: #9d84ff; --signal-bright: #a993ff; --marker-bright: #44d7e9; --line: #2b3470; --muted: #b4bbdc;
  background: radial-gradient(ellipse 80% 60% at 70% 0%, #1d2563 0%, #10153a 60%) fixed, #10153a;
}
body.neuro .site-nav { background: color-mix(in srgb, #10153a 85%, transparent); }
body.neuro h1, body.neuro .wordmark-neuro { font-family: "Space Grotesk", "Instrument Sans", sans-serif; font-stretch: 100%; letter-spacing: -0.025em; font-weight: 600; }
body.neuro .btn-primary { background: #eceffb; color: #10153a; border-color: #eceffb; }
body.neuro .btn-primary:hover { background: #9d84ff; border-color: #9d84ff; color: #fff; }
body.neuro .btn-ghost { color: #eceffb; border-color: #4a5394; }
body.neuro .btn-ghost:hover { background: #1a2152; }
body.neuro a { color: #b9a8ff; }
body.neuro .share img { border-color: #2b3470; }
.raster { border: 1px solid #2b3470; border-radius: 10px; background: #0b0f2b; overflow: hidden; }
.raster canvas { width: 100%; height: 150px; }
.raster figcaption { font-size: var(--step--1); color: #b4bbdc; padding: 0.6rem 1rem; border-top: 1px solid #2b3470; }
.brain-shot { position: relative; }
.brain-shot::before { content: ""; position: absolute; inset: 8% 10%; background: radial-gradient(closest-side, rgba(157, 132, 255, 0.35), transparent); filter: blur(10px); }
.brain-shot img { position: relative; }
.phone-shot { width: min(260px, 70vw); border-radius: 28px; border: 8px solid #252c5e; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45); }

/* ── Forms ──────────────────────────────────────────────── */
.form { display: grid; gap: 1.1rem; max-width: 640px; }
.field { display: grid; gap: 0.35rem; }
.field label, .field legend { font-weight: 600; }
.field .hint { font-size: var(--step--1); color: var(--ink-2); margin: 0; }
input[type="text"], input[type="email"], select, textarea {
  font: inherit; color: var(--ink); background: #fbfcfc; border: 1.5px solid #b9c7c6;
  border-radius: var(--radius); padding: 0.7rem 0.8rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(20, 163, 161, 0.25); }
textarea { min-height: 9rem; resize: vertical; }
fieldset { border: 0; padding: 0; margin: 0; }
.choices { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.choices label {
  display: inline-flex; align-items: center; gap: 0.4rem; border: 1.5px solid #b9c7c6; border-radius: 999px;
  padding: 0.45rem 0.9rem; cursor: pointer; font-weight: 500; background: #fbfcfc;
}
.choices input { accent-color: var(--signal); }
.choices label:has(input:checked) { border-color: var(--signal); background: #e4f1f0; }
.scale { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.4rem; max-width: 420px; }
.scale label { justify-content: center; flex-direction: column; border-radius: var(--radius); padding: 0.55rem 0.25rem; text-align: center; font-size: var(--step--1); gap: 0.1rem; }
.scale label b { font-size: var(--step-1); font-stretch: 80%; }
.scale input { position: absolute; opacity: 0; pointer-events: none; }
.scale label:has(input:focus-visible) { outline: 3px solid var(--marker-bright); outline-offset: 2px; }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
.status-msg { border-radius: var(--radius); padding: 0.85rem 1rem; font-weight: 500; }
.status-msg.ok { background: #e1f3ea; color: var(--ok); border: 1px solid #a8d8bf; }
.status-msg.err { background: #fbe9e7; color: var(--error); border: 1px solid #f0b8b1; }
.status-msg.info { background: #fdf3e2; color: #7a4a06; border: 1px solid #efd2a2; }
.contact-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(2rem, 6vw, 5rem); }
@media (max-width: 860px) { .contact-grid { grid-template-columns: 1fr; } }
.aside-box { border-top: 1.5px solid var(--ink); padding-top: 1rem; }
.aside-box ul { padding-left: 1.1rem; margin: 0.25rem 0 1rem; }

/* ── Footer ─────────────────────────────────────────────── */
.site-foot { border-top: 1px solid var(--grid); padding: 2rem 0 3rem; font-size: var(--step--1); color: var(--ink-2); }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }
.site-foot ul { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0; padding: 0; }

/* 404 */
.lost { min-height: 60vh; display: grid; align-content: center; }
.h-small { font-size: var(--step-2); }
.plot.flush { margin: 0; }
