/* CASTL STUDIO — sample monthly Summary (2026-10-17).
   A tap-through story: one idea per card, numbers that count up, charts that draw in.
   Without JS the cards simply stack and scroll. Builds on site.css tokens. */

.summary-page { min-height: 100svh; background-color: var(--charcoal); background-image: var(--drafting-grid); background-size: 64px 64px; }

/* ---------- top bar ---------- */
.sm-top { position: fixed; inset: 0 0 auto; z-index: 30; display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 clamp(16px, 4vw, 40px); background: rgba(30, 29, 26, .96); border-bottom: 1px solid var(--ivory-rule); }
.sm-brand { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; font-weight: 600; font-size: .9375rem; }
.sm-brand svg path { fill: var(--brass); }
.sm-sample { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .8125rem; color: var(--ivory-text); }
.sm-sample strong { padding: 3px 8px; border: 1px solid var(--brass); color: var(--brass); font-family: var(--font-label); font-weight: 400; font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; }
.sm-close { display: inline-grid; place-items: center; width: 44px; height: 44px; text-decoration: none; font-size: 1.1rem; color: var(--ivory-text); }
.sm-close:hover { color: var(--ivory); }
.sm-progress { display: none; }

/* ---------- cards (stacked when JS is off) ---------- */
.story { padding-top: 60px; }
.card { position: relative; display: grid; align-items: center; min-height: calc(100svh - 60px); padding: clamp(32px, 6vh, 72px) clamp(20px, 5vw, 64px) clamp(96px, 14vh, 120px); border-bottom: 1px solid var(--ivory-rule); }
.card-inner { width: 100%; max-width: 760px; margin: 0 auto; display: grid; gap: clamp(14px, 2.4vh, 22px); }
.card-kicker { display: flex; align-items: center; gap: 12px; font-family: var(--font-label); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--sand); }
.card-kicker::before { content: ""; width: 24px; height: 2px; background: var(--brass); }
.card-title { font-family: var(--font-display); font-weight: 400; font-size: clamp(2rem, 5.2vw, 3.4rem); line-height: 1.03; letter-spacing: -.015em; text-wrap: balance; }
.card-cover .card-title { font-size: clamp(2.6rem, 8vw, 5.2rem); line-height: .96; }
.card-sub { max-width: 52ch; font-size: clamp(1.0625rem, 1.5vw, 1.2rem); color: var(--ivory-text); }
.card-note { max-width: 56ch; font-size: .9375rem; color: var(--ivory-text); }
.card-hint { font-family: var(--font-label); font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--warm-grey); }
.card-hint .hint-touch { display: none; }
.card-hint .hint-keys, .card-hint .hint-touch { margin-right: .5ch; }
@media (hover: none) { .card-hint .hint-touch { display: inline; } .card-hint .hint-keys { display: none; } }
.muted { color: var(--warm-grey); }
.cover-mark { width: clamp(64px, 10vw, 96px); height: auto; overflow: visible; margin-bottom: 8px; }
.cover-mark path { fill: var(--brass); stroke: var(--brass); stroke-width: 6; stroke-dasharray: 1; }

/* hero figure: the one number this card is about (sans, proportional figures) */
.hero-figure { font-family: var(--font-body); font-weight: 700; font-size: clamp(4.5rem, 16vw, 9rem); line-height: .9; letter-spacing: -.03em; color: var(--ivory); }
.delta { font-size: clamp(1rem, 1.6vw, 1.2rem); font-weight: 600; }
.delta-up { color: var(--brass); margin-right: 4px; }

/* sparkline */
.spark { margin: 6px 0 0; display: grid; gap: 8px; max-width: 600px; }
.spark svg { width: 100%; height: auto; overflow: visible; }
.spark .grid { stroke: var(--ivory-rule); stroke-width: 1; vector-effect: non-scaling-stroke; }
.spark .area { fill: var(--brass); opacity: .1; }
.spark .line { fill: none; stroke: var(--brass); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.spark .dot { fill: var(--brass); stroke: var(--charcoal); stroke-width: 2; vector-effect: non-scaling-stroke; transition: r .15s; }
.spark .hit { fill: transparent; }
.spark .pt { cursor: default; outline: none; }
.spark .pt:hover .dot, .spark .pt:focus-visible .dot { fill: var(--ivory); }
.spark .pt:focus-visible .hit { stroke: var(--ivory); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.spark .end-label { fill: var(--ivory); font-family: var(--font-body); font-weight: 600; font-size: 22px; }
.spark .axis text { fill: var(--warm-grey); font-family: var(--font-body); font-size: 18px; }
.spark figcaption { font-size: .875rem; color: var(--ivory-text); }

/* horizontal bars: one series, one hue; value at the tip */
.bars { display: grid; gap: 14px; margin-top: 6px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name value" "track track"; gap: 6px 12px; align-items: end; }
.bar-name { grid-area: name; font-size: .9375rem; font-weight: 500; color: var(--ivory); }
.bar-value { grid-area: value; font-weight: 700; font-size: 1.125rem; color: var(--ivory); }
.bar-track { grid-area: track; display: block; height: 20px; }
.bar { display: block; width: calc(var(--v) * 100%); height: 100%; background: var(--brass); border-radius: 0 4px 4px 0; transform-origin: left center; outline: none; transition: filter .15s; }
.bar:hover, .bar:focus-visible { filter: brightness(1.15); }
.bar:focus-visible { outline: 2px solid var(--ivory); outline-offset: 2px; }
.bars-emphasis li:not(.is-key) .bar { background: var(--warm-grey); opacity: .55; }

/* what we did */
.done-list { display: grid; border-top: 1px solid var(--ivory-rule); }
.done-list li { display: grid; grid-template-columns: clamp(64px, 12vw, 96px) 1fr; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ivory-rule); }
.done-num { font-family: var(--font-body); font-weight: 700; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; color: var(--brass); }
.done-text { display: grid; gap: 2px; font-weight: 600; font-size: clamp(1.05rem, 1.8vw, 1.25rem); }
.done-text small { font-weight: 400; font-size: .9375rem; color: var(--ivory-text); }

/* best performer */
.best { grid-template-columns: 1fr; align-items: center; }
.best-copy { display: grid; gap: clamp(14px, 2.4vh, 22px); }
.best-stats { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 8px clamp(20px, 4vw, 40px); margin: 0; }
.best-stats dt { order: 2; font-size: .875rem; color: var(--ivory-text); }
.best-stats div { display: flex; flex-direction: column; gap: 4px; }
.best-stats dd { margin: 0; font-family: var(--font-body); font-weight: 700; font-size: clamp(2rem, 5vw, 3rem); line-height: 1; }
.phone { justify-self: center; width: min(52vw, 210px); aspect-ratio: 9 / 16; padding: 8px; border: 1px solid var(--ivory-rule); background: var(--onyx); }
.phone-screen { position: relative; height: 100%; display: grid; place-items: center; align-content: center; gap: 12px; padding: 16px; background-color: #2A2823; background-image: repeating-linear-gradient(-45deg, rgba(216, 201, 180, .05) 0 1px, transparent 1px 10px); text-align: center; }
.cup { width: 46%; height: auto; }
.cup-body { fill: var(--sand); }
.cup-lid { fill: var(--ivory); }
.cup-straw { fill: none; stroke: var(--ivory); stroke-width: 5; stroke-linecap: round; }
.cup-band { fill: var(--brass); }
.phone-caption { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.1; }
.phone-tag { position: absolute; top: 10px; left: 10px; padding: 2px 6px; border: 1px solid var(--brass); font-family: var(--font-label); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; color: var(--brass); }

/* ad money flow: different units, so tiles and arrows, not a funnel chart */
.flow { display: grid; gap: 10px; counter-reset: none; }
.flow li { position: relative; display: grid; grid-template-columns: minmax(0, auto) 1fr; align-items: baseline; gap: 16px; padding: 12px 0 12px 18px; border-left: 2px solid var(--ivory-rule); }
.flow li::before { content: ""; position: absolute; left: -6px; top: 50%; width: 10px; height: 10px; background: var(--charcoal); border: 2px solid var(--brass); transform: translateY(-50%) rotate(45deg); }
.flow-value { font-family: var(--font-body); font-weight: 700; font-size: clamp(2rem, 5.4vw, 3.2rem); line-height: 1; min-width: 4.4ch; }
.flow-label { font-size: 1rem; color: var(--ivory-text); }
.flow-end { border-left-color: var(--brass) !important; }
.flow-end .flow-value { color: var(--brass); }
.flow-takeaway { font-size: clamp(1.1rem, 2vw, 1.4rem); font-family: var(--font-display); line-height: 1.25; max-width: 32ch; }
.flow-takeaway strong { font-family: var(--font-body); font-weight: 700; color: var(--brass); }

/* next month */
.moves { display: grid; border-top: 1px solid var(--ivory-rule); }
.moves li { display: grid; grid-template-columns: 48px 1fr; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--ivory-rule); font-size: clamp(1rem, 1.6vw, 1.15rem); color: var(--ivory-text); }
.moves strong { color: var(--ivory); font-weight: 700; }
.move-n { font-family: var(--font-label); font-size: .8rem; color: var(--brass); padding-top: 4px; }

/* end */
.end-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.sm-replay { border: 0; background-color: transparent; color: var(--ivory); padding: 0; }
.numbers { margin-top: 8px; border-top: 1px solid var(--ivory-rule); padding-top: 12px; }
.numbers summary { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; cursor: pointer; }
.numbers table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: .9rem; }
.numbers th, .numbers td { padding: 8px 0; border-bottom: 1px solid var(--ivory-rule); text-align: left; vertical-align: top; }
.numbers th { font-weight: 500; color: var(--ivory-text); padding-right: 16px; }
.numbers td { font-variant-numeric: tabular-nums; font-weight: 600; }
.numbers thead th { font-family: var(--font-label); font-weight: 400; font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--warm-grey); }

/* controls + tooltip */
.sm-controls { display: none; }
.sm-tip { position: fixed; z-index: 50; padding: 8px 10px; background: var(--ivory); color: var(--charcoal); font-size: .875rem; font-weight: 600; pointer-events: none; white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); }

/* ---------- story mode (JS on) ---------- */
.js .summary-page { overflow: hidden; }
.js .sm-progress { position: fixed; z-index: 31; top: 60px; left: 0; right: 0; display: grid; grid-auto-flow: column; gap: 4px; padding: 10px clamp(16px, 4vw, 40px) 0; }
.js .sm-progress span { height: 3px; background: rgba(216, 201, 180, .22); overflow: hidden; }
.js .sm-progress span::after { content: ""; display: block; height: 100%; background: var(--brass); transform: scaleX(0); transform-origin: left; transition: transform .45s var(--ease); }
.js .sm-progress span.is-done::after, .js .sm-progress span.is-current::after { transform: scaleX(1); }
.js .story { position: fixed; inset: 60px 0 0; padding: 0; touch-action: pan-y; }
.js .card { position: absolute; inset: 0; min-height: 0; overflow-y: auto; border: 0; padding-top: clamp(40px, 7vh, 72px); opacity: 0; visibility: hidden; transform: translateX(24px); transition: opacity .45s var(--ease), transform .55s var(--ease), visibility 0s .55s; }
.js .card.is-before { transform: translateX(-24px); }
.js .card.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity .45s var(--ease), transform .55s var(--ease), visibility 0s; }
.js .sm-controls { position: fixed; z-index: 31; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px clamp(16px, 4vw, 40px) calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(30, 29, 26, .96) 40%); }
.sm-btn { min-height: 48px; min-width: 96px; padding: 0 18px; border: 1px solid rgba(246, 240, 232, .4); background: rgba(30, 29, 26, .9); color: var(--ivory); font-weight: 600; font-size: .9375rem; transition: background-color .15s, color .15s, border-color .15s; }
.sm-btn:hover:not(:disabled) { border-color: var(--ivory); }
.sm-btn:disabled { opacity: .35; cursor: default; }
.sm-btn-next { background: var(--brass); border-color: var(--brass); color: var(--onyx); }
.sm-btn-next:hover:not(:disabled) { background: var(--brass-deep); border-color: var(--brass-deep); }
.sm-count { font-family: var(--font-label); font-size: .75rem; letter-spacing: .1em; color: var(--warm-grey); }

/* entrance choreography for the active card */
.js .card [data-in] { opacity: 0; transform: translateY(16px); }
.js .card.is-active [data-in] { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: calc(var(--in, 0) * 110ms + 120ms); }
.js .card .cover-mark path { stroke-dashoffset: 1; fill-opacity: 0; }
.js .card.is-active .cover-mark path { animation: sm-shield 1.4s .2s var(--ease-draw) forwards; }
@keyframes sm-shield { 70% { stroke-dashoffset: 0; fill-opacity: 0; } 100% { stroke-dashoffset: 0; fill-opacity: 1; stroke-width: 0; } }
.js .card .spark .line { stroke-dashoffset: 1; }
.js .card.is-active .spark .line { animation: sm-draw 1.2s .7s var(--ease-draw) forwards; }
.js .card .spark .area, .js .card .spark .pt, .js .card .spark .end-label { opacity: 0; }
.js .card.is-active .spark .area { animation: sm-fade-10 .8s 1.4s forwards; }
.js .card.is-active .spark .pt, .js .card.is-active .spark .end-label { animation: sm-fade .5s 1.6s forwards; }
@keyframes sm-draw { to { stroke-dashoffset: 0; } }
@keyframes sm-fade { to { opacity: 1; } }
@keyframes sm-fade-10 { to { opacity: .1; } }
.js .card .bar { transform: scaleX(0); }
.js .card.is-active .bar { transform: scaleX(1); transition: transform .9s var(--ease-draw); }
.js .card.is-active .bars li:nth-child(1) .bar { transition-delay: .45s; }
.js .card.is-active .bars li:nth-child(2) .bar { transition-delay: .55s; }
.js .card.is-active .bars li:nth-child(3) .bar { transition-delay: .65s; }
.js .card.is-active .bars li:nth-child(4) .bar { transition-delay: .75s; }
.js .card.is-active .bars li:nth-child(5) .bar { transition-delay: .85s; }
.js .card .flow li::before { transform: translateY(-50%) rotate(45deg) scale(0); transition: transform .4s var(--ease); }
.js .card.is-active .flow li::before { transform: translateY(-50%) rotate(45deg) scale(1); }
.js .card.is-active .flow li:nth-child(2)::before { transition-delay: .35s; }
.js .card.is-active .flow li:nth-child(3)::before { transition-delay: .6s; }
.js .card.is-active .flow li:nth-child(4)::before { transition-delay: .85s; }

@media (min-width: 760px) {
  .best { grid-template-columns: minmax(0, 1fr) auto; gap: clamp(32px, 6vw, 72px); }
  .phone { width: 220px; }
}

@media (max-width: 560px) {
  .spark .axis text { font-size: 28px; }
  .spark .end-label { font-size: 32px; }
  .sm-sample { font-size: 0; gap: 0; }
  .sm-sample strong { font-size: .68rem; }
  .sm-brand span { font-size: .875rem; }
  .best-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phone { width: 150px; }
  .sm-btn { min-width: 0; }
  .sm-btn span { display: none; }
  .sm-btn { width: 56px; padding: 0; }
}

@media (max-height: 700px) {
  .js .card { padding-top: 28px; }
  .hero-figure { font-size: clamp(3.6rem, 12vw, 6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .js .card { transform: none !important; }
  .js .card [data-in] { opacity: 1; transform: none; }
  .js .card .bar { transform: none; }
  .js .card .spark .line, .js .card .cover-mark path { stroke-dashoffset: 0; fill-opacity: 1; }
  .js .card .spark .area { opacity: .1; }
  .js .card .spark .pt, .js .card .spark .end-label { opacity: 1; }
}
