/* boatbuildlog.com
 *
 * The visual world is the shop drawing, not the yacht club: lofting tables,
 * chalk lines, blueprints, marine ply. Deliberately not navy-and-rope coastal
 * nautical.
 *
 * System fonts only, by choice -- these pages get read on a phone in a shed
 * with two bars of signal, and a webfont round-trip is the wrong tax. Georgia
 * carries the long-form entry prose; a condensed stack does title-block work.
 */

:root {
  --paper:        #f7f6f3;
  --paper-raised: #ffffff;
  --paper-sunk:   #efede8;
  --ink:          #1c2024;
  --ink-soft:     #43474d;
  --muted:        #6e6b66;
  --rule:         #d9d5cc;
  --rule-strong:  #bdb8ac;
  --chalk:        #a6402f;   /* chalk-line red -- the one loud thing */
  --chalk-soft:   #f0e2de;
  --blueprint:    #3e5c76;   /* data, phases, timeline */
  --blueprint-soft: #e3e9ef;
  --good:         #4a6b46;
  --warn:         #8a6a1f;

  --measure: 66ch;
  --radius: 2px;

  --font-display: "Helvetica Neue", "Arial Nova", Inter, system-ui, sans-serif;
  --font-body: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-data: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:        #14161a;
    --paper-raised: #1b1e23;
    --paper-sunk:   #101216;
    --ink:          #e8e6e1;
    --ink-soft:     #bdb9b2;
    --muted:        #8d8880;
    --rule:         #2c3037;
    --rule-strong:  #3d424b;
    --chalk:        #d97965;
    --chalk-soft:   #33211d;
    --blueprint:    #8fb3d1;
    --blueprint-soft: #1c2530;
    --good:         #8fbb88;
    --warn:         #d4b264;
  }
}

:root[data-theme="dark"] {
  --paper:        #14161a;
  --paper-raised: #1b1e23;
  --paper-sunk:   #101216;
  --ink:          #e8e6e1;
  --ink-soft:     #bdb9b2;
  --muted:        #8d8880;
  --rule:         #2c3037;
  --rule-strong:  #3d424b;
  --chalk:        #d97965;
  --chalk-soft:   #33211d;
  --blueprint:    #8fb3d1;
  --blueprint-soft: #1c2530;
  --good:         #8fbb88;
  --warn:         #d4b264;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  overflow-x: hidden;
}

a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--chalk); }

:focus-visible { outline: 2px solid var(--chalk); outline-offset: 2px; border-radius: var(--radius); }

img { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.6rem); line-height: 1.1; }
h2 { font-size: 1.35rem; line-height: 1.2; }
h3 { font-size: 1.08rem; }

/* Title-block label: the small stencilled caption on a drawing sheet. */
.label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.data { font-family: var(--font-data); font-variant-numeric: tabular-nums; }

.wrap { width: min(100% - 2rem, 68rem); margin-inline: auto; }
.wrap-narrow { width: min(100% - 2rem, 46rem); margin-inline: auto; }

.stack { display: flex; flex-direction: column; }
.stack-sm { gap: 0.5rem; } .stack-md { gap: 1rem; }
.stack-lg { gap: 1.75rem; } .stack-xl { gap: 3rem; }
.row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.push { margin-left: auto; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* --- masthead ------------------------------------------------------------ */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-raised);
  position: sticky; top: 0; z-index: 20;
}
.masthead .wrap { display: flex; align-items: center; gap: 1.25rem; min-height: 3.6rem; }

.wordmark {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  display: inline-flex; align-items: baseline; gap: 0.1rem;
  white-space: nowrap;
}
.wordmark .mark-rule { color: var(--chalk); }

.nav { display: flex; gap: 1.1rem; align-items: center; font-size: 0.9rem; }
.nav a { text-decoration: none; color: var(--ink-soft); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--chalk); }

@media (max-width: 44rem) {
  .nav-secondary { display: none; }
}

/* --- buttons ------------------------------------------------------------- */

.btn {
  font-family: var(--font-ui);
  font-size: 0.9rem; font-weight: 600;
  padding: 0.55rem 0.95rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 0.4rem;
  line-height: 1.2;
}
.btn:hover { border-color: var(--ink-soft); }
.btn-primary { background: var(--chalk); border-color: var(--chalk); color: #fff; }
:root[data-theme="dark"] .btn-primary,
:root:not([data-theme="light"]) .btn-primary { color: #1a1113; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .btn-primary { color: #fff; } }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { font-size: 0.8rem; padding: 0.35rem 0.6rem; }
.btn-danger { color: var(--chalk); }

/* --- forms --------------------------------------------------------------- */

label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.3rem; }
.hint { font-size: 0.8rem; color: var(--muted); font-weight: 400; margin-top: 0.25rem; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[type=url], input[type=search], select, textarea {
  width: 100%;
  font: inherit; font-size: 1rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
}
textarea { min-height: 9rem; resize: vertical; font-family: var(--font-body); line-height: 1.6; }
input:focus, select:focus, textarea:focus { border-color: var(--chalk); outline: none; box-shadow: 0 0 0 3px var(--chalk-soft); }

.field { margin-bottom: 1.1rem; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 1rem; }

.errors {
  border-left: 3px solid var(--chalk);
  background: var(--chalk-soft);
  padding: 0.75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1.25rem; font-size: 0.9rem;
}
.errors ul { margin: 0; padding-left: 1.1rem; }

.flash {
  border-left: 3px solid var(--good);
  background: var(--paper-sunk);
  padding: 0.75rem 1rem; border-radius: var(--radius);
  margin-bottom: 1.5rem; font-size: 0.92rem;
}

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* --- cards / grids ------------------------------------------------------- */

.grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  text-decoration: none;
}
.card:hover { border-color: var(--rule-strong); }
.card-media { aspect-ratio: 4 / 3; background: var(--paper-sunk); overflow: hidden; }
.card-media img { width: 100%; height: 100%; object-fit: cover; }
.card-media.empty {
  display: grid; place-items: center;
  color: var(--rule-strong);
  background:
    repeating-linear-gradient(45deg, transparent 0 8px, var(--paper-sunk) 8px 16px),
    var(--paper-raised);
}
.card-body { padding: 0.85rem 0.95rem 1rem; display: flex; flex-direction: column; gap: 0.3rem; }
.card-title { font-family: var(--font-display); font-weight: 700; font-size: 1rem; letter-spacing: -0.01em; }

/* --- status pills -------------------------------------------------------- */

.pill {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.2rem 0.5rem; border-radius: 999px;
  border: 1px solid var(--rule-strong); color: var(--muted);
  white-space: nowrap;
}
.pill-live { border-color: var(--good); color: var(--good); }
.pill-draft { border-color: var(--rule-strong); color: var(--muted); }
.pill-pending { border-color: var(--warn); color: var(--warn); }
.pill-rejected { border-color: var(--chalk); color: var(--chalk); }
.pill-phase { border-color: var(--blueprint); color: var(--blueprint); background: var(--blueprint-soft); text-transform: none; letter-spacing: 0.02em; font-weight: 600; }

/* --- stat strip ---------------------------------------------------------- */

.stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr));
  border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--paper-raised);
  overflow: hidden;
}
.stat { padding: 0.8rem 0.9rem; border-right: 1px solid var(--rule); }
.stat:last-child { border-right: 0; }
.stat-value { font-family: var(--font-data); font-size: 1.35rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); margin-top: 0.2rem; }

/* --- the log ------------------------------------------------------------- */

.log { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
@media (min-width: 60rem) {
  .log { grid-template-columns: 8.5rem minmax(0, 1fr); gap: 2rem; align-items: start; }
}

.timeline { display: none; }
@media (min-width: 60rem) {
  .timeline {
    display: block; position: sticky; top: 5rem;
    font-size: 0.8rem; max-height: calc(100vh - 7rem); overflow-y: auto;
    border-left: 1px solid var(--rule); padding-left: 0.85rem;
  }
  .timeline a { display: block; text-decoration: none; color: var(--muted); padding: 0.12rem 0; }
  .timeline a:hover { color: var(--chalk); }
  .timeline .tl-month { font-family: var(--font-data); font-variant-numeric: tabular-nums; }
  .timeline .tl-phase { font-weight: 600; color: var(--blueprint); margin-top: 0.5rem; font-size: 0.72rem;
                        text-transform: uppercase; letter-spacing: 0.08em; }
}

.entry {
  border-top: 1px solid var(--rule);
  padding: 2rem 0;
  scroll-margin-top: 5rem;
}
.entry:first-child { border-top: 0; }

.entry-head { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.65rem; }
.entry-date {
  font-family: var(--font-data); font-variant-numeric: tabular-nums;
  font-size: 0.85rem; color: var(--chalk); font-weight: 600;
}
.entry-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; }

.prose { font-family: var(--font-body); font-size: 1.02rem; line-height: 1.7; max-width: var(--measure); color: var(--ink-soft); }
.prose p { margin: 0 0 0.9rem; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 0 0 0.9rem; padding-left: 1.3rem; }
.prose a { color: var(--chalk); }
.prose code { font-family: var(--font-data); font-size: 0.9em; background: var(--paper-sunk); padding: 0.1em 0.3em; border-radius: var(--radius); }
.prose blockquote { margin: 0 0 0.9rem; padding-left: 0.9rem; border-left: 2px solid var(--rule-strong); color: var(--muted); }

/* Photo grid: the first photo of an entry gets the room it deserves. */
.photos { display: grid; gap: 0.5rem; margin-top: 1rem; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
.photos.count-1 { grid-template-columns: minmax(0, 1fr); max-width: 42rem; }
.photos.count-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 42rem; }
.photo { display: block; border-radius: var(--radius); overflow: hidden; background: var(--paper-sunk); border: 1px solid var(--rule); }
.photo img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photos.count-1 .photo img { aspect-ratio: auto; max-height: 34rem; object-fit: contain; }
.photo figcaption { font-size: 0.78rem; color: var(--muted); padding: 0.35rem 0.5rem; }

.embed { position: relative; aspect-ratio: 16 / 9; margin-top: 1rem; max-width: 42rem; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* --- phase chips --------------------------------------------------------- */

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font-size: 0.78rem; padding: 0.3rem 0.6rem;
  border: 1px solid var(--rule-strong); border-radius: 999px;
  text-decoration: none; color: var(--ink-soft); background: var(--paper-raised);
  cursor: pointer;
}
.chip:hover { border-color: var(--blueprint); color: var(--blueprint); }
.chip[aria-pressed="true"], .chip.active {
  background: var(--blueprint); border-color: var(--blueprint); color: var(--paper-raised);
}

/* --- comparison ---------------------------------------------------------- */

.compare-col { border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-raised); padding: 1rem; }
.compare-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); }

/* --- tables -------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.55rem 0.7rem; border-bottom: 1px solid var(--rule); }
th { font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
td.num, th.num { text-align: right; font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* --- spec sheet ---------------------------------------------------------- */

.spec { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; font-size: 0.9rem; }
.spec dt { color: var(--muted); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.spec dd { margin: 0; font-family: var(--font-data); font-variant-numeric: tabular-nums; }

/* --- hero ---------------------------------------------------------------- */

.hero { padding: 3.5rem 0 2.5rem; border-bottom: 1px solid var(--rule); }
.hero h1 { max-width: 18ch; }
.hero-lede { font-family: var(--font-body); font-size: 1.15rem; line-height: 1.6; color: var(--ink-soft); max-width: 52ch; margin-top: 0.9rem; }

/* --- footer -------------------------------------------------------------- */

.foot { border-top: 1px solid var(--rule); margin-top: 4rem; padding: 2rem 0 3rem; font-size: 0.85rem; color: var(--muted); }
.foot a { color: var(--muted); }

/* --- composer ------------------------------------------------------------ */

.composer-photos { display: grid; gap: 0.5rem; grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr)); margin-top: 0.6rem; }
.composer-photos figure { margin: 0; position: relative; }
.composer-photos img { aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--rule); }

.dropzone {
  border: 2px dashed var(--rule-strong); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; color: var(--muted);
  background: var(--paper-sunk); cursor: pointer;
}
.dropzone:hover, .dropzone.over { border-color: var(--chalk); color: var(--chalk); }

/* --- print: the build book ----------------------------------------------- */

@media print {
  :root { --paper: #fff; --paper-raised: #fff; --ink: #000; --ink-soft: #222; --muted: #555; --rule: #ccc; }
  .masthead, .foot, .timeline, .btn, .chips, .no-print, form { display: none !important; }
  body { font-size: 11pt; }
  .wrap, .wrap-narrow { width: auto; margin: 0; }
  .log { display: block; }
  .entry { page-break-inside: avoid; border-top: 1px solid #ccc; padding: 0.6rem 0; }
  .photos { grid-template-columns: repeat(3, 1fr); }
  .photo img { aspect-ratio: 4/3; }
  a { text-decoration: none; color: #000; }
  .prose { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
