/* ===========================================================
   Toasty — Case Study System
   Shared stylesheet for all case study pages.
   Edit tokens in :root to restyle every page at once.
   =========================================================== */

:root {
  /* Ink + ground */
  --bg:            #0B0B0C;
  --bg-2:          #121214;
  --surface:       #17171A;
  --line:          rgba(255, 255, 255, 0.10);
  --line-strong:   rgba(255, 255, 255, 0.20);

  --ink:           #F6F4F0;
  --ink-muted:     #A2A2A8;
  --ink-subtle:    #6E6E76;

  /* Toasty accent — the orange from the case-file series */
  --accent:        #FF4A17;
  --accent-soft:   rgba(255, 74, 23, 0.14);

  /* Type */
  --display: "Sora", "Inter", system-ui, -apple-system, sans-serif;
  --body:    "Inter", system-ui, -apple-system, sans-serif;
  --mono:    "Kode Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Rhythm */
  --gutter: clamp(20px, 5vw, 64px);
  --maxw: 1180px;
  --measure: 62ch;
  --section-y: clamp(64px, 11vw, 150px);
  --radius: 18px;
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

/* Give keyboard users a visible ring, but don't punish mouse users. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Layout primitives ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(40px, 7vw, 90px); }

.rule {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* ---------- Type ---------- */
.kicker {
  font-family: var(--mono);
  font-size: clamp(10px, 1.6vw, 12px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.kicker::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.kicker--plain::after { display: none; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.03;
  margin: 0;
  text-wrap: balance;
}

h2 {
  font-size: clamp(30px, 6vw, 58px);
  text-transform: uppercase;
  margin-bottom: 28px;
}

h3 {
  font-size: clamp(21px, 3.2vw, 31px);
  text-transform: uppercase;
  margin-bottom: 14px;
  line-height: 1.1;
}

p { margin: 0 0 1.15em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.5;
  color: var(--ink);
}

.muted { color: var(--ink-muted); }

/* The "typed record" voice — used for case-file statements. */
.record {
  font-family: var(--mono);
  font-size: clamp(14px, 1.9vw, 16.5px);
  line-height: 1.75;
  color: var(--ink-muted);
  letter-spacing: -0.01em;
}
.record strong { color: var(--ink); font-weight: 500; }

/* A pulled-out assertion. */
.pull {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(20px, 3.4vw, 32px);
  line-height: 1.22;
  text-transform: uppercase;
  letter-spacing: -0.015em;
  color: var(--ink);
  max-width: 20ch;
  margin: 0;
  padding-left: clamp(16px, 2.5vw, 26px);
  border-left: 3px solid var(--accent);
}

.note {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-subtle);
  letter-spacing: .02em;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11, 11, 12, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 62px;
}
.topbar__back {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  /* Comfortable tap target on phones. */
  min-height: 44px;
  padding-right: 8px;
  transition: color .18s ease;
}
.topbar__back:hover { color: var(--ink); }
.topbar__mark {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: .16em;
  font-size: 14px;
  text-decoration: none;
}
.topbar__file {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-subtle);
}
@media (max-width: 560px) {
  .topbar__file { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(48px, 9vw, 110px) clamp(36px, 6vw, 64px); }

.hero__tag {
  font-family: var(--mono);
  font-size: clamp(10px, 1.7vw, 12px);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
}

.hero__title {
  /* Floor is low enough that the longest title ("GOLDEN OPS.") still fits
     a 390px screen without clipping. */
  font-size: clamp(38px, 13vw, 168px);
  line-height: .9;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  margin: 0 0 26px;
}
.hero__title .dot { color: var(--accent); }

.hero__sub {
  font-size: clamp(19px, 3vw, 30px);
  font-family: var(--display);
  font-weight: 500;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--ink);
  max-width: 24ch;
  margin: 0 0 40px;
  text-wrap: balance;
}

/* Metadata block — the case-file header. */
.meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.meta__cell {
  background: var(--bg);
  padding: 20px clamp(16px, 2.2vw, 24px);
}
.meta__k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin: 0 0 9px;
}
.meta__v {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  margin: 0;
  max-width: none;
}

/* ---------- Section body grid ---------- */
/* Narrative column + optional side note, collapsing to one column on phones. */
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; gap: 32px; }
}

/* ---------- Figures ---------- */
.figs {
  display: grid;
  gap: clamp(14px, 2.2vw, 26px);
  margin-top: clamp(34px, 5vw, 60px);
}
.figs--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figs--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.figs--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Phones: never squeeze more than two app screens side by side. */
@media (max-width: 760px) {
  .figs--3, .figs--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 430px) {
  .figs--3, .figs--4 { grid-template-columns: 1fr 1fr; }
}

figure { margin: 0; }

figcaption {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  letter-spacing: .04em;
  color: var(--ink-subtle);
  margin-top: 12px;
}

/* Device shells ------------------------------------------------ */

/* Phone screen: rounded, bezelled, keeps the app's own dark ground. */
.shot--phone {
  border-radius: clamp(18px, 3vw, 28px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #000;
  aspect-ratio: 390 / 844;
}
.shot--phone img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

/* Desktop screen: browser-ish plate. */
.shot--screen {
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface);
}
.shot--screen img { width: 100%; height: auto; }

/* App Store / marketing imagery — show whole, don't crop. */
.shot--plate {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.shot--plate img { width: 100%; height: auto; }

/* Small UI fragments on a padded plate so they don't float. */
.shot--frag {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: clamp(18px, 3vw, 34px);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
}
.shot--frag img { width: 100%; height: auto; }

/* One wide hero image. */
.figs--full { grid-template-columns: 1fr; }

/* ---------- Results ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: clamp(30px, 4vw, 48px);
}
.stat {
  background: var(--bg);
  padding: clamp(24px, 3.4vw, 38px) clamp(18px, 2.4vw, 28px);
}
.stat__v {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(32px, 5.6vw, 54px);
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--accent);
  margin: 0 0 10px;
}
.stat__l {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0;
  line-height: 1.5;
  max-width: none;
}

/* Attribution caveat under the numbers. */
.stats__note { margin-top: 16px; }

/* ---------- Takeaways ---------- */
.takes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: clamp(20px, 3vw, 34px);
  margin-top: clamp(28px, 4vw, 44px);
}
.take {
  border-top: 2px solid var(--accent);
  padding-top: 20px;
}
.take h3 { font-size: clamp(17px, 2.1vw, 21px); margin-bottom: 10px; }
.take p { font-size: 15.5px; color: var(--ink-muted); }

/* ---------- CTA ---------- */
.cta {
  border-top: 1px solid var(--line);
  background:
    radial-gradient(120% 140% at 50% 0%, var(--accent-soft), transparent 62%),
    var(--bg);
  text-align: center;
}
.cta h2 { margin-bottom: 18px; }
.cta p { margin-inline: auto; }

.btns {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-top: 34px;
}

.btn {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  /* 52px keeps it a comfortable thumb target. */
  min-height: 52px;
  padding: 0 clamp(22px, 3.4vw, 34px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.btn:hover { background: rgba(255,255,255,.07); transform: translateY(-1px); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 700;
}
.btn--primary:hover { background: #ff5c2e; border-color: #ff5c2e; }

/* On phones, stack the buttons full width — no tiny side-by-side pills. */
@media (max-width: 520px) {
  .btns { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; }
}

/* ---------- Prev/next ---------- */
.pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--line);
  border-block: 1px solid var(--line);
}
.pager__item {
  background: var(--bg);
  padding: clamp(24px, 3.4vw, 36px) clamp(18px, 3vw, 32px);
  text-decoration: none;
  display: block;
  transition: background .18s ease;
}
.pager__item:hover { background: var(--bg-2); }
.pager__k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink-subtle);
  margin: 0 0 10px;
}
.pager__t {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(20px, 2.8vw, 28px);
  text-transform: uppercase;
  letter-spacing: -0.02em;
  margin: 0;
}

/* ---------- Footer ---------- */
.foot {
  padding-block: 40px 56px;
  color: var(--ink-subtle);
}
.foot__in {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 28px;
  align-items: center;
  justify-content: space-between;
}
.foot a { color: var(--ink-muted); text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* ---------- Scroll reveal (progressive enhancement) ---------- */
/* Elements only start hidden once JS confirms it can reveal them,
   so the page still reads fine with JS off. */
.js-reveal .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .6s ease, transform .6s ease;
}
.js-reveal .reveal.is-in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .reveal { opacity: 1; transform: none; }
}

/* ---------- The Roast — cross-promo ----------
   Sits between the takeaways and the contact CTA: the low-commitment
   offer first, the direct ask second. Deliberately reads as a different
   product, not more case study. */
.roast {
  border: 1px solid var(--line);
  border-radius: clamp(20px, 3vw, 28px);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(255, 74, 23, 0.16), transparent 58%),
    var(--bg-2);
  padding: clamp(28px, 5vw, 64px);
  overflow: hidden;
}

.roast__eyebrow {
  font-family: var(--mono);
  font-size: clamp(10px, 1.6vw, 11.5px);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.roast__eyebrow span {
  color: var(--ink-subtle);
  letter-spacing: .12em;
}

.roast__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 6.4vw, 62px);
  line-height: .98;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  margin: 0 0 20px;
  max-width: 15ch;
  text-wrap: balance;
}

.roast__lede {
  font-size: clamp(16px, 2.1vw, 19px);
  line-height: 1.55;
  color: var(--ink-muted);
  max-width: 48ch;
  margin: 0 0 28px;
}
.roast__lede strong { color: var(--ink); font-weight: 500; }

/* The checks it actually runs — proof, not decoration. */
.roast__checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}
.roast__checks li {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: .02em;
  color: var(--ink-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 15px;
  background: rgba(255, 255, 255, 0.02);
}

.roast__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.roast__note {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink-subtle);
  margin: 18px 0 0;
  max-width: 52ch;
}

@media (max-width: 520px) {
  .roast__actions { flex-direction: column; align-items: stretch; }
  .roast__actions .btn { width: 100%; }
}
