/* =========================================================
   Look and feel.  Colors live in :root; change them there
   and the whole site follows.
   ========================================================= */
/* Fonts are hosted with the site (no Google Fonts tracking).
   Nunito (headings), Inter (body), and Recursive (turtle code box),
   all SIL Open Font License. */
@font-face {
  font-family: "Nunito";
  src: url("assets/fonts/nunito.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Recursive";
  src: url("assets/fonts/recursive.woff2") format("woff2");
  font-weight: 300 1000;
  font-style: oblique 0deg 15deg;
  font-display: swap;
}

:root {
  --paper: #f3f5f1;     /* page background */
  --panel: #e5eae3;     /* soft fills, hover */
  --card: #fbfcfa;      /* cards, turtle canvas */
  --ink: #1e2533;       /* main text */
  --muted: #535c6f;     /* secondary text */
  --line: #2f6f5e;      /* turtle green: links, accents */
  --marigold: #e0a526;  /* turtle shell, focus ring */
  --rule: #d3d9d0;      /* dividers */

  --display: "Nunito", ui-sans-serif, system-ui, sans-serif;
  --body: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "Recursive", ui-monospace, "Cascadia Mono", Consolas, monospace;  /* turtle code box */

  --measure: 38rem;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --wrap: 70rem;
  --radius: 12px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--body);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; outline: none; }

h1, h2, h3 {
  font-family: var(--display);
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0 0 1em; max-width: var(--measure); }
a { color: var(--line); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--marigold); outline-offset: 3px; border-radius: 3px; }
[hidden] { display: none !important; }
img { max-width: 100%; display: block; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 10;
  background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; border-radius: 6px;
}
.skip:focus { top: 1rem; }

/* ---------- Header ---------- */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 1.5rem;
  flex-wrap: wrap;
  max-width: var(--wrap);
  width: 100%;
  margin: 0 auto;
  padding: 1.1rem var(--gutter);
}
.wordmark {
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
  text-decoration: none;
  /* Same pill as the nav links.  The negative margin keeps the
     name lined up with the page edge when it isn't hovered. */
  padding: 0.4rem 0.85rem;
  margin-left: -0.85rem;
  border-radius: 999px;
}
.wordmark:hover { background: var(--panel); }
.masthead ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; }
.masthead nav a {
  display: block;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.975rem;
}
.masthead nav a:hover { background: var(--panel); }
.masthead nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* ---------- Buttons ---------- */
button, .button {
  display: inline-block;
  font: 600 0.975rem/1 var(--body);
  border-radius: 999px;
  padding: 0.7rem 1.25rem;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
}
.button { background: var(--ink); color: var(--paper); }
.button:hover { background: #33405a; }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.button.ghost:hover { background: var(--panel); }

/* ---------- Home ---------- */
.hero {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 4rem) var(--gutter) clamp(3rem, 6vw, 5rem);
  display: grid;
  gap: clamp(2.5rem, 5vw, 4.5rem);
  align-items: center;
}
@media (min-width: 900px) { .hero { grid-template-columns: 1.15fr 0.85fr; } }

.kicker { color: var(--line); font-weight: 600; margin-bottom: 0.75rem; }
.hero h1 {
  font-size: clamp(2.75rem, 7vw, 5rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 1.5rem;
}
.welcome p { font-size: 1.25rem; line-height: 1.55; }
.purpose p { color: var(--muted); }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

.turtle { margin: 0; max-width: 30rem; width: 100%; justify-self: center; }
.turtle-stage {
  aspect-ratio: 1;
  background-color: var(--card);
  background-image: radial-gradient(circle, var(--rule) 1px, transparent 1.2px);
  background-size: 20px 20px;
  background-position: center;
  border: 1px solid var(--rule);
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}
#turtle-canvas { display: block; width: 100%; height: 100%; }
.turtle-console {
  background: var(--ink);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0.85rem 0.95rem 0.8rem;
}
#turtle-code {
  display: block; width: 100%;
  resize: vertical;
  min-height: 5.5rem;
  background: transparent;
  color: #e8efe6;
  border: 1px solid #4a5570;
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  font-family: var(--mono);
  font-variation-settings: "MONO" 1, "CASL" 0;
  font-size: 0.925rem;
  line-height: 1.5;
}
.turtle-actions { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.7rem; flex-wrap: wrap; }
.turtle-actions button { padding: 0.55rem 1.1rem; }
#turtle-run { background: var(--marigold); color: var(--ink); }
#turtle-run:hover { background: #ecb53a; }
button.quiet { background: transparent; color: #d3dad0; border-color: #4a5570; }
button.quiet:hover { color: #fff; border-color: #6b7690; }
.turtle-status { margin: 0; font-size: 0.9rem; color: #d3dad0; }
.turtle-status.error { color: #ffd27a; }
.turtle figcaption { margin-top: 0.85rem; font-size: 0.95rem; color: var(--muted); }

/* ---------- Inner pages ---------- */
.page {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) var(--gutter) clamp(3rem, 6vw, 5rem);
}
.page h1 {
  font-size: clamp(2.4rem, 6vw, 3.75rem);
  font-weight: 900;
  letter-spacing: -0.015em;
  margin-bottom: 1.25rem;
}
.page h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 0.9rem; }
.block { margin-top: clamp(3rem, 6vw, 4.5rem); }
.prose p:last-child { margin-bottom: 0; }
.note { color: var(--muted); font-size: 0.95rem; }

/* ---------- About ---------- */
.about-intro {
  display: grid;
  gap: 2rem clamp(2rem, 5vw, 4rem);
  align-items: start;
}
@media (min-width: 760px) { .about-intro { grid-template-columns: minmax(12rem, 18rem) 1fr; } }
.about-intro .prose p:first-child { font-size: 1.2rem; line-height: 1.55; }

.portrait {
  width: 100%; max-width: 18rem;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--panel);
}
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.initials {
  display: grid; place-items: center;
  background: var(--line);
  color: var(--paper);
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(3.5rem, 9vw, 5.5rem);
}

.about-cols {
  display: grid;
  gap: 2.5rem clamp(2rem, 5vw, 4rem);
  margin-top: clamp(3rem, 6vw, 4.5rem);
}
@media (min-width: 760px) { .about-cols { grid-template-columns: 1fr 1fr; } }
.about-cols.block { margin-top: clamp(3rem, 6vw, 4.5rem); }

.belief-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@media (min-width: 760px) { .belief-grid { grid-template-columns: 1fr 1fr; } }
.belief {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.25rem;
}
.belief h3 { font-size: 1.15rem; font-weight: 750; margin-bottom: 0.5rem; color: var(--line); }
.belief p { margin: 0; }

.job { padding: 1.4rem 0; border-top: 1px solid var(--rule); }
.job:last-child { border-bottom: 1px solid var(--rule); }
.job h3 { font-size: 1.15rem; font-weight: 750; }
.job-meta { color: var(--muted); margin: 0.2rem 0 0.6rem; }
.job ul { margin: 0; padding-left: 1.2rem; max-width: var(--measure); }
.job li { margin-bottom: 0.3rem; }
.job li::marker { color: var(--line); }
@media (min-width: 760px) {
  .job { display: grid; grid-template-columns: 18rem 1fr; gap: clamp(2rem, 5vw, 4rem); }
}

.email {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  word-break: break-word;
}
.links { list-style: none; padding: 0; margin: 0.75rem 0 0; display: flex; gap: 1.25rem; flex-wrap: wrap; }

/* Contact form */
.contact-form { display: grid; gap: 1rem; max-width: var(--measure); margin-top: 0.5rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 600; font-size: 0.975rem; }
.field input, .field textarea {
  font: inherit;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field input:focus-visible, .field textarea:focus-visible { border-color: var(--line); }
.field [aria-invalid="true"] { border-color: #b3261e; }
.contact-form .note { margin: 0; }
.contact-form .button { justify-self: start; }
.contact-form .button:disabled { opacity: 0.6; cursor: wait; }
.turnstile:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-status { margin: 0.75rem 0 0; font-weight: 600; color: var(--line); }
.form-status:empty { display: none; }
.form-status.error { color: #b3261e; }

/* ---------- Selected works ---------- */
.page-head { margin-bottom: clamp(2rem, 5vw, 3rem); }
.objectives { list-style: none; margin: 0; padding: 0; }
.objective {
  display: grid;
  gap: 1.25rem clamp(2rem, 5vw, 4rem);
  padding: clamp(1.75rem, 4vw, 2.5rem) 0;
  border-top: 1px solid var(--rule);
}
.objective:last-child { border-bottom: 1px solid var(--rule); }
@media (min-width: 860px) { .objective { grid-template-columns: 1fr 1.1fr; align-items: start; } }

.obj-text { display: grid; grid-template-columns: auto 1fr; gap: 0 1.1rem; align-items: start; }
.obj-num {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: 2.25rem;
  line-height: 1;
  color: var(--line);
  min-width: 1.6ch;
}
.obj-text h2 {
  font-family: var(--body);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.45;
  margin: 0.2rem 0 0;
  max-width: 32rem;
}

.artifact {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1.1rem;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem;
}
.artifact.is-placeholder { background: transparent; border-style: dashed; }
.thumb {
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background-color: var(--card);
  background-image: radial-gradient(circle, var(--rule) 1px, transparent 1.2px);
  background-size: 12px 12px;
  border: 1px solid var(--rule);
}
.thumb canvas, .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.artifact h3 { font-size: 1.1rem; font-weight: 750; margin-bottom: 0.35rem; }
.artifact h3 a { color: var(--ink); }
.artifact h3 a:hover { color: var(--line); }
.artifact p { margin: 0; color: var(--muted); font-size: 0.975rem; }
.artifact .note { margin-bottom: 0.35rem; }
.is-placeholder h3 { color: var(--muted); }

/* ---------- Footer ---------- */
.foot {
  max-width: var(--wrap);
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem var(--gutter) 2.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.foot p { margin: 0; max-width: none; padding-top: 1.5rem; border-top: 1px solid var(--rule); }

@media (max-width: 520px) {
  .masthead { flex-direction: column; align-items: flex-start; }
  .masthead nav a { padding: 0.4rem 0.7rem; }
  .wordmark { padding: 0.4rem 0.7rem; margin-left: -0.7rem; }
  .artifact { grid-template-columns: 5.5rem 1fr; }
}
@media (max-width: 759px) { .portrait { max-width: 10rem; } }
