/* =============================================================================
   My Goa 2.0 — design system ("editorial luxury")
   One stylesheet for the public site; the admin adds assets/css/admin.css on top.
   Fonts are self-hosted (Playfair Display + Inter, SIL OFL) — no third-party requests.
   ============================================================================= */

@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ---------------------------------------------------------------- */
:root {
  /* colour */
  --bg: #F7F4EE;
  --surface: #FFFFFF;
  --ink: #1B1B1B;
  --ink-2: #66615B;
  --line: #DDD7CD;
  --line-strong: #C4BCAD;
  --accent: #A2262C;
  --accent-hover: #861E23;
  --accent-ink: #FFFFFF;
  --paper: #EFE9DE;
  --ok: #2F6B3C;
  --ok-bg: #EEF5EE;
  --warn: #8A5A12;
  --warn-bg: #FBF3E1;
  --err: #A2262C;
  --err-bg: #FBEDED;

  /* type */
  --font-display: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* spacing (4px base) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  /* layout */
  --container: 1240px;
  --gutter: 20px;
  --header-h: 68px;

  /* shape + motion */
  --radius: 2px;
  --ease: cubic-bezier(.2, .6, .2, 1);
  --t-fast: .18s;
  --t-med: .35s;
  --shadow-cover: 0 1px 2px rgba(40, 28, 14, .10), 0 18px 36px -22px rgba(40, 28, 14, .45);
  --shadow-cover-hover: 0 2px 4px rgba(40, 28, 14, .12), 0 26px 44px -22px rgba(40, 28, 14, .5);
}
@media (min-width: 720px)  { :root { --gutter: 32px; --header-h: 76px; } }
@media (min-width: 1100px) { :root { --gutter: 48px; } }

/* ---- Base ------------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
main { flex: 1 0 auto; }
img, svg { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: .22em; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: rgba(0,0,0,.05); padding: .1em .35em; border-radius: 3px; word-break: break-all; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }

/* focus: always visible, never colour-only */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s-4); top: -100px; z-index: 1000; background: var(--ink); color: #fff; padding: var(--s-3) var(--s-4); text-decoration: none; }
.skip-link:focus { top: var(--s-4); }

/* ---- Typography ------------------------------------------------------------ */
.display { font-family: var(--font-display); font-weight: 500; line-height: 1.12; letter-spacing: -.01em; font-size: clamp(2rem, 1.3rem + 2.6vw, 3.25rem); text-wrap: balance; }
.display--xl { font-size: clamp(2.25rem, 1.1rem + 4.6vw, 4.6rem); line-height: 1.04; letter-spacing: -.018em; }
.display--md { font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem); }
.eyebrow { font-size: .75rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); display: flex; align-items: center; flex-wrap: wrap; gap: var(--s-2); }
.eyebrow-sep { display: inline-block; width: 28px; height: 1px; background: currentColor; opacity: .6; }
.lede { font-size: 1.0625rem; line-height: 1.65; color: var(--ink-2); max-width: 38em; }
@media (min-width: 720px) { .lede { font-size: 1.1875rem; } }
.meta { font-size: .8125rem; color: var(--ink-2); letter-spacing: .02em; }
.hint { font-size: .8125rem; color: var(--ink-2); margin-top: var(--s-2); }
.section-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.1rem); line-height: 1.15; }

/* ---- Buttons + links ------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 48px; padding: 0 var(--s-5);
  font-size: .8125rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--ink); border-radius: var(--radius); background: transparent; color: var(--ink); cursor: pointer;
  transition: background-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.btn:hover { background: var(--ink); color: #fff; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-sm { min-height: 40px; padding: 0 var(--s-4); font-size: .75rem; }
.btn-lg { min-height: 56px; padding: 0 var(--s-6); }
.btn-block { width: 100%; }
.btn[disabled], .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; color: var(--ink); }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3) var(--s-4); margin-top: var(--s-6); }
.link-arrow { font-size: .8125rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-decoration: none; display: inline-flex; align-items: center; gap: var(--s-2); min-height: 44px; border-bottom: 1px solid transparent; }
.link-arrow::after { content: "\2192"; transition: transform var(--t-fast) var(--ease); }
.link-arrow:hover { color: var(--accent); }
.link-arrow:hover::after { transform: translateX(4px); }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: .22em; }

/* ---- Header ---------------------------------------------------------------- */
.site-header { position: relative; z-index: 50; background: var(--bg); border-bottom: 1px solid var(--line); }
.header-inner { min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.brand { display: inline-flex; align-items: center; }
.brand img { height: 46px; width: auto; mix-blend-mode: multiply; } /* logo is a JPG on white: multiply melts it into the cream */
.site-nav { display: flex; align-items: center; gap: var(--s-6); }
.site-nav a { position: relative; font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; padding: var(--s-3) 0; }
.site-nav a::after { content: ""; position: absolute; left: 0; bottom: 6px; width: 100%; height: 1px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform var(--t-med) var(--ease); }
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.nav-toggle { display: none; width: 48px; height: 48px; margin-right: -12px; background: none; border: 0; cursor: pointer; position: relative; }
.nav-toggle-bars, .nav-toggle-bars::before, .nav-toggle-bars::after { content: ""; position: absolute; left: 14px; right: 14px; height: 2px; background: var(--ink); transition: transform var(--t-fast) var(--ease), opacity var(--t-fast); }
.nav-toggle-bars { top: 23px; }
.nav-toggle-bars::before { left: 0; right: 0; top: -7px; }
.nav-toggle-bars::after { left: 0; right: 0; top: 7px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after { transform: translateY(-7px) rotate(-45deg); }
@media (max-width: 719px) {
  .brand img { height: 40px; }
  .js .nav-toggle { display: block; }
  .js .site-nav { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: var(--s-2) var(--gutter) var(--s-4); }
  .js .site-nav.is-open { display: flex; }
  .js .site-nav a { padding: var(--s-4) 0; border-top: 1px solid var(--line); font-size: .8125rem; }
  .js .site-nav a:first-child { border-top: 0; }
  .js .site-nav a::after { display: none; }
  .js .site-nav a[aria-current="page"] { color: var(--accent); }
  .site-nav { gap: var(--s-5); flex-wrap: wrap; justify-content: flex-end; } /* no-JS: simply show the links */
}

/* ---- Cover frames (never stretch, never crop) ------------------------------ */
.cover-frame { display: block; background: var(--paper); box-shadow: var(--shadow-cover); transition: transform var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease); }
.cover-frame img { display: block; width: 100%; height: auto; }
.cover-missing { aspect-ratio: 3 / 4; display: grid; place-items: center; text-align: center; padding: var(--s-4); color: var(--ink-2); font-family: var(--font-display); font-size: 1.1rem; border: 1px dashed var(--line-strong); box-shadow: none; }

/* ---- Hero ------------------------------------------------------------------ */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-7); padding-block: var(--s-7) var(--s-8); align-items: center; }
.hero-cover { display: block; text-decoration: none; justify-self: center; width: min(78vw, 360px); order: -1; }
.hero-cover:hover .cover-frame { transform: translateY(-4px); box-shadow: var(--shadow-cover-hover); }
.hero-copy .display { margin-top: var(--s-4); }
.hero-copy .lede { margin-top: var(--s-5); }
.hero--empty { padding-block: var(--s-9); }
@media (min-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr); gap: var(--s-8); padding-block: var(--s-8) var(--s-9); }
  .hero-cover { order: 0; width: 100%; max-width: 460px; justify-self: end; }
}
@media (min-width: 1280px) { .hero { gap: 96px; } .hero-cover { max-width: 500px; } }

/* ---- Sections + grids ------------------------------------------------------ */
.section { padding-block: var(--s-7) var(--s-9); border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--s-3) var(--s-5); margin-bottom: var(--s-6); }
.issue-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-6) var(--s-4); }
@media (min-width: 720px)  { .issue-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-7) var(--s-5); } }
@media (min-width: 1100px) { .issue-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-7) var(--s-6); } }
.issue-card-link { display: block; text-decoration: none; }
.issue-card-link:hover .cover-frame, .issue-card-link:focus-visible .cover-frame { transform: translateY(-4px); box-shadow: var(--shadow-cover-hover); }
.issue-card-meta { display: block; margin-top: var(--s-4); }
.issue-card-month { display: block; font-size: .6875rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.issue-card-title { display: block; margin-top: var(--s-1); font-family: var(--font-display); font-size: 1.0625rem; line-height: 1.3; text-wrap: balance; }
.issue-card-link:hover .issue-card-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; }

/* ---- Archive page ---------------------------------------------------------- */
.breadcrumb { padding-block: var(--s-5) 0; font-size: .8125rem; color: var(--ink-2); }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-1) 0; }
.breadcrumb li + li::before { content: "/"; margin-inline: var(--s-2); color: var(--line-strong); }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.page-head { padding-block: var(--s-6) var(--s-6); }
.page-head .display { margin-top: var(--s-3); }
.page-head .lede { margin-top: var(--s-3); }
.archive-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-4); border-block: 1px solid var(--line); margin-bottom: var(--s-6); }
.year-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.chip { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--s-4); border: 1px solid var(--line-strong); border-radius: 999px; font-size: .8125rem; font-weight: 500; text-decoration: none; transition: background-color var(--t-fast), color var(--t-fast); }
.chip:hover { border-color: var(--ink); }
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.search-field { display: flex; gap: var(--s-2); flex: 1 1 260px; max-width: 420px; }
.year-group { margin-bottom: var(--s-8); }
.year-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); line-height: 1; color: var(--ink); padding-bottom: var(--s-4); margin-bottom: var(--s-5); border-bottom: 1px solid var(--line); }
.empty { text-align: center; padding: var(--s-9) var(--s-4); color: var(--ink-2); }
.empty h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; color: var(--ink); margin-bottom: var(--s-2); }
.empty--inline { padding: var(--s-6) 0; text-align: left; }

/* ---- Forms (shared with admin) --------------------------------------------- */
.field { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-5); min-width: 0; }
.field label, .label { font-size: .8125rem; font-weight: 600; letter-spacing: .02em; }
.input { width: 100%; min-height: 48px; padding: var(--s-3) var(--s-4); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); color: var(--ink); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 40px; }
.input:hover { border-color: var(--ink-2); }
.input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type="file"].input { padding: var(--s-3); min-height: 52px; }
.search-field .input { min-height: 44px; }

/* ---- Notices / badges ------------------------------------------------------ */
.notice { padding: var(--s-4) var(--s-5); border-left: 3px solid var(--line-strong); background: var(--surface); margin-block: var(--s-4); font-size: .9375rem; }
.notice ul { margin: var(--s-2) 0 0; padding-left: 1.2em; }
.notice-ok { border-color: var(--ok); background: var(--ok-bg); }
.notice-warn { border-color: var(--warn); background: var(--warn-bg); }
.notice-err { border-color: var(--err); background: var(--err-bg); }
.notice-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.badge { display: inline-block; padding: 2px 8px; border: 1px solid var(--accent); border-radius: 999px; font-size: .6875rem; letter-spacing: .1em; }
.badge-draft { border-color: var(--warn); color: var(--warn); }

/* ---- Issue page ------------------------------------------------------------ */
.issue-intro { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-6); padding-block: var(--s-6) var(--s-7); align-items: start; }
.issue-intro-cover { width: min(70vw, 320px); justify-self: center; }
.issue-intro-copy .display { margin-top: var(--s-3); }
.issue-intro-copy .lede { margin-top: var(--s-4); }
.share-status { min-height: 1.5em; margin-top: var(--s-3); font-size: .875rem; color: var(--ok); }
@media (min-width: 800px) {
  .issue-intro { grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: var(--s-8); padding-block: var(--s-6) var(--s-8); }
  .issue-intro-cover { width: 100%; justify-self: start; position: sticky; top: var(--s-5); }
}
@media (min-width: 1100px) { .issue-intro { grid-template-columns: minmax(0, 400px) minmax(0, 1fr); } }

.reader-section { padding-bottom: var(--s-7); scroll-margin-top: var(--s-4); }
.reader { position: relative; background: var(--paper); border: 1px solid var(--line); }
.reader-stage { position: relative; width: 100%; height: clamp(460px, 76vh, 860px); overflow: hidden; }
.reader-poster { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s-5); padding: var(--s-5); text-align: center; }
.reader-poster img { max-height: 58%; width: auto; max-width: 70%; box-shadow: var(--shadow-cover); }
.reader-poster-cta { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); }
.reader-stage.is-loading .reader-poster-cta .btn { pointer-events: none; opacity: .6; }
.reader-status { padding: 0 var(--s-4); }
.reader-status:not(:empty) { padding: var(--s-4); border-top: 1px solid var(--line); background: var(--surface); font-size: .9375rem; }
.reader-status .btn { margin: var(--s-2) var(--s-2) 0 0; }
.reader-help { margin-top: var(--s-4); }
.reader-help a { text-decoration: underline; }
@media (max-width: 719px) {
  .reader-section { margin-inline: calc(-1 * var(--gutter)); }
  .reader { border-inline: 0; }
  .reader-stage { height: clamp(440px, 72svh, 720px); }
  .reader-help { padding-inline: var(--gutter); }
}
.preview-bar { background: var(--warn-bg); border-bottom: 1px solid var(--warn); font-size: .875rem; padding: var(--s-3) 0; }
.preview-bar a { margin-left: var(--s-3); }

.issue-pager { display: grid; grid-template-columns: 1fr; gap: var(--s-5); padding-block: var(--s-6) var(--s-9); border-top: 1px solid var(--line); text-align: center; }
.issue-pager a { text-decoration: none; }
.issue-pager-side a { display: inline-flex; flex-direction: column; gap: 2px; padding: var(--s-2) 0; }
.pager-title { font-family: var(--font-display); font-size: 1.25rem; }
.issue-pager-side a:hover .pager-title { color: var(--accent); }
@media (min-width: 720px) {
  .issue-pager { grid-template-columns: 1fr auto 1fr; align-items: center; text-align: left; }
  .issue-pager-side--next { text-align: right; }
  .issue-pager-side--next a { align-items: flex-end; }
}

/* ---- Footer ---------------------------------------------------------------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--line); padding-block: var(--s-7); }
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: var(--s-4); text-align: center; }
.brand--footer img { height: 40px; }
.footer-nav { display: flex; gap: var(--s-5); flex-wrap: wrap; justify-content: center; }
.footer-nav a { font-size: .75rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; text-decoration: none; padding: var(--s-2) 0; }
.footer-nav a:hover { color: var(--accent); }
.footer-copy { font-size: .8125rem; color: var(--ink-2); }
@media (min-width: 720px) {
  .footer-inner { flex-direction: row; justify-content: space-between; text-align: left; }
}

/* ---- Error pages ----------------------------------------------------------- */
.error-page { padding-block: var(--s-9); max-width: 760px; }
.error-page .display { margin-top: var(--s-3); }
.error-page .lede { margin-top: var(--s-4); }
.error-page .meta { margin-top: var(--s-6); }

/* ---- Motion preferences ---------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; scroll-behavior: auto !important; }
  .cover-frame, .issue-card-link:hover .cover-frame, .hero-cover:hover .cover-frame { transform: none !important; }
}
/* Issue page, narrow phones: Read / Download / Share share one full-width column so the edges line up. */
@media (max-width: 479px) { .issue-intro .button-row > .btn { flex: 1 1 100%; } }
@media print { .site-header, .site-footer, .reader, .button-row { display: none; } }
