/* Kirk Strong: Monterey Bay palette. Fog, deep bay water, sea glass. */
:root {
  --fog: #eef2f2;
  --surface: #f9fbfb;
  --ink: #13303a;
  --muted: #52666e;
  --rule: #c8d4d6;
  --sea: #2e7667;
  --sea-deep: #1f5a4e;
  --sea-wash: #dce9e5;
  --contour: #9fb8b9;
  --error: #9b2d20;

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Literata", Georgia, "Times New Roman", serif;

  --measure: 66ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fog: #0f2229;
    --surface: #152c34;
    --ink: #e3ecec;
    --muted: #9db1b5;
    --rule: #2a454e;
    --sea: #6cc0ad;
    --sea-deep: #8fd4c3;
    --sea-wash: #1c3d3b;
    --contour: #2f5058;
    --error: #f0937f;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--fog);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--sea-deep); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--sea); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; margin: 0; }

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

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--fog) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
}
.wordmark { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; align-items: baseline; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.topbar nav a:hover { color: var(--ink); }
.topbar form { margin: 0; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(3rem, 10vw, 7rem) var(--gutter) 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.hero-text { position: relative; max-width: 48rem; }
.hero h1 {
  font-size: clamp(4rem, 15vw, 10.5rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.86;
  font-variation-settings: "opsz" 96;
}
.tagline {
  font-family: var(--display);
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  line-height: 1.35;
  max-width: 30ch;
  margin: 1.75rem 0 2rem;
  color: var(--muted);
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }

.contours {
  position: absolute;
  right: -12vw; top: 50%;
  width: min(78vw, 820px);
  transform: translateY(-50%);
  color: var(--contour);
  pointer-events: none;
}
.contours path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: survey 2.4s cubic-bezier(.3,.6,.2,1) forwards;
}
.contours path:nth-child(1) { animation-delay: 0s; }
.contours path:nth-child(2) { animation-delay: .08s; }
.contours path:nth-child(3) { animation-delay: .16s; }
.contours path:nth-child(4) { animation-delay: .24s; }
.contours path:nth-child(5) { animation-delay: .32s; }
.contours path:nth-child(6) { animation-delay: .40s; }
.contours path:nth-child(7) { animation-delay: .48s; }
.contours path:nth-child(8) { animation-delay: .56s; }
.contours path:nth-child(9) { animation-delay: .64s; }
@keyframes survey { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .contours path { animation: none; stroke-dashoffset: 0; }
}

.served-by {
  position: relative;
  margin: 3.5rem 0 0;
  font-family: var(--display);
  font-size: 0.92rem;
  color: var(--muted);
  max-width: 60ch;
}
.served-by strong { color: var(--ink); font-weight: 600; }
.pulse {
  display: inline-block; width: 0.55rem; height: 0.55rem; margin-right: 0.45rem;
  border-radius: 50%; background: var(--sea); vertical-align: 0.05em;
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--sea) 60%, transparent);
  animation: ping 2.2s ease-out 3;
}
@keyframes ping { to { box-shadow: 0 0 0 0.6rem transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- Buttons and meta ---------- */
.button {
  display: inline-block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.75rem 1.3rem;
  border: 0; border-radius: 999px;
  background: var(--ink); color: var(--fog);
  text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--sea-deep); color: var(--fog); }
.linkish {
  font: inherit; font-family: var(--display); font-size: 0.95rem; color: var(--muted);
  background: none; border: 0; padding: 0; cursor: pointer;
}
.linkish:hover { color: var(--ink); text-decoration: underline; }
.meta { font-family: var(--display); font-size: 0.92rem; color: var(--muted); margin: 0; }

/* ---------- Content bands ---------- */
.band {
  display: grid;
  grid-template-columns: minmax(10rem, 16rem) minmax(0, var(--measure));
  gap: 1rem 3rem;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter);
  border-bottom: 1px solid var(--rule);
}
.band > h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  position: sticky; top: 5rem; align-self: start;
}
@media (max-width: 760px) {
  .band { grid-template-columns: 1fr; }
  .band > h2 { position: static; }
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.1em; }
.prose h3 { font-size: 1.2rem; font-weight: 700; margin: 2rem 0 0.2rem; }
.prose h3:first-child { margin-top: 0; }
.prose h3 + p > em:only-child { font-style: normal; font-family: var(--display); font-size: 0.95rem; color: var(--muted); }
.prose ul { padding-left: 1.2em; }
.prose li { margin-bottom: 0.35em; }
.prose li::marker { color: var(--sea); }
.prose code {
  font-size: 0.9em; background: var(--sea-wash); padding: 0.1em 0.35em; border-radius: 4px;
}
.prose .after { margin-top: 1.75rem; font-family: var(--display); }

/* ---------- Architecture flow ---------- */
.flow {
  list-style: none; padding: 0; margin: 2rem 0;
  display: grid; gap: 1.6rem;
  font-family: var(--display);
}
.hop { position: relative; }
.hop + .hop::before {
  content: ""; position: absolute; left: 1.4rem; top: -1.6rem; height: 1.6rem;
  border-left: 2px dotted var(--sea);
}
.hop > .hop-name, .node {
  display: block;
}
.hop:not(.hop-pair), .node {
  padding: 0.85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.hop-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.node.is-current { border: 2px solid var(--sea); background: var(--sea-wash); }
.hop-name { display: block; font-weight: 650; }
.hop-note { display: block; font-size: 0.9rem; color: var(--muted); line-height: 1.4; }
@media (max-width: 480px) { .hop-pair { grid-template-columns: 1fr; } }

/* ---------- Footer ---------- */
.footer {
  padding: 2rem var(--gutter) 3rem;
  font-family: var(--display); font-size: 0.9rem; color: var(--muted);
}
.footer p { margin: 0 0 0.25rem; }

/* ---------- Panels, forms, admin ---------- */
.narrow { display: grid; place-items: center; min-height: 100vh; padding: 1.5rem; }
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  width: 100%;
}
.narrow .panel { max-width: 26rem; }
.panel h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.panel h2 { font-size: 1.35rem; margin-bottom: 0.75rem; }

.admin-main { max-width: 52rem; margin: 0 auto; padding: 2.5rem var(--gutter) 4rem; display: grid; gap: 1.5rem; }
.admin-main > h1 { font-size: clamp(2rem, 5vw, 2.8rem); letter-spacing: -0.02em; }

.stack { display: grid; gap: 1.1rem; margin: 1.25rem 0; }
label { display: grid; gap: 0.4rem; font-family: var(--display); font-weight: 600; font-size: 0.95rem; }
input, textarea {
  font: inherit; font-weight: 400;
  color: var(--ink); background: var(--fog);
  border: 1px solid var(--rule); border-radius: 8px;
  padding: 0.65rem 0.8rem; width: 100%;
}
textarea { font-family: var(--body); font-size: 0.98rem; line-height: 1.55; resize: vertical; }
input[type="file"] { padding: 0.55rem; }
input:focus, textarea:focus { border-color: var(--sea); }
.stack .button { justify-self: start; }

.notice { margin: 0; padding: 0.8rem 1rem; border-radius: 8px; font-family: var(--display); }
.notice-success { background: var(--sea-wash); border-left: 4px solid var(--sea); }
.notice-error { background: color-mix(in srgb, var(--error) 12%, var(--surface)); border-left: 4px solid var(--error); }

@media (max-width: 760px) {
  .contours { opacity: 0.45; right: -30vw; width: 110vw; }
}

/* ---------- See photos button in the top bar ---------- */
.topbar nav a.nav-photos {
  color: var(--ink);
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
}
.topbar nav a.nav-photos:hover { background: var(--ink); color: var(--fog); }

/* ---------- Photos page ---------- */
.gallery-bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem;
  padding: 0.9rem var(--gutter);
  background: color-mix(in srgb, var(--fog) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.gallery-bar h1 { font-size: 1.6rem; letter-spacing: -0.02em; }
.button-back { padding: 0.5rem 1.1rem; font-size: 0.95rem; }

.gallery-main { padding: 2rem var(--gutter) 3rem; }
.gallery-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
}
.gallery-item { display: block; border-radius: 8px; overflow: hidden; background: var(--rule); }
.gallery-item img {
  display: block; width: 100%; aspect-ratio: 1; object-fit: cover;
}
.gallery-item:hover img { opacity: 0.9; }
.gallery-caption {
  margin: 0.45rem 0 0; font-family: var(--display); font-size: 0.9rem; color: var(--muted);
}
.gallery-empty { font-family: var(--display); color: var(--muted); }

/* ---------- Photo viewer ---------- */
.lightbox {
  font-family: var(--display);
  border: 0; padding: 0; background: transparent; color: #eef2f2;
  max-width: 96vw; max-height: 96vh;
}
.lightbox::backdrop { background: rgb(8 22 27 / 0.92); }
.lightbox figure { margin: 0; text-align: center; }
.lightbox img {
  display: block; margin: 0 auto;
  max-width: 94vw; max-height: 80vh; object-fit: contain; border-radius: 4px;
}
.lightbox figcaption { margin-top: 0.6rem; font-family: var(--display); }
.lightbox-controls {
  display: flex; justify-content: center; align-items: center; gap: 1.25rem; margin-top: 0.9rem;
}
.lightbox .linkish, .lightbox .meta { color: #cfdcdc; }
.lightbox .linkish:hover { color: #fff; }
.lightbox .button { background: #eef2f2; color: #13303a; }

/* ---------- Admin: photo uploads ---------- */
.dropzone {
  display: grid; justify-items: center; gap: 0.3rem; text-align: center;
  padding: 2rem 1rem;
  border: 2px dashed var(--rule); border-radius: 12px;
  background: var(--fog); cursor: pointer;
  font-weight: 400;
}
.dropzone:hover, .dropzone.dragging { border-color: var(--sea); background: var(--sea-wash); }
.dropzone:focus-within { outline: 3px solid var(--sea); outline-offset: 3px; }
.dropzone.busy { opacity: 0.7; pointer-events: none; }
.dropzone input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden;
}
.dropzone-title { font-weight: 600; font-size: 1.05rem; }
.upload-status { list-style: none; margin: 0; padding: 0; font-family: var(--display); font-size: 0.92rem; }
.upload-status:empty { display: none; }
.upload-status li { padding: 0.15rem 0; color: var(--muted); }
.upload-status li.ok { color: var(--sea-deep); }
.upload-status li.error { color: var(--error); }

.photo-admin-grid {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
}
.photo-card {
  display: grid; gap: 0.5rem; align-content: start;
  padding: 0.6rem; border: 1px solid var(--rule); border-radius: 10px; background: var(--fog);
}
.photo-card img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.photo-card form { margin: 0; }
.photo-caption-form { display: grid; gap: 0.35rem; }
.photo-caption-form label { font-size: 0.85rem; }
.photo-caption-form input { padding: 0.45rem 0.6rem; font-size: 0.92rem; }
.photo-card .linkish { font-size: 0.88rem; justify-self: start; }
.linkish.danger { color: var(--error); }

/* ---------- Footer: served-by line ---------- */
.footer .served-by { margin: 0 0 0.9rem; font-size: 0.9rem; max-width: none; }
.footer .served-by a { margin-left: 0.35rem; }
