@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/source-serif-4.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}

/* The app's own palette and type */
:root {
  --white: #ffffff;
  --shelf: #f5f4f1;
  --line: #e4e2dd;
  --line-strong: #c9c6bf;
  --ink: #1a1a1a;
  --ink-2: #4f4e4a;
  --green: #1f3d30;
  --on-green: #ffffff;
  --on-green-2: #c4d6cc;
  --night: #121211;
  --night-ink: #f1efea;
  --night-ink-2: #c2bfb7;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --gutter: clamp(20px, 5.5vw, 96px);
  --gap-section: clamp(80px, 11vw, 168px);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { background: var(--green); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

::selection { background: var(--green); color: var(--on-green); }

h1, h2, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
[hidden] { display: none !important; }

h1, h2, .statement, .night-title {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h2 { font-size: clamp(2rem, 1.3rem + 2.7vw, 3.75rem); line-height: 1.06; }
h2 + p { margin-top: 1.1em; }
p + p { margin-top: 1em; }
section p, footer p { max-width: 56ch; text-wrap: pretty; }
section p { color: var(--ink-2); }

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
  border-radius: 4px;
}

/* Every screen is a flat sheet with a hairline edge, like everything in the app */
.screen { border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.phone { border-radius: clamp(22px, 2.4vw, 34px); border: clamp(5px, 0.55vw, 8px) solid var(--ink); background: var(--ink); }

/* --- Tonight ---------------------------------------------------------------- */

.hero {
  --door-h: min(62svh, 44vw, 680px);
  min-height: 100svh;
  padding: clamp(20px, 2.4vw, 36px) var(--gutter) clamp(32px, 4vw, 56px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr;
  column-gap: clamp(32px, 6vw, 112px);
  background: var(--green);
  color: var(--on-green);
}

.top { grid-column: 1 / -1; }
.top a { display: inline-block; padding: 10px 0; }
.top img { width: clamp(130px, 13vw, 200px); }

.hero-copy { align-self: end; }
h1 { font-size: clamp(3rem, 1rem + 6.6vw, 6rem); line-height: 0.96; letter-spacing: -0.03em; max-width: 8ch; }
.hero-copy p { margin-top: 1.4em; max-width: 38ch; color: var(--on-green-2); font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem); line-height: 1.45; text-wrap: pretty; }

.hero-copy { position: relative; z-index: 1; }
.night { position: relative; align-self: end; justify-self: end; width: calc(var(--door-h) * 0.8); min-width: 250px; }

.door {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  background: var(--shelf);
  display: grid;
  place-items: center;
  /* A gap of green, like the one round the seal, lifts it off the screen behind */
  box-shadow: 0 0 0 10px var(--green);
  transition: transform 0.8s var(--ease);
}

/* The app itself, behind the door. Opening the door opens night 17 here too. */
.peek {
  position: absolute;
  right: 54%;
  top: calc(var(--door-h) * -0.07);
  width: calc(var(--door-h) * 1.16);
  border-radius: 12px;
  overflow: hidden;
}
.peek img { width: 100%; }
.peek .peek-open { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s var(--ease); }
[data-state="open"] .peek-open { opacity: 1; transition-delay: 0.5s; }

.door b {
  font-family: var(--serif);
  font-weight: 400;
  font-size: calc(var(--door-h) * 0.42);
  line-height: 1;
  color: var(--line-strong);
  font-variant-numeric: lining-nums;
  user-select: none;
  -webkit-user-select: none;
}
.door-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 55%;
  border-radius: 14px;
}

.seal {
  position: absolute;
  left: 50%;
  bottom: -52px;
  width: 104px;
  height: 104px;
  margin-left: -52px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--green);
  color: var(--on-green);
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.seal svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.seal circle { fill: none; stroke-width: 2.5; }
.seal-track { stroke: #7f9c8d; }
.seal-fill { stroke: var(--on-green); stroke-linecap: butt; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 0.25s var(--ease); }
.seal:hover .seal-track { stroke: #a9c0b4; }
.seal:focus-visible { outline-offset: 6px; border-radius: 50%; }

[data-state="holding"] .door { transform: scale(0.98); }
[data-state="holding"] .seal-fill { stroke-dashoffset: 0; transition: stroke-dashoffset 0.8s linear; }

.night-text { display: grid; min-height: 5.6rem; margin-top: 70px; text-align: center; }
.night-text p { color: var(--on-green-2); font-size: 1rem; }
.night-text .night-title { color: var(--on-green); font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); line-height: 1.15; }
.night-text p + p { margin-top: 0.35em; }
.again { font: inherit; color: var(--on-green); background: none; border: 0; padding: 10px 4px; margin: -10px 0; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em; cursor: pointer; }

/* The app's reveal: photo uncovers top to bottom, then the name, then the rest */
[data-state="open"] .door-photo { animation: uncover 0.9s var(--ease) both; }
[data-state="open"] .night-title { animation: rise 0.7s var(--ease) 0.35s both; }
[data-state="open"] .night-title + p { animation: rise 0.7s var(--ease) 0.55s both; }
@keyframes uncover { from { clip-path: inset(0 0 100% 0); filter: blur(10px); } to { clip-path: inset(0); filter: blur(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }

/* --- About ------------------------------------------------------------------ */

.about {
  padding: var(--gap-section) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: clamp(40px, 7vw, 128px);
  align-items: start;
}
section .statement { max-width: 24em; color: var(--ink); font-weight: 400; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.5rem); line-height: 1.3; text-wrap: pretty; }
.facts > div { display: grid; grid-template-columns: 6.2em 1fr; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 1rem; }
.facts > div:last-child { border-bottom: 1px solid var(--line); }
.facts dt { color: var(--ink-2); }

/* --- The month -------------------------------------------------------------- */

.month { background: var(--shelf); padding: var(--gap-section) var(--gutter); }
.month-head { max-width: 820px; }
.month-stage { position: relative; margin-top: clamp(40px, 5vw, 72px); padding-right: 11%; padding-bottom: clamp(32px, 5vw, 80px); }
.month-stage .screen { width: 100%; }
.month-stage .phone { position: absolute; right: 0; bottom: 0; width: 23%; }

/* --- Light and dark --------------------------------------------------------- */

.look { padding-top: var(--gap-section); }
.look-copy { padding: 0 var(--gutter); display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 96px); align-items: end; }
.look-copy h2 { max-width: 11ch; }
.look-copy h2 + p { margin: 0; }
.look-pair { margin-top: clamp(40px, 5vw, 72px); display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.look-pair > div { overflow: hidden; }
.look-pair img { width: 133%; max-width: none; }
.look-dark { background: var(--night); }

/* --- The verdict ------------------------------------------------------------ */

.verdict { padding: var(--gap-section) var(--gutter); display: grid; grid-template-columns: minmax(260px, 1fr) minmax(0, 2.5fr); gap: clamp(32px, 5vw, 88px); align-items: center; }
.verdict h2 { font-size: clamp(2rem, 1.3rem + 2vw, 3.1rem); }
.phones { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.2vw, 36px); }
.phones .phone { width: 100%; }
.phones p { margin-top: 16px; font-size: 1rem; line-height: 1.4; }

/* --- The secret ------------------------------------------------------------- */

.secret { background: var(--night); color: var(--night-ink); display: grid; grid-template-columns: minmax(300px, 0.8fr) minmax(0, 1.2fr); gap: clamp(32px, 6vw, 112px); align-items: center; padding: var(--gap-section) 0 var(--gap-section) var(--gutter); overflow: hidden; }
.secret p { color: var(--night-ink-2); }
.secret-shot img { width: 135%; max-width: none; border: 0; border-radius: 12px 0 0 12px; }

/* --- After the 24th --------------------------------------------------------- */

.after { padding: var(--gap-section) var(--gutter); display: grid; grid-template-columns: 1.65fr 1fr; gap: clamp(32px, 6vw, 112px); align-items: end; }
.after h2 { margin-top: 32px; font-size: clamp(1.75rem, 1.3rem + 1.5vw, 2.6rem); }
.after h2 + p { margin-top: 0.8em; }
.archive .phone { width: min(100%, 300px); }

/* --- Close ------------------------------------------------------------------ */

.close { background: var(--green); color: var(--on-green); padding: var(--gap-section) var(--gutter) max(40px, env(safe-area-inset-bottom)); }
.close-main h2 { font-size: clamp(2.5rem, 1.2rem + 5vw, 5.5rem); letter-spacing: -0.025em; line-height: 1; max-width: 12ch; }
.close-main p { color: var(--on-green-2); max-width: 44ch; font-size: clamp(1.0625rem, 0.95rem + 0.5vw, 1.375rem); line-height: 1.45; }
.btn { display: inline-flex; align-items: center; min-height: 52px; margin-top: 2rem; padding: 0 28px; border-radius: 999px; background: var(--white); color: var(--ink); font-weight: 600; font-size: 1.0625rem; text-decoration: none; transition: background 240ms var(--ease); }
.btn:hover { background: #dfe9e3; }
.btn:focus-visible { border-radius: 999px; }
.close-foot { margin-top: var(--gap-section); padding-top: 24px; border-top: 1px solid rgb(255 255 255 / 0.2); display: grid; grid-template-columns: 1fr 1fr; gap: 16px clamp(32px, 6vw, 112px); font-size: 0.9375rem; color: var(--on-green-2); }
.close-foot p + p { margin-top: 0.5em; }
summary { cursor: pointer; padding: 11px 0; margin: -11px 0; width: fit-content; }
details p { margin-top: 1.4em; }
details ul { margin-top: 0.8em; }
details li { padding: 5px 0; overflow-wrap: anywhere; }
details a, .close-foot p a { text-decoration-color: rgb(255 255 255 / 0.4); }
details a:hover, .close-foot p a:hover { text-decoration-color: currentColor; }

@media (min-width: 761px) and (max-width: 1100px) {
  .peek { width: calc(var(--door-h) * 0.9); }
}
@media (min-width: 761px) and (max-width: 1100px) and (orientation: portrait) {
  .peek { top: auto; bottom: calc(100% - var(--door-h) * 0.36); width: var(--door-h); }
}

/* --- Phones ----------------------------------------------------------------- */

@media (max-width: 760px) {
  .top img { width: 140px; }
  .hero { --door-h: min(42svh, 82vw); grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; row-gap: 24px; padding-top: 10px; }
  h1 { font-size: clamp(2.6rem, 12.4vw, 3.6rem); }
  .hero-copy p { margin-top: 0.9em; }
  .night { justify-self: end; align-self: center; min-width: 0; }
  .night-text { width: 100%; margin-top: 58px; min-height: 5.6rem; }
  .peek { right: auto; left: calc(100% - 100vw + 2 * var(--gutter)); top: calc(var(--door-h) * 0.05); width: 54vw; height: calc(var(--door-h) * 0.84); }
  .peek img { height: 100%; object-fit: cover; object-position: left top; }
  .seal { width: 84px; height: 84px; margin-left: -42px; bottom: -42px; font-size: 2rem; }

  .about, .look-copy, .verdict, .secret, .after, .close-foot { grid-template-columns: minmax(0, 1fr); }
  .month-stage { padding: 0; }
  .month-stage .phone { position: relative; width: 70%; margin: -9% 0 0 auto; }
  .look-pair img { width: 100%; }

  .phones { display: flex; gap: 16px; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); scrollbar-width: none; }
  .phones::-webkit-scrollbar { display: none; }
  .phones li { flex: 0 0 68%; scroll-snap-align: start; }

  .secret-shot img { width: 175%; margin-left: 0; }
  .after { row-gap: 72px; }
  .after h2 { margin-top: 24px; }
  .settle .screen { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; object-position: left top; }
  .archive .phone { width: 70%; }
}

@media (prefers-reduced-motion: reduce) {
  .door, .btn, .peek .peek-open { transition: none; }
  [data-state="holding"] .door { transform: none; }
  [data-state="open"] .door-photo, [data-state="open"] .night-title, [data-state="open"] .night-title + p { animation: none; }
}
