/* Ember & Crumb: mobile first.
   Everything below the first media query is the phone layout.
   Larger screens add to it with min-width queries, never undo it. */

:root {
  --bg: #F8ECD9;
  --ink: #2B1A10;
  --ink-soft: #5A3E2B;
  --ember: #B5441C;
  --cream: #FFF7EA;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gutter: max(1.25rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 4rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  caret-color: var(--ember);
  scrollbar-color: var(--ink-soft) transparent;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
::selection { background: var(--ember); color: var(--cream); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--ink-soft); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

a:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--ember);
  outline-offset: 4px;
  border-radius: 4px;
}

.progress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 30; }
.progress span { display: block; height: 100%; background: var(--ember); transform-origin: 0 50%; transform: scaleX(0); }

/* ---------- header: wordmark and one link on a phone ---------- */
.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(0.4rem + env(safe-area-inset-top)) var(--gutter) 1.75rem;
  background: linear-gradient(to bottom, var(--bg) 40%, color-mix(in srgb, var(--bg) 0%, transparent));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.mark {
  font-family: var(--display);
  font-weight: 650;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  min-height: 2.75rem; display: inline-flex; align-items: center;
}
.top nav { display: flex; gap: 0; }
.top nav a {
  position: relative;
  display: none;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
}
.top nav a.keep { display: inline-flex; padding-right: 0; }
.top nav a::after, .link::after {
  content: ""; position: absolute; left: 0.6rem; right: 0.6rem; bottom: 0.55rem; height: 1.5px;
  background: currentColor; transform: scaleX(0); transform-origin: 0 50%;
  transition: transform 220ms var(--ease-out);
}
.top nav a.keep::after { right: 0; }
.top nav a:active::after { transform: scaleX(1); }

/* ---------- panels: photos above, words below ---------- */
.panel {
  position: relative;
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "stage" "copy";
  align-content: center;
  row-gap: 3.25rem;
  padding: 5.5rem var(--gutter) 4rem;
  margin-inline: auto;
}
.copy { grid-area: copy; width: 100%; }

/* ---------- the photo stage ---------- */
.stage {
  grid-area: stage;
  position: relative;
  justify-self: center;
  width: min(78%, 22rem);
  aspect-ratio: var(--ar, 4 / 5);
  max-height: 52svh;
  margin-bottom: 2.75rem;
  perspective: 1200px;
  perspective-origin: 50% 50%;
  opacity: 0;
}
.stage.in { opacity: 1; transition: opacity 700ms var(--ease-out); }
html:not(.js) .stage { opacity: 1; }

.shot {
  position: absolute; margin: 0;
  overflow: hidden;
  border-radius: 18px;
  background: #d9bf9a;
  box-shadow: 0 2px 3px rgba(43, 26, 16, 0.18), 0 22px 40px -16px rgba(43, 26, 16, 0.55);
  will-change: transform;
  backface-visibility: hidden;
}
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.shot.main { inset: 0; }
.shot.accent {
  width: 48%; aspect-ratio: 1; bottom: -1.75rem;
  border-radius: 14px;
  box-shadow: 0 2px 3px rgba(43, 26, 16, 0.2), 0 18px 32px -12px rgba(43, 26, 16, 0.6);
}
.panel[data-side="left"]  .shot.accent { left: -12%; }
.panel[data-side="right"] .shot.accent { right: -12%; }
.stage .accent { opacity: 0; }
.stage.in .accent { opacity: 1; transition: opacity 700ms var(--ease-out) 180ms; }
html:not(.js) .stage .accent { opacity: 1; }

/* ---------- type ---------- */
h1, h2 {
  font-family: var(--display);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 1rem;
  text-wrap: balance;
}
h1 { font-size: clamp(2.4rem, 11vw, 3.4rem); }
h2 { font-size: clamp(2rem, 9vw, 2.9rem); }
p { margin: 0 0 1rem; text-wrap: pretty; }
.note { color: var(--ink-soft); font-size: 1rem; margin-top: 1.25rem; }

/* ---------- actions: full-width thumb targets on a phone ---------- */
.actions { display: flex; flex-direction: column; align-items: stretch; gap: 0.5rem; margin-top: 1.75rem; }
.btn {
  display: flex; align-items: center; justify-content: center;
  min-height: 3.25rem;
  background: var(--ink);
  color: var(--cream);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  padding: 0 1.5rem;
  border-radius: 999px;
  box-shadow: 0 1px 1px rgba(43, 26, 16, 0.2), 0 8px 18px -6px rgba(43, 26, 16, 0.45);
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.link {
  position: relative; display: flex; align-items: center; justify-content: center;
  min-height: 2.75rem;
  color: var(--ink); font-weight: 500; text-decoration: none;
}
.link::after { left: 25%; right: 25%; }

.facts { margin: 1.5rem 0 0; display: grid; gap: 0.9rem; }
.facts div { display: grid; grid-template-columns: 4.75rem 1fr; gap: 0.75rem; align-items: baseline; }
.facts dt { font-weight: 600; font-size: 0.95rem; color: var(--ink-soft); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts a { color: var(--ink); text-underline-offset: 0.2em; text-decoration-thickness: 1.5px; }

.fine { grid-area: auto; margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--ink-soft); }
.fine a { color: inherit; text-underline-offset: 0.2em; }
.cue { display: none; }

/* ---------- enter ---------- */
[data-enter] { opacity: 0; transform: translateY(18px); filter: blur(4px); }
[data-enter].in {
  opacity: 1; transform: none; filter: none;
  transition: opacity 650ms var(--ease-out), transform 650ms var(--ease-out), filter 650ms var(--ease-out);
}
html:not(.js) [data-enter] { opacity: 1; transform: none; filter: none; }

/* ---------- large phones and small tablets ---------- */
@media (min-width: 30rem) {
  .actions { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
  .btn { display: inline-flex; min-height: 3.25rem; }
  .link { justify-content: flex-start; }
  .link::after { left: 0; right: 0; bottom: 0.55rem; }
  .stage { width: min(70%, 26rem); margin-bottom: 3.5rem; }
  .shot.accent { bottom: -2.5rem; }
  h1 { font-size: clamp(2.75rem, 9vw, 4.5rem); }
  h2 { font-size: clamp(2.25rem, 7vw, 3.5rem); }
  .copy { max-width: 36rem; margin-inline: auto; }
  p { max-width: 38ch; }
  .top nav a { display: inline-flex; }
  .top nav a.keep { padding-right: 0.6rem; }
  .top nav a.keep::after { right: 0.6rem; }
}

/* ---------- desktop: two columns, photo beside the words ---------- */
@media (min-width: 56rem) {
  body { font-size: 1.125rem; }
  :root { --gutter: max(clamp(1.5rem, 5vw, 4rem), env(safe-area-inset-left), env(safe-area-inset-right)); }
  html { scroll-padding-top: 0; }
  .top { padding-top: 1rem; padding-bottom: 2.25rem; }
  .mark { font-size: 1.35rem; }
  .top nav { gap: clamp(0.5rem, 2vw, 1.5rem); }

  .panel {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: clamp(2rem, 7vw, 7rem);
    align-content: normal;
    align-items: center;
    padding-top: 6rem;
    max-width: 90rem;
  }
  .panel[data-side="left"]  { grid-template-areas: "copy stage"; }
  .panel[data-side="right"] { grid-template-areas: "stage copy"; }
  .copy { width: min(33rem, 100%); max-width: none; margin-inline: 0; }
  .panel[data-side="right"] .copy { justify-self: end; }

  .stage { width: min(100%, 34rem); max-height: 76svh; margin-bottom: 0; perspective: 1500px; }
  .shot { border-radius: 22px; box-shadow: 0 2px 3px rgba(43, 26, 16, 0.18), 0 28px 50px -18px rgba(43, 26, 16, 0.55); }
  .shot.accent { width: 46%; bottom: -6%; border-radius: 18px; box-shadow: 0 2px 3px rgba(43, 26, 16, 0.2), 0 22px 40px -14px rgba(43, 26, 16, 0.6); }
  .panel[data-side="left"]  .shot.accent { left: -15%; }
  .panel[data-side="right"] .shot.accent { right: -15%; }

  h1 { font-size: clamp(2.75rem, 7vw, 5.75rem); }
  h2 { font-size: clamp(2.25rem, 5vw, 4.25rem); }
  h1, h2 { line-height: 1.02; margin-bottom: 1.25rem; }
  .copy > p { max-width: 36ch; }
  .actions { margin-top: 2rem; gap: 1rem 1.75rem; }
  .facts { margin-top: 1.75rem; }
  .facts div { grid-template-columns: 5.5rem 1fr; gap: 1rem; }

  .fine { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 1.5rem; margin: 0; }
  .cue {
    position: absolute; left: var(--gutter); bottom: 1.75rem;
    font-size: 0.9rem; font-weight: 500; color: var(--ink-soft);
    display: flex; align-items: center; gap: 0.75rem;
  }
  .cue::after { content: ""; width: 3rem; height: 1.5px; background: currentColor; transform-origin: 0 50%; animation: cue 2.4s var(--ease-out) infinite; }
}
@keyframes cue { 0% { transform: scaleX(0); } 55% { transform: scaleX(1); } 100% { transform: scaleX(1); opacity: 0; } }

/* ---------- fingers need bigger targets than cursors ---------- */
@media (pointer: coarse) {
  .facts a, .fine a { display: inline-block; padding-block: 0.75rem; margin-block: -0.75rem; }
}

/* ---------- hover only where hover exists ---------- */
@media (hover: hover) {
  .top nav a:hover::after, .link:hover::after { transform: scaleX(1); }
  .btn:hover { background: var(--ember); transform: translateY(-2px); box-shadow: 0 2px 2px rgba(43, 26, 16, 0.2), 0 14px 22px -8px rgba(181, 68, 28, 0.55); }
  .shot:hover img { transform: scale(1.03); }
  .facts a:hover { color: var(--ember); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-enter] { transform: none; filter: none; }
  [data-enter].in { transition: opacity 200ms linear; }
  .cue::after { animation: none; transform: none; }
  .btn, .top nav a::after, .link::after { transition: none; }
  .stage, .stage .accent { opacity: 1; transition: none; }
  .shot img { transition: none; }
}
