/* PocketChief closing site.
   Tokens are taken from the product's design system (assets/pc-design-system.css):
   navy, gold and ivory palette, Manrope for display, Inter for text. */

@font-face {
  font-family: "Inter";
  src: url("/assets/fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-latin-var.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --navy-950: #061329;
  --navy-900: #0a1f44;
  --navy-800: #12315e;
  --gold-500: #c5a059;
  --gold-line: #b8955a;
  --ivory-50: #fbf9f4;
  --ink: #0b1528;
  --slate-700: #465365;

  --font-display: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(20px, 6vw, 96px);
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background-color: var(--ivory-50);
  background-image:
    radial-gradient(80% 60% at 0% 0%, rgba(28, 66, 117, 0.055), transparent 62%),
    radial-gradient(70% 55% at 100% 100%, rgba(197, 160, 89, 0.075), transparent 60%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* ---- Frame ------------------------------------------------------------ */

.page {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  min-height: 100svh;
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: clamp(28px, 5vw, 56px) var(--gutter) clamp(40px, 6vw, 72px);
}

.masthead {
  display: flex;
  align-items: center;
}

.brand {
  display: inline-block;
  border-radius: 6px;
}

.brand img {
  width: clamp(168px, 14vw + 110px, 216px);
  height: auto;
}

.stage {
  display: grid;
  align-content: center;
  gap: clamp(40px, 7vw, 72px);
  padding-top: clamp(48px, 9vw, 88px);
}

@media (min-width: 1024px) {
  .stage {
    grid-template-columns: minmax(0, 38rem) minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(32px, 4vw, 80px);
    padding-top: 0;
  }
}

/* ---- Letter ----------------------------------------------------------- */

.letter {
  max-width: 38rem;
}

.letter__title {
  margin: 0 0 clamp(28px, 4vw, 40px);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 1.45rem + 3.3vw, 4rem);
  line-height: 1.04;
  letter-spacing: -0.028em;
  color: var(--navy-950);
  text-wrap: balance;
}

.letter p {
  margin: 0;
  max-width: 34em;
  font-size: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  line-height: 1.7;
  color: var(--slate-700);
  text-wrap: pretty;
}

.letter p + p {
  margin-top: 1.15em;
}

.letter .letter__lead {
  font-size: clamp(1.1875rem, 1.06rem + 0.5vw, 1.375rem);
  line-height: 1.55;
  color: var(--ink);
}

.letter .letter__thanks {
  color: var(--navy-900);
  font-weight: 500;
}

.letter .signature {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: clamp(36px, 5vw, 52px) 0 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.09em;
  color: var(--navy-800);
}

.letter .signature::before {
  content: "";
  flex: none;
  width: 36px;
  height: 1px;
  background: var(--gold-500);
}

/* ---- 404 notice ------------------------------------------------------- */

.notice__link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: 0.01em;
  color: var(--navy-900);
  text-decoration: none;
  border-radius: 4px;
  background-image: linear-gradient(var(--gold-500), var(--gold-500));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition:
    color 240ms var(--ease),
    background-size 360ms var(--ease);
}

.notice__link .arrow {
  display: inline-block;
  transition: transform 360ms var(--ease);
}

.notice__link:hover {
  color: var(--navy-800);
  background-size: 100% 2px;
}

.notice__link:hover .arrow {
  transform: translateX(4px);
}

.notice__link:active {
  color: var(--navy-950);
}

:focus-visible {
  outline: 2px solid var(--gold-500);
  outline-offset: 4px;
}

/* ---- Artwork ---------------------------------------------------------- */

.chapter-art {
  margin: 0;
  width: 100%;
  max-width: 640px;
  justify-self: center;
}

.chapter-art svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

@media (min-width: 1024px) {
  /* Lean into the right gutter so the drawing has room beside the letter. */
  .chapter-art {
    justify-self: end;
    width: calc(100% + var(--gutter) * 0.6);
    max-width: 720px;
    margin-right: calc(var(--gutter) * -0.6);
  }
}

@media (max-width: 1023.98px) {
  /* Below the letter on small screens: the drawing closes the page. */
  .chapter-art {
    max-width: 560px;
    margin-inline: auto;
  }
}

/* ---- Entrance motion (only when the visitor has not asked for less) ---- */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    animation: rise 900ms var(--ease) both;
  }

  .reveal:nth-child(1) { animation-delay: 80ms; }
  .reveal:nth-child(2) { animation-delay: 200ms; }
  .reveal:nth-child(3) { animation-delay: 300ms; }
  .reveal:nth-child(4) { animation-delay: 400ms; }
  .reveal:nth-child(5) { animation-delay: 560ms; }

  .masthead .brand {
    animation: fade 900ms var(--ease) both;
  }

  .chapter-art .ca-glow,
  .chapter-art .ca-layers {
    animation: fade 1600ms var(--ease) 500ms both;
  }

  .chapter-art .ca-resting path,
  .chapter-art .ca-turning path {
    stroke-dasharray: 1;
    animation: draw 1500ms var(--ease) both;
  }

  .chapter-art .ca-resting path { animation-delay: 260ms; }
  .chapter-art .ca-resting path:nth-child(n + 4) { animation-delay: 360ms; }

  /* The turning page sweeps from right to left, one stage at a time. */
  .chapter-art .ca-turning path:nth-child(1) { animation-delay: 520ms; }
  .chapter-art .ca-turning path:nth-child(2) { animation-delay: 640ms; }
  .chapter-art .ca-turning path:nth-child(3) { animation-delay: 760ms; }
  .chapter-art .ca-turning path:nth-child(4) { animation-delay: 880ms; animation-duration: 1800ms; }
  .chapter-art .ca-turning path:nth-child(5) { animation-delay: 1000ms; }
  .chapter-art .ca-turning path:nth-child(6) { animation-delay: 1120ms; }

  .chapter-art .ca-rule {
    transform-box: fill-box;
    transform-origin: center;
    animation: widen 1600ms var(--ease) 300ms both;
  }

  .chapter-art .ca-spine {
    animation: fade 900ms var(--ease) 200ms both;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

@keyframes widen {
  from {
    opacity: 0;
    transform: scaleX(0.2);
  }
}

@media (forced-colors: active) {
  .letter .signature::before {
    background: CanvasText;
  }
}

@media print {
  body {
    background: none;
  }

  .chapter-art {
    max-width: 420px;
  }
}
