/* Halvik project site. Palette comes from the Halvik mark: navy harbor, cream gate, amber signal, sea water. */

@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #14324b;
  --navy-deep: #0c2133;
  --cream: #f2e8d5;
  --amber: #e3a33b;
  --sea: #7fb3c8;

  --paper: #f6f4ef;
  --tint: #eee9df;
  --card: #ffffff;
  --ink: #1d2327;
  --muted: #56636b;
  --line: #e1dbcf;
  --heading: #14324b;
  --kicker: #8a5a10;
  --bubble-in: #f6f1e6;
  --link: #1d5a82;

  --serif: "Fraunces", ui-serif, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1724;
    --tint: #0f1e2e;
    --card: #12263a;
    --ink: #e6e0d4;
    --muted: #a3b2bd;
    --line: #223b52;
    --heading: #f2e8d5;
    --kicker: #e3a33b;
    --bubble-in: #0d1d2d;
    --link: #9ccbe0;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font: 17px/1.6 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 4px; }

code {
  font: 0.86em/1.4 var(--mono);
  background: color-mix(in srgb, var(--navy) 8%, transparent);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

h1, h2, h3 { font-family: var(--serif); font-optical-sizing: auto; color: var(--heading); margin: 0; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.12; font-weight: 600; letter-spacing: -0.01em; max-width: 26ch; }
h3 { font-size: 1.15rem; line-height: 1.3; font-weight: 600; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.skip { position: absolute; left: -9999px; top: 8px; background: var(--amber); color: #1d1a14; padding: 8px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.site {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--navy-deep) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(242, 232, 213, 0.08);
}
.bar { display: flex; align-items: center; gap: 28px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--cream); text-decoration: none; font-family: var(--serif); font-size: 1.3rem; font-weight: 600; }
.brand img { border-radius: 8px; }
.site nav { display: flex; gap: 22px; flex: 1; }
.site nav a, .labs { color: #c4d2dc; text-decoration: none; font-size: 0.92rem; }
.site nav a:hover, .labs:hover { color: var(--cream); }
.labs { border: 1px solid rgba(242, 232, 213, 0.25); padding: 5px 12px; border-radius: 999px; white-space: nowrap; }

@media (max-width: 860px) {
  .bar { flex-wrap: wrap; gap: 0 16px; padding-top: 10px; }
  .brand { flex: 1; }
  .site nav { order: 3; flex-basis: 100%; overflow-x: auto; padding: 10px 0 12px; gap: 18px; scrollbar-width: none; }
  .site nav::-webkit-scrollbar { display: none; }
  .site nav a { white-space: nowrap; }
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  color: var(--cream);
  background:
    radial-gradient(900px 500px at 85% 10%, rgba(127, 179, 200, 0.16), transparent 60%),
    radial-gradient(700px 400px at 10% 100%, rgba(227, 163, 59, 0.10), transparent 60%),
    linear-gradient(180deg, var(--navy-deep), var(--navy));
  padding: 80px 0 96px;
  overflow: hidden;
}
.hero::after {
  /* calm water along the bottom edge, from the logo's wave line */
  content: ""; position: absolute; left: 0; right: 0; bottom: 18px; height: 24px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='24' viewBox='0 0 80 24'%3E%3Cpath d='M0 12 q10 -7 20 0 t20 0 t20 0 t20 0' fill='none' stroke='%237FB3C8' stroke-opacity='.35' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x;
  pointer-events: none;
}
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 64px; align-items: center; }

.eyebrow { margin: 0 0 18px; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); font-weight: 600; }
.hero h1 { color: var(--cream); font-size: clamp(2.6rem, 6vw, 4.5rem); line-height: 1.02; font-weight: 600; letter-spacing: -0.02em; }
.hero h1 span { display: block; color: var(--sea); }
.lede { font-size: 1.14rem; line-height: 1.65; color: #cfdae2; margin: 24px 0 32px; max-width: 58ch; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn { display: inline-flex; align-items: center; padding: 12px 20px; border-radius: 10px; font-weight: 600; text-decoration: none; font-size: 0.98rem; }
.btn.primary { background: var(--amber); color: #1d1a14; }
.btn.primary:hover { background: #edb352; }
.btn.ghost { color: var(--cream); border: 1px solid rgba(242, 232, 213, 0.35); }
.btn.ghost:hover { border-color: var(--cream); }

.facts { list-style: none; padding: 0; margin: 44px 0 0; display: flex; flex-wrap: wrap; gap: 14px 40px; }
.facts li { display: flex; flex-direction: column; }
.facts b { font-family: var(--serif); font-size: 2rem; line-height: 1.1; color: var(--amber); font-weight: 600; }
.facts span { font-size: 0.86rem; color: #a9bccb; }

/* phone mock with a real exchange */
.phone {
  margin: 0;
  background: #0a1c2b;
  border: 1px solid rgba(242, 232, 213, 0.14);
  border-radius: 28px;
  padding: 18px 18px 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  max-width: 440px; justify-self: end; width: 100%;
}
.phone-top { display: flex; align-items: center; gap: 12px; padding: 4px 6px 14px; border-bottom: 1px solid rgba(242, 232, 213, 0.1); }
.phone-top img { border-radius: 10px; }
.phone-top b { display: block; color: var(--cream); font-size: 1rem; }
.phone-top span { font-size: 0.78rem; color: #8ea6b7; }
.thread { list-style: none; margin: 0; padding: 16px 2px 6px; display: flex; flex-direction: column; gap: 10px; }
.thread li { max-width: 86%; padding: 10px 13px; border-radius: 16px; font: 0.84rem/1.5 var(--mono); position: relative; overflow-wrap: anywhere; }
.thread .me { align-self: flex-end; background: var(--amber); color: #1d1a14; border-bottom-right-radius: 5px; font-weight: 600; }
.thread .them { align-self: flex-start; background: var(--cream); color: #142838; border-bottom-left-radius: 5px; padding-bottom: 22px; }
.len { position: absolute; right: 10px; bottom: 5px; font: 600 0.66rem/1 var(--sans); color: #6b7d89; letter-spacing: 0.02em; }
.phone figcaption { font-size: 0.76rem; color: #8ea6b7; padding: 10px 6px 0; }

@media (max-width: 900px) {
  .hero { padding: 56px 0 80px; }
  .hero-grid { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .phone { justify-self: start; }
}

/* ---------- sections ---------- */
.section { padding: 104px 0; }
.section.tint { background: var(--tint); }
.kicker { margin: 0 0 14px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--kicker); }
.headline { max-width: 30ch; }
.intro { max-width: 68ch; color: var(--muted); font-size: 1.06rem; margin: 18px 0 44px; }
.prose p { margin: 0 0 1.1em; max-width: 62ch; }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 64px; margin-top: 40px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); gap: 40px; } .section { padding: 76px 0; } }

.adds { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 28px 12px; }
.adds h3 { font-size: 1.25rem; margin-bottom: 8px; }
.adds dl { margin: 0; }
.adds dl div { padding: 16px 0; border-top: 1px solid var(--line); }
.adds dl div:first-child { border-top: 0; }
.adds dt { font-weight: 700; color: var(--heading); margin-bottom: 2px; }
.adds dd { margin: 0; color: var(--muted); font-size: 0.97rem; }

/* ---------- commands ---------- */
.cmds { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.cmd { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; }
.cmd.wide { grid-column: span 2; }
.cmd-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.cmd-head code { font-size: 0.95rem; background: var(--navy); color: var(--cream); padding: 4px 10px; border-radius: 7px; }
.cmd-head span { margin-left: auto; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.cmd p { margin: 0 0 16px; font-size: 0.97rem; }
.convo { margin-top: auto; background: var(--tint); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.section.tint .convo { background: var(--paper); }
.convo p { margin: 0; font: 0.82rem/1.5 var(--mono); padding: 8px 11px; border-radius: 12px; max-width: 92%; position: relative; overflow-wrap: anywhere; }
.convo .out { align-self: flex-end; background: var(--amber); color: #1d1a14; font-weight: 600; border-bottom-right-radius: 4px; }
.convo .in { align-self: flex-start; background: var(--card); border: 1px solid var(--line); border-bottom-left-radius: 4px; padding-right: 40px; }
.convo .in .len { color: var(--muted); }
.convo .pending { font-family: var(--sans); color: var(--muted); }
@media (max-width: 760px) { .cmds { grid-template-columns: minmax(0, 1fr); } .cmd.wide { grid-column: auto; } }

/* ---------- how it works ---------- */
.flow { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr) 44px minmax(0, 1fr); align-items: stretch; margin-bottom: 56px; }
.lane { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.lane-title { margin: 0 0 4px; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.node { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; }
.node b { display: block; color: var(--heading); font-size: 0.96rem; }
.node span { display: block; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.node.dashed { border-style: dashed; background: transparent; }
.node.accent { border-left: 4px solid var(--amber); }
.lane:last-child { display: grid; grid-template-columns: 1fr 1fr; align-content: start; }
.lane:last-child .lane-title { grid-column: 1 / -1; }
.arrow { position: relative; }
.arrow::before { content: ""; position: absolute; top: 50%; left: 8px; right: 12px; border-top: 2px solid var(--sea); }
.arrow::after { content: ""; position: absolute; top: calc(50% - 6px); right: 6px; border: 7px solid transparent; border-left: 9px solid var(--sea); border-right: 0; }
@media (max-width: 900px) {
  .flow { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 40px auto 40px auto; }
  .arrow::before { top: 6px; bottom: 12px; left: 50%; right: auto; border-top: 0; border-left: 2px solid var(--sea); }
  .arrow::after { top: auto; bottom: 4px; right: auto; left: calc(50% - 6px); border: 7px solid transparent; border-top: 9px solid var(--sea); border-bottom: 0; }
}

.steps { list-style: none; counter-reset: step; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px 36px; }
.steps li { counter-increment: step; position: relative; padding-left: 52px; font-size: 0.98rem; color: var(--muted); }
.steps li b { display: block; color: var(--ink); margin-bottom: 2px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -2px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 600; font-size: 1.05rem;
  color: var(--heading); background: color-mix(in srgb, var(--amber) 34%, var(--paper));
}

.aside-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 56px; }
.mini { border-top: 2px solid var(--heading); padding-top: 16px; }
.mini p { color: var(--muted); margin: 8px 0 0; font-size: 0.97rem; }
@media (max-width: 760px) { .aside-row { grid-template-columns: 1fr; } }

/* ---------- AI (dark band) ---------- */
.section.dark { background: linear-gradient(180deg, var(--navy), var(--navy-deep)); color: #d5dfe6; }
.section.dark h2, .section.dark h3 { color: var(--cream); }
.section.dark .kicker { color: var(--amber); }
.section.dark code { background: rgba(242, 232, 213, 0.1); color: var(--cream); }
.section.dark a { color: var(--sea); }
.tools { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 10px; }
.tools li { font-size: 0.93rem; color: #b9c8d3; padding-left: 14px; border-left: 2px solid rgba(127, 179, 200, 0.5); }
.tools code { margin-right: 6px; }
.rules { display: flex; flex-direction: column; gap: 14px; }
.rule { background: rgba(242, 232, 213, 0.05); border: 1px solid rgba(242, 232, 213, 0.12); border-radius: 14px; padding: 18px 20px; }
.rule p { margin: 6px 0 0; font-size: 0.95rem; color: #b9c8d3; }

/* ---------- library ---------- */
.stats { list-style: none; padding: 0; margin: 40px 0 56px; display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stats li { background: var(--card); padding: 22px 20px; display: flex; flex-direction: column; }
.stats b { font-family: var(--serif); font-size: 2.1rem; line-height: 1.1; color: var(--heading); font-weight: 600; }
.stats span { font-weight: 700; margin-top: 6px; }
.stats em { font-style: normal; color: var(--muted); font-size: 0.86rem; }
.shelves { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 32px 40px; }
.shelf h3 { margin-bottom: 6px; }
.shelf p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.fine { margin: 44px 0 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.93rem; max-width: 80ch; }

/* ---------- status ---------- */
.status-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 40px; }
.status-grid .col { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.status-grid h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.status-grid ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.96rem; }
.status-grid li { margin-bottom: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.ok { background: #2f9e57; }
.dot.next { background: var(--sea); }
.dot.warn { background: var(--amber); }
@media (max-width: 900px) { .status-grid { grid-template-columns: 1fr; } }

/* ---------- credits ---------- */
.credits { list-style: none; padding: 0; margin: 36px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 40px; }
.credits li { padding: 14px 0; border-top: 1px solid var(--line); font-weight: 600; }
.credits span { display: block; font-weight: 400; color: var(--muted); font-size: 0.92rem; }

/* ---------- footer ---------- */
.site-foot { background: var(--navy-deep); color: #a9bccb; padding: 36px 0; font-size: 0.9rem; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-brand img { border-radius: 7px; }
.site-foot p { margin: 0; }
.site-foot a { color: var(--cream); }

/* tool-call trace in the AI band */
.trace { margin: 32px 0 0; background: #07131e; border: 1px solid rgba(242, 232, 213, 0.12); border-radius: 14px; overflow: hidden; }
.trace figcaption { font-size: 0.78rem; color: #8ea6b7; padding: 10px 16px; border-bottom: 1px solid rgba(242, 232, 213, 0.08); }
.trace pre { margin: 0; padding: 14px 16px 16px; font: 0.78rem/1.6 var(--mono); color: #c4d2dc; overflow-x: auto; white-space: pre; }
.trace .q { color: var(--cream); font-weight: 600; }
.trace .t { color: var(--sea); }
.trace .a { color: var(--amber); }

/* 404 */
.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; }
.notfound img { border-radius: 16px; }
.notfound h1 { margin-top: 24px; }
.notfound .lede { margin-inline: auto; }
