/* =========================================================
   PINNED — Design System
   A publication about the patterns history leaves behind.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Great+Vibes&family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=EB+Garamond:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  /* -- Paper & ink -------------------------------------- */
  --paper: #e7ddc4;         /* aged paper, warmer & deeper than generic cream */
  --paper-deep: #dbcda7;    /* card / section fields */
  --paper-line: rgba(36, 31, 26, 0.16);
  --ink: #241f1a;           /* warm near-black, not pure black */
  --ink-soft: #4d4238;      /* secondary text */
  --ink-faint: #7a6c5c;     /* captions, meta */

  /* -- Brass (structural accent) ------------------------ */
  --brass: #8a6a34;
  --brass-light: #c9a467;
  --brass-dark: #5f4823;

  /* -- Spot accents ---------------------------------------- */
  --amethyst: #6b4e8e;      /* the jewel in the pin's head, drawn from the hero artwork */
  --amethyst-soft: #9b82c0;
  --terracotta: #a95c42;    /* warm interactive accent (hover/active/focus) */
  --terracotta-soft: #c17d5f;

  /* -- Type ----------------------------------------------- */
  --font-display: 'Great Vibes', cursive;
  --font-heading: 'Cormorant Garamond', 'EB Garamond', serif;
  --font-body: 'EB Garamond', 'Cormorant Garamond', serif;

  /* -- Rhythm ---------------------------------------------- */
  --measure: 68ch;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.75rem;
  --space-4: 3rem;
  --space-5: 5rem;
  --space-6: 8rem;
}

/* ---------------------------------------------------------
   Reset & base
   --------------------------------------------------------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

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

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

a {
  color: var(--amethyst);
  text-decoration: none;
}
a:hover { color: var(--terracotta); }

/* Visible keyboard focus, always */
a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--terracotta);
  outline-offset: 3px;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 var(--space-2);
  letter-spacing: 0.01em;
}
h2 { font-size: 2.1rem; font-style: italic; }
h3 { font-size: 1.5rem; }

p { margin: 0 0 var(--space-3); }

.wordmark {
  font-family: var(--font-display);
  font-weight: 400;
}

.brand-inline {
  font-family: var(--font-heading);
  font-style: italic;
  font-weight: 600;
}

/* ---------------------------------------------------------
   Layout helpers
   --------------------------------------------------------- */
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--space-3);
}

.prose {
  max-width: var(--measure);
  margin: 0 auto;
}

.center { text-align: center; }

section { padding: var(--space-5) 0; }

/* ---------------------------------------------------------
   Site header / navigation
   --------------------------------------------------------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-3);
  max-width: 1100px;
  margin: 0 auto;
}

.site-header .brand {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--ink);
  line-height: 1;
}

.site-nav {
  display: flex;
  gap: var(--space-4);
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.05rem;
}

.site-nav a {
  color: var(--ink-soft);
  position: relative;
  padding-bottom: 6px;
}

.site-nav a:hover { color: var(--terracotta); }

/* hatpin underline, appears only on hover — restrained motion */
.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0;
  height: 2px;
  background: var(--brass);
  transition: width 0.35s ease;
}
.site-nav a:hover::after { width: 100%; }

/* ---------------------------------------------------------
   Hatpin divider — the signature motif.
   One per screen. That is the whole rule.
   --------------------------------------------------------- */
.hatpin-divider {
  display: block;
  width: 200px;
  height: 26px;
  margin: var(--space-4) auto;
}
.divider-row {
  max-width: var(--measure);
  margin: -0.25rem auto var(--space-3);
}

.hatpin-divider.left {
  margin-left: 0;
  margin-top: 0;
  margin-bottom: 0;
  width: 150px;
  height: 20px;
}
.hatpin-divider.small { width: 140px; height: 18px; margin: var(--space-3) 0; }

/* ---------------------------------------------------------
   Hero
   --------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
}

.hero .frame {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--space-3);
}

.hero .art {
  position: relative;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 30px 60px -30px rgba(36, 31, 26, 0.45);
}

.hero .art img { width: 100%; height: auto; display: block; }

.bridge-line {
  text-align: center;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--ink-soft);
  margin: var(--space-4) auto var(--space-5);
  max-width: 40ch;
}

/* ---------------------------------------------------------
   Intro
   --------------------------------------------------------- */
.intro {
  max-width: var(--measure);
  margin: 0 auto;
  text-align: left;
  font-size: 1.2rem;
}

.intro .lede {
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink-soft);
}

.closing-line {
  text-align: center;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.3rem;
  color: var(--brass-dark);
  max-width: 42ch;
  margin: var(--space-5) auto;
}

/* ---------------------------------------------------------
   Cards — museum exhibit labels, not buttons
   --------------------------------------------------------- */
.card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  max-width: 1000px;
  margin: 0 auto;
}

@media (max-width: 760px) {
  .card-row { grid-template-columns: 1fr; }
}

.exhibit-card {
  display: block;
  background: var(--paper-deep);
  border: 1px solid var(--paper-line);
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.exhibit-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -24px rgba(36, 31, 26, 0.35);
}

.exhibit-card .thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  margin-bottom: var(--space-2);
  filter: sepia(0.18) saturate(1.05);
}

.exhibit-card h3 {
  font-style: italic;
  margin: var(--space-3) var(--space-3) 0.35rem;
}

.exhibit-card .thumb + h3 {
  margin-top: 0;
}

.exhibit-card p {
  color: var(--ink-soft);
  font-size: 1.02rem;
  padding: 0 var(--space-3);
  margin-bottom: var(--space-2);
}

.exhibit-card .hatpin-divider.small { margin: 0 var(--space-3) var(--space-3); }

/* ---------------------------------------------------------
   Pull quotes — a hatpin stands in for quotation marks
   --------------------------------------------------------- */
blockquote.pinned-quote {
  position: relative;
  margin: var(--space-4) 0;
  padding-left: calc(var(--space-4) + 8px);
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.5rem;
  color: var(--ink-soft);
  border: none;
}

blockquote.pinned-quote::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 20px;
  background: url('../img/hatpin-mark-vertical.svg') no-repeat center / contain;
}

/* ---------------------------------------------------------
   Timeline — eras, not blog dates
   --------------------------------------------------------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 640px;
  margin: 0 auto;
}

.timeline li {
  position: relative;
  padding: var(--space-2) 0 var(--space-2) var(--space-4);
  border-left: 1.5px solid var(--paper-line);
  font-family: var(--font-heading);
  font-size: 1.3rem;
}

.timeline li:first-child::after {
  content: "";
  position: absolute;
  left: -3px;
  top: 0;
  width: 4px;
  height: 1.35rem;
  background: var(--paper);
}

.timeline li:last-child::after {
  content: "";
  position: absolute;
  left: -3px;
  top: calc(1.35rem + 12px);
  bottom: 0;
  width: 4px;
  background: var(--paper);
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -6.5px;
  top: 1.35rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--brass);
}

.timeline li.active::before {
  background: var(--terracotta);
  border-color: var(--terracotta);
}

.timeline a { color: var(--ink); }
.timeline a:hover { color: var(--terracotta); }
.timeline .era-date {
  display: block;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-style: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.timeline .era-date .lc { text-transform: lowercase; }

/* ---------------------------------------------------------
   Article page
   --------------------------------------------------------- */
.article-header {
  max-width: var(--measure);
  margin: 0 auto var(--space-4);
}

.article-header .eyebrow {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--brass-dark);
  font-size: 1.05rem;
  margin-bottom: var(--space-1);
}

.article-header h1 {
  font-size: 2.6rem;
  font-style: italic;
}

.article-body {
  max-width: var(--measure);
  margin: 0 auto;
  font-size: 1.18rem;
}

.article-body h2 {
  font-size: 1.7rem;
  margin-top: var(--space-4);
}

.article-footer {
  max-width: var(--measure);
  margin: var(--space-4) auto 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--paper-line);
  font-size: 0.98rem;
  color: var(--ink-faint);
}

.article-footer .sources-label {
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--ink-soft);
  display: block;
  margin-bottom: var(--space-1);
}

/* Exhibit-closing divider: final essay of an exhibit only.
   One fixed-size image (hatpin, rope, exhibit companion), centred,
   like a museum stanchion. Replaces the essay nav's own top rule on that page. */
.exhibit-end {
  max-width: var(--measure);
  margin: var(--space-4) auto 0;
}
.exhibit-end img { width: 170px; height: 72px; margin: 0 auto; }

/* ---------------------------------------------------------
   Essay navigation — sits between the essay and its sources.
   Centred: prev · next on one line, a small-caps
   "Back to the Collection" beneath, like a side door.
   After the exhibit-closing divider it drops its own top rule.
   --------------------------------------------------------- */
.essay-nav {
  max-width: var(--measure);
  margin: var(--space-4) auto 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--paper-line);
  font-size: 0.98rem; /* same as the sources footer, so both rules are the same width */
  text-align: center;
}
.exhibit-end + .essay-nav { border-top: none; margin-top: var(--space-4); padding-top: 0; }
.essay-nav p { margin: 0; }
.essay-nav-links a {
  display: inline-block;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.4;
}
/* The links get a little more room than the line above them (580px vs ~510px),
   so more prev/next pairs fit on one line. Centred under the line; never wider than the screen. */
.essay-nav .essay-nav-links {
  width: min(580px, calc(100vw - 2rem));
  margin-left: 50%;
  transform: translateX(-50%);
}
.essay-nav-dot { color: var(--brass); margin: 0 0.9rem; }
/* When prev and next can't share a line: next on top, previous below, no dot.
   Set by assets/js/essay-nav.js on wide screens, and always on phones (below). */
.essay-nav-links.is-stacked {
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.5rem;
}
.essay-nav-links.is-stacked .essay-nav-dot { display: none; }
/* "More to come": latest essay of an unfinished exhibit. Plain text, not a link. */
.essay-nav-soon {
  display: inline-block;
  font-family: var(--font-heading);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--ink-faint);
}
.essay-nav .essay-nav-collection { margin-top: 0.4rem; }
.essay-nav-collection a {
  font-family: var(--font-heading);
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  color: var(--ink-faint);
}
.essay-nav-collection a:hover { color: var(--terracotta); }

/* ---------------------------------------------------------
   Footer
   --------------------------------------------------------- */
.site-footer {
  padding: var(--space-4) 0 var(--space-5);
  text-align: center;
  font-family: var(--font-heading);
  font-style: italic;
  color: var(--ink-faint);
}

.site-footer .wordmark { font-size: 1.3rem; color: var(--ink-soft); }

/* ---------------------------------------------------------
   Motion — restrained, and off entirely on request
   --------------------------------------------------------- */
.fade-in {
  opacity: 0;
  animation: fadeIn 1s ease forwards;
}
.fade-in.d1 { animation-delay: 0.2s; }
.fade-in.d2 { animation-delay: 0.9s; }
.fade-in.d3 { animation-delay: 1.6s; }
.fade-in.d4 { animation-delay: 2.3s; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; opacity: 1; }
  .exhibit-card { transition: none; }
  html { scroll-behavior: auto; }
}

/* ---------------------------------------------------------
   Responsive type
   --------------------------------------------------------- */
@media (max-width: 640px) {
  body { font-size: 1.05rem; }
  .article-header h1 { font-size: 2rem; }
  .bridge-line { font-size: 1.2rem; }
  .site-nav { gap: var(--space-2); font-size: 0.95rem; }
  /* essay nav on phones: always stacked, next on top, no dot */
  .essay-nav-links {
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.5rem;
  }
  .essay-nav-dot { display: none; }
  .essay-nav .essay-nav-collection { margin-top: 0.9rem; }
}
