/* ------------------------------------------------------------
   Fonts
   Hedvig Letters Serif = headline, Satoshi = everything else.
   Instrument Sans is the backup if Satoshi doesn't load.
------------------------------------------------------------ */
@font-face {
  font-family: "Hedvig Letters Serif";
  src: url("../assets/fonts/hedvig-letters-serif-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Beth Ellen";
  src: url("../assets/fonts/beth-ellen-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

/* ------------------------------------------------------------
   Animatable values
   --hue slowly shifts the whole background; --sat and --bright
   change when you hover a link or the headline.
------------------------------------------------------------ */
@property --hue { syntax: "<angle>"; inherits: true; initial-value: -6deg; }
@property --sat { syntax: "<number>"; inherits: true; initial-value: 0.95; }
@property --bright { syntax: "<number>"; inherits: true; initial-value: 1; }
@property --lift { syntax: "<number>"; inherits: true; initial-value: 1; }

:root {
  animation: hue-drift 180s ease-in-out infinite;
}

/* very slow trip through blues: cornflower, a light airy blue, sky */
@keyframes hue-drift {
  0%   { --hue: -6deg;  --lift: 1; }
  25%  { --hue: -12deg; --lift: 1.08; }
  50%  { --hue: -2deg;  --lift: 1.04; }
  75%  { --hue: -22deg; --lift: 1.02; }
  100% { --hue: -6deg;  --lift: 1; }
}

/* ------------------------------------------------------------
   Colors + type
------------------------------------------------------------ */
:root {
  --bg: #e6edf7;
  --ink: #111318;
  --text: #3c4354;   /* subline + meta, stays 4.5:1+ even when the background deepens */
  --link: #3a3f49;
  --orange: #d2501a; /* 3:1+ on the glass at headline size */

  --serif: "Hedvig Letters Serif", Georgia, "Times New Roman", serif;
  --sans: "Satoshi", "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ------------------------------------------------------------
   Background: soft blue wash (colors pulled from the rain photo)
   with grain on top
------------------------------------------------------------ */
.wash {
  position: fixed;
  inset: -10%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(45% 55% at 18% 22%, #cfdcf4 0%, transparent 70%),
    radial-gradient(50% 60% at 85% 30%, #dbe5f7 0%, transparent 70%),
    radial-gradient(55% 55% at 70% 88%, #c3d3f0 0%, transparent 70%),
    radial-gradient(50% 50% at 12% 85%, #e2eaf8 0%, transparent 70%),
    radial-gradient(35% 35% at 50% 50%, #eaf0f9 0%, transparent 100%),
    var(--bg);
  filter: blur(60px) hue-rotate(var(--hue)) saturate(var(--sat)) brightness(calc(var(--bright) * var(--lift)));
  transition: --sat 1.8s cubic-bezier(0.22, 1, 0.36, 1), --bright 1.8s cubic-bezier(0.22, 1, 0.36, 1);
  animation: drift 40s ease-in-out infinite alternate;
}

/* light + shadow that trail the cursor (moved by js/main.js).
   The shadow is bigger, darker and lags further behind, which gives depth. */
.glow,
.trail,
.shade {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: 50%;
  opacity: 0;
  filter: hue-rotate(var(--hue));
  will-change: transform, opacity;
}

/* the tail: faint glows that follow each other (created in js/main.js) */
.trail {
  width: 380px;
  height: 380px;
  margin: -190px 0 0 -190px;
  background: radial-gradient(circle, rgba(92, 126, 204, 0.11) 0%, rgba(92, 126, 204, 0.04) 42%, transparent 70%);
}

.glow {
  width: 440px;
  height: 440px;
  margin: -220px 0 0 -220px;
  background: radial-gradient(circle, rgba(92, 126, 204, 0.15) 0%, rgba(92, 126, 204, 0.06) 40%, transparent 70%);
}

.shade {
  width: 560px;
  height: 560px;
  margin: -280px 0 0 -280px;
  background: radial-gradient(circle, rgba(28, 44, 92, 0.07) 0%, rgba(28, 44, 92, 0.03) 45%, transparent 70%);
  filter: blur(24px) hue-rotate(var(--hue));
}

/* hovering a link or the headline deepens everything a little */
body.deep .wash { --sat: 1.15; --bright: 0.98; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-3%, 2%) scale(1.06); }
}

.texture {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: multiply;
  /* fine grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.26 0 0 0 0 0.3 0 0 0 0 0.4 0 0 0 0.7 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.9;
}

/* coarser, cloudy layer: a mottled, paper-like feel */
.texture::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.4;
  /* mid-size speckle between the fine grain and the clouds */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='320'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.22' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.35 0 0 0 0 0.48 0 0 0 0.45 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E");
}

.texture::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.6;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='600'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.018' numOctaves='4' seed='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.4 0 0 0 0 0.55 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------
   Glass card
------------------------------------------------------------ */
.card {
  position: relative;
  width: min(1120px, 100%);
  min-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(40px, 6vw, 80px) clamp(24px, 5vw, 64px);
  border-radius: 28px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.34));
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 1px 2px rgba(40, 60, 110, 0.06),
    0 24px 60px -20px rgba(40, 60, 110, 0.22);
  -webkit-backdrop-filter: blur(28px) saturate(1.2);
          backdrop-filter: blur(28px) saturate(1.2);
}

/* handwritten name, centered at the top of the card */
.sig {
  position: absolute;
  top: clamp(14px, 2vw, 24px);
  left: 0;
  right: 0;
  text-align: center;
  margin: 0;
  white-space: nowrap;
  font-family: "Beth Ellen", "Brush Script MT", cursive;
  font-weight: 400;
  font-size: max(15px, min(20px, calc((100vw - 72px) * 20 / 468)));
  line-height: 1.6;
  /* a deeper version of the background blue; shifts along with the background */
  color: #5b78b8;
  filter: hue-rotate(var(--hue));
}

/* ------------------------------------------------------------
   Layout
------------------------------------------------------------ */
.page {
  position: relative;
  z-index: 3;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 48px);
  text-align: center;
}

@media (max-width: 600px) {
  .card { min-height: calc(100vh - 32px); border-radius: 22px; padding-left: 20px; padding-right: 20px; }
}

.title {
  font-family: var(--serif);
  font-weight: 400;
  /* desktop: 36-58px. phones: shrinks with the screen so the headline is always 2 lines */
  font-size: min(clamp(36px, 4.6vw, 58px), calc((100vw - 72px) / 13));
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.sub {
  margin-top: 14px;
  max-width: 44ch;
  /* shrinks on phones at the same rate as the headline, never below 12px */
  font-size: max(12px, min(clamp(15px, 1.2vw, 17px), calc((100vw - 72px) * 15 / 468)));
  line-height: 1.5;
  color: var(--text);
  text-wrap: balance;
}

.meta {
  margin-top: 40px;
  font-size: max(12px, min(14px, calc((100vw - 72px) * 14 / 468)));
  line-height: 1.6;
  color: var(--text);
}

/* ------------------------------------------------------------
   Headline edit: "soon" gets struck out and a handwritten orange
   correction appears above it (words live in js/main.js)
------------------------------------------------------------ */
.title { padding-top: 0.62em; }
.title .l1 { display: block; white-space: nowrap; }

.struck {
  position: relative;
  display: inline-block;
  transition: color 0.9s ease;
}

.title.edited .struck { color: rgba(17, 19, 24, 0.5); }

.struck::after {
  /* thick marker strike, drawn left to right */
  content: "";
  position: absolute;
  left: -0.08em;
  right: -0.08em;
  top: 50%;
  height: 0.16em;
  margin-top: -0.02em;
  border-radius: 0.08em;
  background: var(--orange);
  opacity: 0;
  transform: rotate(-2.5deg) scaleX(0);
  transform-origin: left center;
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.3s ease 0.6s;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='12' preserveAspectRatio='none'%3E%3Cfilter id='r'%3E%3CfeTurbulence baseFrequency='0.9 0.3' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 2.4'/%3E%3C/filter%3E%3Crect width='120' height='12' filter='url(%23r)'/%3E%3C/svg%3E") center / 100% 100%;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='12' preserveAspectRatio='none'%3E%3Cfilter id='r'%3E%3CfeTurbulence baseFrequency='0.9 0.3' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -2.2 2.4'/%3E%3C/filter%3E%3Crect width='120' height='12' filter='url(%23r)'/%3E%3C/svg%3E") center / 100% 100%;
}

.title.edited .struck::after {
  opacity: 0.92;
  transform: rotate(-2.5deg) scaleX(1);
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1), opacity 0.1s ease;
}

/* the handwritten correction, centered above "soon" */
.swap {
  position: absolute;
  left: 50%;
  bottom: 92%;
  width: 0;
  height: 0;
  font-family: "Beth Ellen", "Brush Script MT", cursive;
  font-size: max(14px, 0.4em);
  line-height: 1;
  color: var(--orange);
}

.swap .word {
  position: absolute;
  left: 0;
  bottom: 0;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 0.5em) rotate(-4deg);
  filter: blur(6px);
  transition: opacity 1s ease 0.55s, transform 1.2s cubic-bezier(0.22, 1, 0.36, 1) 0.55s, filter 1s ease 0.55s;
}

/* the old word leaves quickly, the new one waits a beat */
.swap .word.in  { opacity: 1; transform: translate(-50%, 0) rotate(-4deg); filter: blur(0); }
.swap .word.out { opacity: 0; transform: translate(-50%, -0.5em) rotate(-4deg); filter: blur(6px); transition-duration: 0.7s; transition-delay: 0s; }

/* ------------------------------------------------------------
   Links
------------------------------------------------------------ */
.links {
  margin-top: 22px;
  display: flex;
  gap: 24px;
}

.links a,
.links .copy {
  font-size: max(12px, min(14px, calc((100vw - 72px) * 14 / 468)));
  color: var(--link);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  padding: 10px 0 2px;
  transition: color 0.2s ease, background-size 0.3s ease;
}

.links a:hover,
.links .copy:hover { color: var(--ink); background-size: 0% 1px; background-position: 100% 100%; }
.links a:focus-visible,
.links .copy:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }

/* the copy button looks like the links */
.links .copy {
  font: inherit;
  font-size: max(12px, min(14px, calc((100vw - 72px) * 14 / 468)));
  border: 0;
  background-color: transparent;
  cursor: pointer;
  min-width: 7.5ch;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ------------------------------------------------------------
   Entrance
------------------------------------------------------------ */
.fade { opacity: 0; transform: translateY(8px); animation: fade 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; }
.fade-2 { animation-delay: 0.12s; }
.fade-3 { animation-delay: 0.28s; }
.fade-4 { animation-delay: 0.42s; }

@keyframes fade { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .fade { animation: none; opacity: 1; transform: none; }
  .struck::after { transition: none; }
  .swap, .swap .word { transition: none; }
  :root { animation: none; }
  .wash { animation: none; transition: none; }
  .glow, .trail, .shade { display: none; }
  .links a { transition: none; }
}
