/* ————————————————————————————————————————————————————————————
   Casita Pilsen — design system
   An editorial microsite for a restored 1800s workers' cottage.
   Typography pair: Cormorant Garamond (display) + EB Garamond (body)
   with Courier Prime for small marks.
   ———————————————————————————————————————————————————————————— */

:root {
  /* Color — warm plaster, deep ink, brick accent */
  --bg: #f5f1ea;
  --bg-elev: #ece6d6;
  --bg-sunk: #e4ddca;
  --fg: #1c1a16;
  --fg-muted: #635d53;
  --fg-faint: #8a8275;
  --rule: #c7bfae;
  --accent: #8b3a1f;
  --accent-soft: #c76a46;

  /* Type */
  --f-display: "Cormorant Garamond", "Palatino Linotype", Georgia, serif;
  --f-body: "EB Garamond", "Iowan Old Style", Georgia, serif;
  --f-mark: "Courier Prime", ui-monospace, Menlo, Consolas, monospace;

  /* Scale */
  --size-mark: 11px;
  --size-body: 18px;
  --size-lead: 21px;
  --size-h3: 22px;
  --size-h2: clamp(26px, 3vw, 34px);
  --size-h1: clamp(40px, 6vw, 64px);
  --size-display: clamp(52px, 9vw, 96px);

  /* Spacing — rough 8pt grid */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 16px;
  --s-4: 24px;
  --s-5: 32px;
  --s-6: 48px;
  --s-7: 64px;
  --s-8: 96px;
  --s-9: 128px;

  /* Layout */
  --measure: 62ch;
  --page-max: 1120px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15130f;
    --bg-elev: #1e1b16;
    --bg-sunk: #0f0d0a;
    --fg: #ece4d3;
    --fg-muted: #a39b89;
    --fg-faint: #78715f;
    --rule: #3a342a;
    --accent: #e08b65;
    --accent-soft: #c76a46;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15130f;
  --bg-elev: #1e1b16;
  --bg-sunk: #0f0d0a;
  --fg: #ece4d3;
  --fg-muted: #a39b89;
  --fg-faint: #78715f;
  --rule: #3a342a;
  --accent: #e08b65;
  --accent-soft: #c76a46;
  color-scheme: dark;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: var(--size-body);
  line-height: 1.55;
  font-feature-settings: "liga", "kern", "onum";
  -webkit-font-smoothing: antialiased;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}

img { max-width: 100%; display: block; }
hr { border: none; height: 1px; background: var(--rule); margin: 0; }

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 160ms ease;
}
a:hover { border-bottom-color: var(--accent); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ———————————————— Typography ———————————————— */

.mark {
  font-family: var(--f-mark);
  font-size: var(--size-mark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  color: var(--fg);
  text-wrap: balance;
  letter-spacing: -0.005em;
  margin: 0;
}

h1 { font-size: var(--size-h1); line-height: 1.05; }
h2 { font-size: var(--size-h2); line-height: 1.15; margin-top: var(--s-7); margin-bottom: var(--s-3); }
h3 { font-size: var(--size-h3); line-height: 1.3; font-style: italic; color: var(--fg); margin-top: var(--s-5); margin-bottom: var(--s-2); }

h2:first-child, h3:first-child { margin-top: 0; }

.display {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: var(--size-display);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.standfirst {
  font-family: var(--f-display);
  font-style: italic;
  font-weight: 400;
  font-size: var(--size-lead);
  line-height: 1.4;
  color: var(--fg-muted);
  max-width: 48ch;
  text-wrap: balance;
}

p { margin: 0 0 var(--s-3); max-width: var(--measure); }
p + p { margin-top: 0; }

p.lead {
  font-size: var(--size-lead);
  color: var(--fg-muted);
  margin-bottom: var(--s-5);
}

em { font-style: italic; color: var(--fg); }

/* ———————————————— Layout ———————————————— */

.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-block: var(--s-6) var(--s-8);
}

.measure {
  max-width: var(--measure);
}

.stack > * + * { margin-top: var(--s-4); }
.stack-tight > * + * { margin-top: var(--s-2); }
.stack-loose > * + * { margin-top: var(--s-6); }

.band {
  padding-block: var(--s-8);
  border-top: 1px solid var(--rule);
}

.band + .band { border-top: 1px solid var(--rule); }

/* ———————————————— Nav ———————————————— */

.site-nav {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-4);
  padding-block: var(--s-4);
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}

.wordmark {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.wordmark a { color: var(--fg); border-bottom: none; }

.site-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: var(--s-5);
  flex-wrap: wrap;
}

.site-nav a {
  font-family: var(--f-mark);
  font-size: var(--size-mark);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  border-bottom: none;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--accent);
}

/* ———————————————— Hero ———————————————— */

.hero {
  padding-block: var(--s-9) var(--s-7);
  display: grid;
  gap: var(--s-5);
}

.hero .eyebrow {
  font-family: var(--f-mark);
  font-size: var(--size-mark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
}

.hero h1 {
  max-width: 14ch;
}

/* ———————————————— Unit cards ———————————————— */

.units {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--s-5);
  margin-top: var(--s-5);
}

.unit {
  display: flex;
  flex-direction: column;
  padding: var(--s-5);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  min-width: 0;
}

.unit .mark { margin-bottom: var(--s-2); }

.unit h3 {
  font-style: normal;
  font-size: 28px;
  margin: 0 0 var(--s-2);
}

.unit p { font-size: 16px; color: var(--fg-muted); margin-bottom: var(--s-4); }

.unit .btn { margin-top: auto; align-self: flex-start; }

.unit.coming { opacity: 0.68; }

/* ———————————————— Buttons ———————————————— */

.btn {
  display: inline-block;
  font-family: var(--f-mark);
  font-size: var(--size-mark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  padding: var(--s-3) var(--s-4);
  background: var(--fg);
  color: var(--bg);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 160ms ease;
}
.btn:hover { background: var(--accent); border-bottom: none; }
.btn.ghost { background: transparent; color: var(--fg); border: 1px solid var(--rule); }
.btn.ghost:hover { background: var(--fg); color: var(--bg); border-color: var(--fg); }

/* ———————————————— Pull-quote / detail blocks ———————————————— */

.detail-grid {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: var(--s-5);
  padding-block: var(--s-4);
  border-top: 1px solid var(--rule);
  align-items: baseline;
}
.detail-grid:last-of-type { border-bottom: 1px solid var(--rule); }

.detail-grid .label {
  font-family: var(--f-mark);
  font-size: var(--size-mark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-faint);
}

.detail-grid .value {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 22px;
  color: var(--fg);
  font-style: italic;
}

.detail-grid .value small {
  display: block;
  font-family: var(--f-body);
  font-style: normal;
  font-size: 15px;
  color: var(--fg-muted);
  margin-top: var(--s-1);
  font-weight: 400;
}

@media (max-width: 640px) {
  .detail-grid { grid-template-columns: 1fr; gap: var(--s-2); }
}

/* ———————————————— Timeline (for The House) ———————————————— */

.timeline {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: var(--s-5);
  padding: var(--s-5) 0;
  border-top: 1px solid var(--rule);
}
.timeline:last-of-type { border-bottom: 1px solid var(--rule); }

.timeline .year {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 32px;
  color: var(--accent);
  line-height: 1;
}

.timeline .event { max-width: var(--measure); }
.timeline .event p { margin-bottom: var(--s-2); font-size: 17px; }
.timeline .event p:last-child { margin-bottom: 0; }

@media (max-width: 640px) {
  .timeline { grid-template-columns: 1fr; gap: var(--s-2); }
  .timeline .year { font-size: 24px; }
}

/* ———————————————— Footer ———————————————— */

.site-foot {
  padding-block: var(--s-7) var(--s-6);
  border-top: 1px solid var(--rule);
  display: grid;
  gap: var(--s-3);
}

.site-foot .mark { color: var(--fg-faint); }
.site-foot .mark a { color: var(--fg-muted); border-bottom: none; }
.site-foot .mark a:hover { color: var(--accent); }

.site-foot .contact {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 20px;
  color: var(--fg);
  max-width: 36ch;
}

/* ———————————————— Page intro (for sub-pages) ———————————————— */

.page-head {
  padding-block: var(--s-7) var(--s-6);
  border-bottom: 1px solid var(--rule);
}

.page-head .mark { display: block; margin-bottom: var(--s-3); color: var(--accent); }
.page-head h1 { font-size: var(--size-h1); max-width: 18ch; margin-bottom: var(--s-4); }

/* Prose sections inside long-form pages */
.prose {
  max-width: var(--measure);
  padding-block: var(--s-6);
}

.prose h2 { font-style: italic; font-weight: 500; }
.prose h2 .n {
  font-family: var(--f-mark);
  font-style: normal;
  font-size: var(--size-mark);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent);
  display: block;
  margin-bottom: var(--s-2);
  font-weight: 500;
}

.prose p { margin-bottom: var(--s-4); }
