/* Customer support email drafting. Same order as the Yellow Slate reference:
   heading, stats, pull line (this build has no testimonial), the problem,
   before, now, what changed. Every section reads with no scroll effects;
   page.js adds the grind and the turn on top. A mail app look throughout.
   Loaded after the engine and the site stylesheet, so site tokens win. */

:root {
  --sc-canvas: var(--bg);
  --sc-ink: var(--text);
  --sc-accent: var(--accent);
  --sc-font-display: var(--h-font);
  --sc-font-text: var(--b-font);
  --sc-font-mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;

  /* This page's own grounds: an inbox at night (a cool ink) and a cool paper. */
  --ground-dark: #0e121a;
  --ground-dark-2: #161b25;
  --ground-lit: #f3f5f8;
  --before-ink: #f2f2f2;
  --before-soft: #a3a7ae;                   /* 7.6:1 on --ground-dark */
  --before-line: #262c38;
  --accent-on-dark: var(--accent);          /* 5.6:1 on --ground-dark */
  --accent-on-light: #c8200f;               /* 5.2:1 on --ground-lit */
  --muted-lit: #5f636a;                     /* 5.8:1 on --ground-lit and on white */

  --side-pad: clamp(24px, 5vw, 88px);
  --gap: clamp(56px, 8vh, 96px);
}

/* Owner's decision on the reference: an ordinary header at the top, not a bar that follows. */
.tf-header { position: absolute; }

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

/* ------------------------------------------------------------- layout -- */
.em { background: var(--bg); color: var(--text); }
.wrap { max-width: 76rem; margin-inline: auto; padding-inline: var(--side-pad); }
.em > .wrap + .wrap, .em > .wrap + section, .em > section + .wrap { margin-top: var(--gap); }
.prose > * { max-width: 46rem; }
.prose > * + * { margin-top: 18px; }
.prose p { font-size: 1.1rem; line-height: 1.7; color: var(--muted); }
.prose p strong { color: var(--text); }
.em h2 { font-size: clamp(1.8rem, 1.3rem + 1.6vw, 2.8rem); letter-spacing: -.02em; }
.em h3 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.8rem); letter-spacing: -.01em; }
.illus-note { margin: 0 0 10px; font-size: 14px; color: var(--before-soft); }

/* ---------------------------------------------------------------- hero -- */
.em-hero {
  position: relative; overflow: clip;
  padding-top: clamp(150px, 22vh, 220px); padding-bottom: 24px;
}
.hero-copy { position: relative; z-index: 2; }
.hero-copy > * + * { margin-top: 20px; }
.kicker { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-light); }
.hero-line {
  font-family: var(--h-font); font-weight: 700;
  font-size: clamp(2.2rem, 1.2rem + 3.2vw, 4rem);
  line-height: 1.06; letter-spacing: -.03em;
  max-width: 17ch; margin: 0;
}
.lead { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); line-height: 1.6; max-width: 40ch; color: var(--muted); }

/* Hero depth: inbox rules lag most, the draft card less, the copy moves with the page. */
.plane { position: absolute; margin: 0; pointer-events: none; }
.plane--grid {
  inset: -340px 0 0 0; z-index: 0;   /* covers the 300px the rules lag at rate 6 */
  background-image: linear-gradient(color-mix(in oklab, var(--text) 7%, transparent) 1px, transparent 1px);
  background-size: 100% 44px;
  -webkit-mask-image: radial-gradient(70% 70% at 75% 60%, #000 25%, transparent 80%);
          mask-image: radial-gradient(70% 70% at 75% 60%, #000 25%, transparent 80%);
}
.plane--mid { z-index: 1; right: max(var(--side-pad), calc((100% - 76rem) / 2 + var(--side-pad))); bottom: 40px; width: 17rem; }
.draft-card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px 20px;
  background: #fff; border-radius: var(--card-radius); box-shadow: var(--card-shadow);
}
.draft-card-h { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; color: var(--muted); }
.draft-card-line { height: 6px; border-radius: 3px; background: var(--line); }
.draft-card-line:nth-of-type(4) { width: 62%; }
.draft-card-send {
  align-self: flex-end; margin-top: 4px; padding: 6px 16px; border-radius: 999px;
  background: var(--accent-on-light); color: #fff; font-size: 13px; font-weight: 700;
}
.draft-pill {
  flex: none; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: #fbe3df; color: #9e1a0c;
}

/* --------------------------------------------------------------- stats -- */
.em > .stats { margin-top: 56px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.stat {
  display: flex; flex-direction: column; padding: 26px 26px 28px;
  background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--card-radius);
}
.stat-viz { height: 64px; margin-bottom: 22px; }
.stats-note { grid-column: 1 / -1; margin: 0; font-size: 15px; color: var(--muted); }

/* 20 hours: one block per hour, 2 rows of 10. */
.viz-hours { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; align-content: center; }
.viz-hours i { height: 24px; border-radius: 4px; background: var(--accent-on-light); }
/* $10,000: the 130 working days it adds up to, one dot each. */
.viz-days { display: grid; grid-template-columns: repeat(26, 1fr); gap: 3px; align-content: center; }
.viz-days i { aspect-ratio: 1; border-radius: 50%; background: var(--accent-on-light); }
/* 15 minutes: a quarter of the clock face fills. */
.viz-quarter { width: 64px; overflow: visible; }
.q-face { fill: var(--bg); stroke: var(--line); stroke-width: 2; }
.q-arc {
  fill: none; stroke: var(--accent-on-light); stroke-width: 27;
  stroke-dasharray: 15 60; transform: rotate(-90deg); transform-origin: 32px 32px;
}
.q-hand { stroke: var(--text); stroke-width: 3; stroke-linecap: round; transform: rotate(90deg); transform-origin: 32px 32px; }
.q-pin { fill: var(--text); }

/* Entry: the cards rise in one after another, then each picture fills.
   Motion only; without it everything shows in its finished state. */
.em-motion .stat { transition: opacity .7s var(--sc-ease-out, ease-out), transform .7s var(--sc-ease-out, ease-out); transition-delay: calc(var(--n) * 120ms); }
.em-motion .stats:not(.is-in) .stat { opacity: 0; transform: translateY(28px); }
.em-motion .viz-hours i { transition: transform .35s var(--sc-ease-out, ease-out), opacity .35s; transition-delay: calc(.4s + var(--i) * 45ms); transform-origin: bottom; }
.em-motion .stats:not(.is-in) .viz-hours i { transform: scaleY(.15); opacity: .2; }
.em-motion .viz-days i { transition: transform .3s var(--sc-ease-out, ease-out), opacity .3s; transition-delay: calc(.5s + var(--i) * 9ms); }
.em-motion .stats:not(.is-in) .viz-days i { transform: scale(.3); opacity: .15; }
.em-motion .q-arc { transition: stroke-dasharray 1.2s var(--sc-ease-out, ease-out) .6s; }
.em-motion .q-hand { transition: transform 1.2s var(--sc-ease-out, ease-out) .6s; }
.em-motion .stats:not(.is-in) .q-arc { stroke-dasharray: 0 60; }
.em-motion .stats:not(.is-in) .q-hand { transform: rotate(0deg); }
.stat-n {
  margin: 0; font-family: var(--h-font); font-weight: 700; color: var(--text);
  font-size: clamp(2.2rem, 1.6rem + 2vw, 3.4rem); line-height: 1.05; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.stat-l { margin: 8px 0 0; font-size: 1rem; color: var(--muted); }

/* ---------------------------------------------------------- pull line -- */
.pull { margin-block: 0; }
.pull p {
  margin: 0; font-family: var(--h-font); font-weight: 600; color: var(--text);
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 3rem); line-height: 1.2; letter-spacing: -.025em;
  max-width: 24ch; text-wrap: balance;
}

/* -------------------------------------------------------------- before -- */
.before {
  background: var(--ground-dark); color: var(--before-ink);
  padding-top: var(--gap); padding-bottom: var(--gap);
}
.before h2, .before h3 { color: #fff; }
.before .prose p { color: var(--before-soft); }
.before .prose p strong { color: #fff; }
.before .cost { margin-top: var(--gap); }
.before .cost-line { font-size: clamp(1.2rem, 1rem + .6vw, 1.45rem); line-height: 1.5; }

.grind { margin-top: 48px; }
.grind-stage { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(32px, 5vw, 80px); align-items: start; }
.steps { margin: 20px 0 0; padding-left: 1.4em; color: var(--before-soft); font-size: 1.1rem; line-height: 1.5; }
.steps li + li { margin-top: 8px; }
.counter { margin-top: 28px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.counter-n {
  font-family: var(--sc-font-mono); font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: clamp(3rem, 2rem + 4vw, 5.5rem); line-height: 1; color: var(--accent-on-dark);
}
.counter-l { color: var(--before-soft); }

/* The mail window. Static by default (all read, the hour full); page.js drives it. */
.mailbox {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--ground-dark-2); border: 1px solid var(--before-line); border-radius: 14px;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .8);
}
.mb-bar {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px;
  background: #1c2230; border-bottom: 1px solid var(--before-line);
  font-size: 13px; color: var(--before-soft);
}
.mb-bar i { width: 10px; height: 10px; border-radius: 50%; background: #3a4150; }
.mb-bar span { margin-left: 8px; color: #fff; font-weight: 600; }
.mb-unread { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--before-soft); }
.mb-body { position: relative; display: grid; grid-template-columns: 1fr; min-height: 0; }
.mb-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.mb-list li {
  display: grid; grid-template-columns: 7.5em 1fr; gap: 14px; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--before-line);
  color: #fff; font-weight: 700;
}
.mb-list li span:first-child { font-family: var(--sc-font-mono); font-weight: 600; }
.mb-list li.is-read { color: var(--before-soft); font-weight: 400; }
.mb-list li.is-open { background: #2a1512; box-shadow: inset 3px 0 0 var(--accent-on-dark); color: #fff; }
.mb-read { display: none; }
.mb-hour { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--before-line); font-size: 13px; color: var(--before-soft); }
.mb-hour-bar { height: 6px; border-radius: 3px; background: var(--before-line); overflow: hidden; }
.mb-hour-bar i { display: block; height: 100%; width: calc(var(--hour, 1) * 100%); background: var(--accent-on-dark); }
.mb-hour-n { font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }

/* The pinned grind. Only with motion: page.js sets .em-motion. */
.em-motion .grind { margin-top: 0; }
.em-motion .grind-stage { align-items: stretch; padding-block: clamp(56px, 10vh, 112px); background: var(--ground-dark); }
.em-motion .grind-copy { display: flex; flex-direction: column; justify-content: center; }
.em-motion .scene { display: flex; flex-direction: column; min-height: 0; }
.em-motion .mailbox { flex: 1; min-height: 0; will-change: transform, opacity; }
.em-motion .mb-body { flex: 1; grid-template-columns: 1fr; overflow: hidden; }
.em-motion .mb-body > * { grid-area: 1 / 1; min-height: 0; }
.em-motion .mb-list { overflow: hidden; }
/* The reading pane slides over the list from the right when an email is open. */
.em-motion .mb-read {
  display: flex; flex-direction: column; gap: 12px; padding: 22px 22px;
  background: #1a202b; border-left: 1px solid var(--before-line);
  margin-left: 22%; will-change: transform, opacity;
}
.mb-subject { margin: 0; font-size: 1.15rem; font-weight: 700; color: #fff; }
.mb-line { height: 7px; border-radius: 4px; background: #2c3442; }
.mb-line:nth-of-type(3) { width: 70%; }
.mb-tags { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.mb-tags li {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--before-line);
  font-size: 13px; font-weight: 600; color: var(--before-soft);
  transition: background .2s, color .2s, border-color .2s;
}
.mb-tags li.is-on { background: #2a1512; border-color: var(--accent-on-dark); color: #fff; }

/* One step at a time, as on the reference. */
.em-motion .steps { display: grid; list-style: none; padding-left: 0; margin-top: 28px; }
.em-motion .steps li {
  grid-area: 1 / 1; margin: 0; color: #fff;
  font-family: var(--h-font); font-weight: 600; letter-spacing: -.01em;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2.1rem); line-height: 1.25;
  will-change: transform, opacity, filter;
}
.em-motion .steps li::before {
  content: "Step " counter(list-item) " of 4"; display: block; margin-bottom: 10px;
  font-family: var(--b-font); font-size: 14px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--accent-on-dark);
}
.em-motion .steps::after {
  content: ""; grid-area: 2 / 1; margin-top: 24px; height: 3px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-on-dark) calc(var(--sp, 0) * 100%), var(--before-line) 0);
}

/* ----------------------------------------------------------------- now --
   The turn is the peak. With motion the stage starts on the night ground,
   the inbox sorts itself, the ground lifts to paper (--lit, 0 to 1), then a
   draft opens and a person sends it. Without motion: the finished state. */
.now { padding-bottom: 0; }
.turn-stage {
  --lit: 1;
  background: color-mix(in oklab, var(--ground-lit) calc(var(--lit) * 100%), var(--ground-dark));
  display: flex; align-items: center;
  padding-block: var(--gap);
}
.turn-grid { width: 100%; display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.turn-now > * + * { margin-top: 16px; }
.turn-now h2 { font-size: clamp(3rem, 2rem + 4vw, 5.5rem); line-height: 1; letter-spacing: -.04em; }
.turn-before { display: none; }
.em-motion .turn-copy { display: grid; }
.em-motion .turn-copy > * { grid-area: 1 / 1; align-self: center; }
.em-motion .turn-before {
  display: block; margin: 0; max-width: 15ch; color: #fff;
  font-family: var(--h-font); font-weight: 600; letter-spacing: -.02em;
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.4rem); line-height: 1.12;
}
.turn-time { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-on-light); }
.turn-line { font-size: clamp(1.2rem, 1rem + .6vw, 1.5rem); line-height: 1.5; color: var(--text); max-width: 26ch; }
.now > .prose { margin-top: var(--gap); }
.illus-note--turn { color: var(--muted-lit); }

/* The mail app, finished: folders on the left, the open draft on the right.
   Its colours follow --lit, so it is a night inbox before the turn and a
   paper one after it. */
.sorter {
  --win: color-mix(in oklab, #fff calc(var(--lit) * 100%), var(--ground-dark-2));
  --win-ink: color-mix(in oklab, var(--text) calc(var(--lit) * 100%), #f2f2f2);
  --win-soft: color-mix(in oklab, var(--muted-lit) calc(var(--lit) * 100%), var(--before-soft));
  --win-line: color-mix(in oklab, var(--line) calc(var(--lit) * 100%), var(--before-line));
  display: grid; grid-template-columns: 11rem 1fr; overflow: hidden; max-width: 40rem;
  background: var(--win); color: var(--win-ink);
  border: 1px solid var(--win-line); border-radius: var(--card-radius);
  box-shadow: 0 30px 60px -30px rgba(10, 20, 40, .35);
}
.folders { list-style: none; margin: 0; padding: 14px 10px; border-right: 1px solid var(--win-line); }
.folders li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 10px; font-size: 14px; font-weight: 600;
}
.f-n { font-variant-numeric: tabular-nums; }
.f-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--win-soft); }
.f-inbox { color: var(--win-soft); }
.f-drafted { background: color-mix(in oklab, #fbe3df calc(var(--lit) * 100%), #2a1512); }
.f-drafted .f-n { color: color-mix(in oklab, #9e1a0c calc(var(--lit) * 100%), #fff); }
.pane { display: grid; min-height: 19rem; overflow: hidden; }
.pane > * { grid-area: 1 / 1; min-height: 0; }
.sort-list { display: none; list-style: none; margin: 0; padding: 0; font-size: 14px; }
.sort-list li {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--win-line); font-weight: 700;
}
.sort-list em {
  font-style: normal; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  background: #fbe3df; color: #9e1a0c; opacity: 0;
}
.sort-list li[data-to="filed"] em { background: #e7eaee; color: #3d4048; }
.sort-list li[data-to="human"] em { background: #fff1cc; color: #6b4a00; }

.draft { display: flex; flex-direction: column; gap: 12px; padding: 22px 24px; }
.draft-h { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 1.05rem; font-weight: 700; }
.draft-src { margin: 0; font-size: 13px; color: var(--win-soft); }
.draft-line { height: 7px; border-radius: 4px; background: var(--win-line); }
.draft-line--short { width: 55%; }
.draft-foot { margin: 8px 0 0; display: grid; justify-items: end; }
.draft-foot > * { grid-area: 1 / 1; }
.send, .sent { padding: 9px 20px; border-radius: 999px; font-size: 14px; font-weight: 700; }
.send { background: var(--accent-on-light); color: #fff; }
.sent { background: #e3f1e6; color: #1d5a2c; }
.send { visibility: hidden; }   /* the finished state is sent; page.js plays the press */

.em-motion .turn-stage { height: 100svh; padding-block: 0; }
.em-motion .sort-list { display: block; }
.em-motion .send { visibility: visible; }
.em-motion .turn-stage .draft, .em-motion .turn-stage .turn-now { opacity: 0; }

.receipt { margin: 36px 0 0; max-width: none; }
.receipt img { width: 100%; height: auto; border-radius: var(--inner-radius); }
.receipt figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); }
.built { font-size: 15px !important; }

/* --------------------------------------------------------------- close -- */
.close { display: flex; flex-direction: column; align-items: flex-start; padding-bottom: calc(var(--gap) * 1.5); }
.close > * + * { margin-top: 18px; }
.close p { font-size: 1.1rem; color: var(--muted); max-width: 46rem; }
.close .tf-btn { margin-top: 28px; }
.em .tf-btn:active { transform: translateY(0) scale(.98); filter: brightness(1.05); }

/* --------------------------------------------------------------- tablet -- */
@media (max-width: 1000px) {
  .plane--mid { display: none; }
}

/* ---------------------------------------------------------------- phone -- */
@media (max-width: 760px) {
  .logo-site { display: inline-block; padding-block: 7px; }
  .menu-toggle { padding: 14px 10px; }
  .em-hero { padding-top: 130px; }
  .hero-line { font-size: clamp(1.9rem, 1.2rem + 3vw, 2.5rem); max-width: 18ch; }
  .stats { grid-template-columns: 1fr; gap: 16px; }
  .grind-stage, .turn-grid { grid-template-columns: 1fr; }
  .mb-list li { grid-template-columns: 6.5em 1fr; gap: 10px; padding: 9px 12px; }
  .em-motion .mb-read { margin-left: 0; }
  .em-motion .grind-stage { grid-template-rows: auto 1fr; gap: 20px; padding-block: 72px 92px; }   /* window ends above the site's back-to-top button */
  .em-motion .steps { font-size: 1rem; margin-top: 16px; }
  .em-motion .steps li { font-size: 1.35rem; }
  .em-motion .steps::after { margin-top: 14px; }
  .em-motion .grind-copy h3 { font-size: 1.15rem; }
  .em-motion .counter { margin-top: 12px; }
  .em-motion .counter-n { font-size: 2.6rem; }
  .em-motion .turn-grid { gap: 18px; }
  /* The finished turn has to fit one phone screen: folders become one row of chips. */
  .turn-now h2 { font-size: 2.6rem; }
  .turn-now > * + * { margin-top: 10px; }
  .turn-line { font-size: 1.05rem; max-width: none; }
  .sorter { grid-template-columns: 1fr; }
  .folders { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--win-line); }
  .folders li { padding: 6px 10px; font-size: 13px; gap: 6px; }
  .pane { min-height: 14.5rem; }
  .draft { padding: 16px 18px; gap: 10px; }
}
@media (max-width: 760px) and (max-height: 720px) {
  .em-motion .turn-before { font-size: 1.8rem; }
  .turn-time { display: none; }   /* never the illustration note: it stays with the sample mail */
  .sort-list li { padding: 8px 14px; }
}
