/* ---------- tokens ---------- */
:root {
  --bg: #fbfaf8;
  --surface: #ffffff;
  --text: #15130f;
  --muted: #605a51;
  --faint: #8a8278;
  --line: #e4ded4;
  --accent: #b4531f;
  --accent-soft: #f6e9df;
  --ok: #2f6f4f;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, system-ui, sans-serif;
  --maxw: 820px;
  --shadow: 0 1px 2px rgba(20,16,12,.05), 0 8px 24px rgba(20,16,12,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #110f0e;
    --surface: #1a1816;
    --text: #f3f0ea;
    --muted: #a69e92;
    --faint: #7d756a;
    --line: #2d2a25;
    --accent: #ea8552;
    --accent-soft: #2d1e15;
    --ok: #6fc49a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #110f0e; --surface: #1a1816; --text: #f3f0ea; --muted: #a69e92;
  --faint: #7d756a; --line: #2d2a25; --accent: #ea8552; --accent-soft: #2d1e15;
  --ok: #6fc49a; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.68 var(--sans); text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s; }
a:hover { border-bottom-color: var(--accent); }
img { max-width: 100%; display: block; }

/* ---------- nav ---------- */
#nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 16px;
}
.nav-name { font-weight: 650; letter-spacing: -.01em; color: var(--text); border: 0; white-space: nowrap; }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--muted); font-size: .9rem; padding: 6px 10px; border-radius: 6px; border: 0;
}
.nav-links a:hover { color: var(--text); background: var(--accent-soft); }
.nav-links a[aria-current="true"] { color: var(--accent); background: var(--accent-soft); }
#theme {
  background: none; border: 1px solid var(--line); color: var(--muted);
  width: 32px; height: 32px; border-radius: 7px; cursor: pointer;
  display: grid; place-items: center; flex: none; padding: 0;
}
#theme:hover { color: var(--text); border-color: var(--accent); }
.moon { display: none; }
:root[data-theme="dark"] .sun, html.dark-pref .sun { display: none; }
:root[data-theme="dark"] .moon, html.dark-pref .moon { display: block; }

/* ---------- banner ---------- */
.banner { margin: 0; position: relative; }
.banner-grid { display: grid; gap: 3px; background: var(--bg); }
/* Height is tuned so each panel lands near its source's 1.6 aspect at
   desktop width — no crop. On a phone the panels go squarer, which crops
   horizontally and keeps the full height, so the stand stays in frame. */
.banner img {
  width: 100%;
  height: clamp(200px, 31vw, 320px);
  object-fit: cover;
  object-position: center center;
  display: block;
  background: var(--line);
  min-width: 0;
}
.banner figcaption {
  max-width: var(--maxw); margin: 0 auto; padding: .6rem 16px 0;
  font-size: .78rem; color: var(--faint); font-family: var(--mono);
  line-height: 1.5;
}

/* ---------- hero ---------- */
.hero { padding: 48px 0 52px; }
h1 { font-size: clamp(2.1rem, 7vw, 3.1rem); line-height: 1.05; margin: 0 0 1rem; letter-spacing: -.028em; }
.kicker {
  font-family: var(--mono); font-size: .76rem; letter-spacing: .13em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1rem;
}
.lede { font-size: 1.12rem; color: var(--muted); margin: 0 0 1.4rem; max-width: 58ch; }
.meta { font-size: .92rem; color: var(--faint); margin: 0; }
.sep { opacity: .45; margin: 0 .45em; }

/* ---------- sections ---------- */
section { padding: 54px 0; border-top: 1px solid var(--line); }
h2 {
  font-size: .76rem; font-family: var(--mono); letter-spacing: .13em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 2.2rem; font-weight: 600;
}
h2.sub { margin-top: 3.4rem; }

/* ---------- projects ---------- */
.proj, .job { margin-bottom: 52px; }
.proj:last-child, .job:last-child { margin-bottom: 0; }
.proj-head { margin-bottom: .9rem; }
h3 { font-size: 1.28rem; margin: 0 0 .2rem; letter-spacing: -.012em; line-height: 1.25; }
.role { font-size: .89rem; color: var(--faint); margin: 0; }
.summary { margin: 0 0 1.15rem; color: var(--text); }
ul.facts { list-style: none; padding: 0; margin: 0 0 1.3rem; display: grid; gap: .6rem; }
ul.facts li { padding-left: 1.15rem; position: relative; font-size: .955rem; color: var(--muted); }
ul.facts li::before {
  content: ""; position: absolute; left: 0; top: .66em;
  width: 5px; height: 5px; border-radius: 50%; background: var(--accent); opacity: .75;
}
ul.facts b { color: var(--text); font-weight: 650; }

/* ---------- tags ---------- */
ul.tags { display: flex; flex-wrap: wrap; gap: .38rem; margin: 0; padding: 0; list-style: none; }
ul.tags li {
  font-family: var(--mono); font-size: .735rem; color: var(--faint);
  border: 1px solid var(--line); border-radius: 999px; padding: .2rem .62rem; white-space: nowrap;
}

/* ---------- images ---------- */
.shots {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px; margin: 0 0 1.3rem;
}
.shots figure { margin: 0; }
.shot {
  display: block; width: 100%; padding: 0; border: 1px solid var(--line);
  border-radius: 9px; overflow: hidden; background: var(--surface);
  cursor: zoom-in; box-shadow: var(--shadow); transition: transform .18s, border-color .18s;
}
.shot:hover { transform: translateY(-2px); border-color: var(--accent); }
.shot img { width: 100%; height: 170px; object-fit: cover; }
.shots figcaption { font-size: .8rem; color: var(--faint); margin-top: .5rem; line-height: 1.45; }

/* ---------- education / skills ---------- */
.edu-grid { display: grid; gap: 26px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.edu h3 { font-size: 1.05rem; }
.note { font-size: .855rem; color: var(--faint); margin: .35rem 0 0; }
.skill-grid { display: grid; gap: 24px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.skill-group h3 { font-size: .92rem; margin-bottom: .6rem; color: var(--muted); }

/* ---------- links ---------- */
ul.links { list-style: none; padding: 0; margin: 0; display: grid; gap: .9rem; }
ul.links li { font-size: .955rem; }
ul.links .note { display: block; margin-top: .15rem; }

/* ---------- contact / footer ---------- */
.contact-line { font-size: 1.15rem; margin: 0 0 .4rem; }
footer { padding: 36px 0 64px; color: var(--faint); font-size: .78rem; font-family: var(--mono); }
footer .wrap, footer p { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ---------- lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,6,5,.92);
  display: grid; place-items: center; padding: 24px;
}
#lightbox[hidden] { display: none; }
#lightbox figure { margin: 0; max-width: 1100px; }
#lb-img { max-height: 78vh; width: auto; margin: 0 auto; border-radius: 8px; }
#lb-cap { color: #e8e2da; font-size: .88rem; margin-top: .9rem; text-align: center; }
#lb-close {
  position: absolute; top: 18px; right: 22px; background: none; border: 0;
  color: #fff; font-size: 2.1rem; line-height: 1; cursor: pointer; opacity: .75;
}
#lb-close:hover { opacity: 1; }

/* ---------- private notes: hidden unless editing ---------- */
[data-private] { display: none; }
body.editing [data-private] {
  display: block; background: var(--accent-soft); border-left: 3px solid var(--accent);
  padding: .6rem .85rem; border-radius: 0 6px 6px 0; margin-top: 1rem;
}

/* ---------- edit mode ---------- */
body.editing [data-e] {
  outline: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 3px; border-radius: 3px; min-width: 1ch; min-height: 1em;
}
body.editing [data-e]:hover { outline-style: solid; background: var(--accent-soft); }
body.editing [data-e]:focus {
  outline: 2px solid var(--accent); outline-offset: 3px;
  background: var(--surface); box-shadow: var(--shadow);
}
body.editing [data-e]:empty::after { content: "empty"; color: var(--faint); font-style: italic; }

#editbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 200;
  display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; box-shadow: var(--shadow); font-size: .87rem;
  max-width: calc(100vw - 32px);
}
#editbar button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px;
  padding: .42rem .85rem; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
#editbar button:hover { border-color: var(--accent); }
#editbar button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#editbar button.primary:disabled { opacity: .45; cursor: default; }
#editbar .status { color: var(--faint); font-family: var(--mono); font-size: .76rem; }
#editbar .status.ok { color: var(--ok); }
#editbar .status.err { color: var(--accent); }
#editbar .dirty { color: var(--accent); font-weight: 600; }

/* ---------- message form ---------- */
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
#website { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
#msgform { margin-top: 2.6rem; max-width: 560px; }
.form-title { font-size: 1.02rem; margin: 0 0 .2rem; }
.form-sub { margin: 0 0 .9rem; }
#msgform textarea, #msgform input[type="text"] {
  width: 100%; font: inherit; font-size: .94rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 8px; padding: .62rem .75rem; resize: vertical;
}
#msgform textarea:focus, #msgform input[type="text"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#msgform textarea::placeholder, #msgform input::placeholder { color: var(--faint); }
.form-row { display: flex; gap: .55rem; margin-top: .55rem; align-items: stretch; }
.form-row input { flex: 1; min-width: 0; }
#msgsend {
  font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; flex: none;
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  border-radius: 8px; padding: .55rem 1.15rem;
}
#msgsend:hover { filter: brightness(1.08); }
#msgsend:disabled { opacity: .5; cursor: default; }
.form-status { font-size: .84rem; margin: .6rem 0 0; min-height: 1.2em; color: var(--muted); }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--accent); }

/* ---------- inbox (admin only) ---------- */
.inbox-msg {
  border: 1px solid var(--line); border-radius: 9px; padding: .85rem 1rem;
  margin-bottom: .7rem; background: var(--surface);
}
.inbox-msg .meta {
  font-family: var(--mono); font-size: .74rem; color: var(--faint);
  display: flex; gap: .6rem; align-items: center; margin-bottom: .45rem;
}
.inbox-msg .meta .who { color: var(--accent); }
.inbox-msg .text { white-space: pre-wrap; font-size: .94rem; }
.inbox-msg .del {
  margin-left: auto; background: none; border: 0; color: var(--faint);
  cursor: pointer; font-size: 1.05rem; line-height: 1; padding: 0 .2rem;
}
.inbox-msg .del:hover { color: var(--accent); }
.inbox-empty { color: var(--faint); font-size: .9rem; }

/* ---------- project link ---------- */
.proj-link { margin: 0 0 1.1rem; }
.proj-link a {
  display: inline-block; font-size: .88rem; font-weight: 550;
  border: 1px solid var(--line); border-radius: 8px; padding: .42rem .85rem;
  background: var(--surface); transition: border-color .15s, background .15s;
}
.proj-link a:hover { border-color: var(--accent); background: var(--accent-soft); }

/* ---------- vibecoding ---------- */
.lede-sm { font-size: 1.04rem; color: var(--muted); max-width: 60ch; margin-bottom: 1.5rem; }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .nav-links a { padding: 6px 7px; font-size: .84rem; }
  .nav-name { font-size: .95rem; }
  .hero { padding: 48px 0 40px; }
  section { padding: 44px 0; }
  .shot img { height: 150px; }
}
/* Five nav items plus a name does not fit a phone - drop the name,
   the links still anchor the page and #top is reachable by scrolling. */
@media (max-width: 560px) {
  .nav-name { display: none; }
  .nav-links { margin-left: 0; width: 100%; justify-content: space-between; }
  .nav-links a { padding: 6px 4px; font-size: .78rem; }
}
@media (max-width: 380px) {
  .nav-links a { font-size: .72rem; padding: 6px 2px; }
}
