/* ============================================================
   To Dad, from Zak — Father's Day
   ============================================================ */

:root {
  /* Palette — creamy / warm white */
  --paper:    #FFFEFB;
  --cream:    #F6F1E9;
  --sand:     #EFE8DB;
  --ink:      #211E19;
  --ink-soft: #4C463D;
  --muted:    #9C9283;
  --line:     rgba(33, 30, 25, 0.12);
  --line-soft:rgba(33, 30, 25, 0.07);
  --accent:   #B0875A;

  /* Type */
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans:  'DM Sans', system-ui, -apple-system, sans-serif;

  /* Shadows */
  --sh-sm: 0 2px 10px rgba(33, 30, 25, 0.05);
  --sh-md: 0 14px 40px -12px rgba(33, 30, 25, 0.18);
  --sh-lg: 0 30px 70px -24px rgba(33, 30, 25, 0.28);

  /* Motion */
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --spring: cubic-bezier(0.34, 1.3, 0.5, 1);

  --radius: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.7;
  color: var(--ink-soft);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

/* Paper grain overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

::selection { background: rgba(176, 135, 90, 0.22); }

.wrap {
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
}

/* ── Shared editorial bits ── */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.1rem;
}

.eyebrow__num {
  font-family: var(--serif);
  font-size: 0.82rem;
  letter-spacing: 0;
  color: var(--accent);
}

.eyebrow::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

.section__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.4rem, 5.5vw + 1rem, 3.6rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.lead {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3vw, 1.6rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.35;
  color: var(--ink);
  margin-bottom: 1.4rem;
}

/* ============================================================
   HERO + CARD (vertical unfold)
   ============================================================ */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vh, 3.5rem);
  padding: 6vh 1.25rem;
  text-align: center;
}

.hero__eyebrow {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(330px, 82vw);
  min-height: 300px;
}

/* The closed card — two stacked flaps */
.card {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 6;
  perspective: 1600px;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.5s var(--ease) 0.35s, transform 0.6s var(--ease) 0.35s;
}

.card__flap {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, var(--paper), #F3ECE0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: var(--sh-md);
  transition: transform 0.85s var(--ease-out);
  z-index: 2;
}

.card__flap--top {
  top: 0;
  transform-origin: top center;
  border-radius: var(--radius) var(--radius) 0 0;
  justify-content: flex-end;
  padding-bottom: 0.4rem;
}

.card__flap--bottom {
  bottom: 0;
  transform-origin: bottom center;
  border-radius: 0 0 var(--radius) var(--radius);
  justify-content: flex-start;
  padding-top: 0.8rem;
  border-top: 1px solid var(--line-soft);
}

.card__line {
  font-family: var(--serif);
  color: var(--ink);
  line-height: 0.95;
}

.card__line--to {
  font-size: 1rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.15rem;
}

.card__line--dad {
  font-size: clamp(3rem, 14vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card__line--from {
  font-size: 1.15rem;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
}

.card__seam {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 50%;
  height: 1px;
  background: var(--line);
  z-index: 3;
  transition: opacity 0.4s var(--ease);
}

/* Letter — revealed beneath the flaps */
.letter {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 100%;
  text-align: left;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--sh-lg);
  padding: clamp(1.8rem, 6vw, 2.75rem);
  opacity: 0;
  transform: translateY(28px) scale(0.94);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.6s var(--ease), transform 0.8s var(--spring);
}

.letter p { color: var(--ink-soft); }
.letter p + p { margin-top: 0.95rem; }

.letter__greeting {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--ink) !important;
  margin-bottom: 0.4rem;
}

.letter__signoff { margin-top: 1.4rem !important; }

.letter__name {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 500;
  font-style: italic;
  color: var(--ink) !important;
  margin-top: 0.1rem !important;
}

/* ── Open state ── */
.stage.is-open .card__flap--top    { transform: rotateX(-172deg); box-shadow: none; }
.stage.is-open .card__flap--bottom { transform: rotateX(172deg);  box-shadow: none; }
.stage.is-open .card__seam { opacity: 0; }

.stage.is-open .card {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

.stage.is-open .letter {
  opacity: 1;
  transform: translateY(0) scale(1);
  max-height: 75dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.stage.is-read { min-height: 0; }

.stage.is-read .card { display: none; }

.stage.is-read .letter {
  position: relative;
  inset: auto;
  pointer-events: auto;
}

.hero__hint {
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--muted);
  transition: opacity 0.4s var(--ease);
}

.hero__hint::before {
  content: '';
  display: block;
  width: 1px;
  height: 26px;
  margin: 0 auto 0.9rem;
  background: linear-gradient(var(--muted), transparent);
  animation: hintPulse 2.4s var(--ease) infinite;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.7); }
  50%      { opacity: 1;   transform: scaleY(1); }
}

.hero__hint.is-hidden { opacity: 0; pointer-events: none; }

/* ============================================================
   SECTIONS
   ============================================================ */

.section {
  position: relative;
  padding: clamp(4.5rem, 12vh, 8rem) 0;
  overflow: hidden;
}

.section--photos { background: var(--cream); }
.section--nuts   { background: var(--sand); }
.section--bikes  { background: var(--cream); }

.section__head {
  position: relative;
  z-index: 1;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

/* Giant faint background word */
.ghost-word {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(9rem, 40vw, 22rem);
  letter-spacing: -0.04em;
  color: var(--ink);
  opacity: 0.025;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}

.prose { position: relative; z-index: 1; }
.prose p + p { margin-top: 1rem; }

.facts {
  list-style: none;
  margin-top: 1.8rem;
  border-top: 1px solid var(--line);
}

.facts li {
  position: relative;
  padding: 0.85rem 0 0.85rem 2.4rem;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink);
  font-size: 1rem;
}

.facts li::before {
  counter-increment: fact;
  content: counter(fact, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.95rem;
  font-family: var(--serif);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.facts { counter-reset: fact; }

.quote {
  position: relative;
  z-index: 1;
  margin-top: clamp(2rem, 5vw, 3rem);
  padding-left: clamp(1.25rem, 4vw, 2rem);
  border-left: 2px solid var(--accent);
}

.quote p {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-style: italic;
  font-weight: 400;
  line-height: 1.3;
  color: var(--ink);
}

/* ── Gallery ── */

.gallery {
  display: flex;
  flex-direction: column;
  gap: clamp(2.5rem, 7vw, 4.5rem);
}

.shot { position: relative; z-index: 1; }

.shot__frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--sh-md);
  background: var(--sand);
  aspect-ratio: 3 / 4;
}

.shot--wide .shot__frame { aspect-ratio: 4 / 3; }

.shot__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  will-change: transform;
  /* over-scale so the parallax shift never reveals frame edges */
  scale: 1.22;
}

.shot__cap {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-top: 1rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.shot__idx {
  font-family: var(--serif);
  font-size: 0.85rem;
  letter-spacing: 0;
  color: var(--accent);
}

/* ── Decorative SVGs ── */

.section__decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }

.decor {
  position: absolute;
  color: var(--accent);
  opacity: 0.16;
  will-change: transform;
}

.decor--nut     { width: 70px;  top: 12%;  right: -8px; }
.decor--bolt    { width: 42px;  bottom: 14%; left: 6%; }
.decor--gear    { width: 72px;  top: 46%;  left: -18px; }
.decor--wheel   { width: 96px;  top: 14%;  left: -22px; }
.decor--bike    { width: 130px; bottom: 10%; right: -26px; }

/* ============================================================
   FOOTER
   ============================================================ */

.footer {
  background: var(--ink);
  color: var(--cream);
  text-align: center;
  padding: clamp(5rem, 14vh, 8rem) 0 clamp(4rem, 10vh, 6rem);
}

.footer__kicker {
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(246, 241, 233, 0.55);
  margin-bottom: 1.2rem;
}

.footer__from {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(3rem, 12vw, 5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--paper);
}

.footer__mark {
  width: 30px;
  height: 30px;
  margin: 1.8rem auto 0;
  color: var(--accent);
}

/* ============================================================
   REVEALS
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.8s var(--ease-out), transform 0.8s var(--ease-out);
}

.reveal.is-visible { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (min-width: 720px) {
  .stage { width: 360px; min-height: 360px; }

  .gallery {
    /* keep single column but let offset shots breathe */
  }

  .shot--offset { margin-left: clamp(2rem, 8%, 4rem); }
  .shot:not(.shot--offset) { margin-right: clamp(2rem, 8%, 4rem); }

  .shot__cap { margin-left: 0.2rem; }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }

  .reveal { opacity: 1; transform: none; }
  .shot__frame img { scale: 1; }
  [data-parallax] { transform: none !important; }

  .stage.is-open .card { display: none; }
  .letter { position: relative; opacity: 1; transform: none; pointer-events: auto; }
}

/* ============================================================
   LOCK SCREEN
   ============================================================ */

.lock-page {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.lock {
  width: 100%;
  max-width: 400px;
}

.lock__card {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--sh-lg);
  padding: clamp(2rem, 6vw, 2.75rem);
  text-align: center;
}

.lock__eyebrow {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

.lock__title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.2rem, 8vw, 2.8rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 0.75rem;
}

.lock__sub {
  font-size: 0.95rem;
  color: var(--muted);
  margin-bottom: 1.75rem;
}

.lock__form {
  text-align: left;
}

.lock__label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.lock__input {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--cream);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  outline: none;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.lock__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 135, 90, 0.15);
}

.lock__error {
  margin-top: 0.75rem;
  font-size: 0.88rem;
  color: #9B4D3A;
}

.lock__btn {
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s var(--ease), transform 0.15s var(--ease);
}

.lock__btn:hover:not(:disabled) { opacity: 0.9; }
.lock__btn:active:not(:disabled) { transform: scale(0.98); }
.lock__btn:disabled { opacity: 0.55; cursor: wait; }
