/* Goroshi LLC — ATC Daily Glance Card
 * Apple-neutral palette locked per feedback_public_aesthetic_neutral_only.md
 * One-screen card. iPhone 17 Pro Max viewport (430x932) without scroll.
 * Extends shared dad-packet conventions (tokens, type stack) — standalone for portability.
 */

:root {
  /* WHY: locked Apple-neutral tokens — identical to dad-packet style.css for portal-wide visual cohesion */
  --bg:        #FFFFFF;
  --ink:       #1D1D1F;
  --muted:     #6E6E73;
  --faint:     #86868B;
  --hairline:  rgba(0,0,0,0.08);
  --hairline-faint: rgba(0,0,0,0.04);
  --link:      #0066CC;
}

html { color-scheme: light; }
* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--ink);
  /* WHY: SF Pro Display preferred when present (matches portal + sales); Helvetica Neue fallback */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern","liga","calt","tnum";
}

/* WHY: SR-only skip link — accessibility floor, never visible unless tab-focused */
.skip {
  position: absolute; left: -9999px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.skip:focus {
  position: static; width: auto; height: auto;
  padding: 8px 12px; background: var(--ink); color: var(--bg);
}

/* =======================================================================
 * CARD CONTAINER — centered single column, 100dvh, generous whitespace.
 * 430x932 iPhone 17 Pro Max baseline; up-scales to desktop unchanged.
 * ======================================================================= */
.glance {
  /* WHY: dvh (dynamic viewport) accounts for iOS Safari bottom bar collapse on scroll */
  min-height: 100dvh;
  max-width: 430px;
  margin: 0 auto;
  /* WHY: safe-area-inset top/bottom honors notch + home indicator on iPhone */
  padding:
    max(20px, env(safe-area-inset-top) + 12px)
    24px
    max(20px, env(safe-area-inset-bottom) + 12px);
  display: flex;
  flex-direction: column;
  /* WHY: gap chains evenly between head/hero/compare/rule/sub/foot — no margin collapse weirdness */
  gap: 14px;
}

/* =======================================================================
 * HEAD — small eyebrow + date. ~28px total height.
 * ======================================================================= */
.glance-head { text-align: left; }
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.glance-date {
  font-size: 14px;
  color: var(--faint);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* =======================================================================
 * HERO — the ONE big number. 56pt clamp(48..72), -0.035em tracking.
 * This is what Dad sees in 3 seconds.
 * ======================================================================= */
.hero-stat {
  /* WHY: micro-gap above hero label for breathing room without burning vertical budget */
  padding: 4px 0 6px;
}
.hero-label {
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}
.hero-value {
  display: block;
  /* WHY: fluid 44-64px — calibrated so "$16,295.27" (10 glyphs incl punctuation) fits within
   *      382px content-box (430 viewport - 24px*2 padding) on iPhone 17 Pro Max baseline.
   *      Per §23.3 letter-spacing -0.035em is per-size-graded for type >48px. */
  font-size: clamp(44px, 12.5vw, 64px);
  font-weight: 600;
  line-height: 1.0;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  /* WHY: text-wrap balance prevents lonely "$" on its own line when number wraps */
  text-wrap: balance;
  /* WHY: nowrap on the hero value — we'd rather it scale fluidly than wrap mid-number */
  white-space: nowrap;
}
.stale-flag {
  margin-top: 8px;
  font-size: 13px;
  color: var(--ink);
  /* WHY: TEXT-only stale indicator per locked memory — no red color, no urgency styling */
  font-weight: 500;
  letter-spacing: -0.005em;
  border-left: 2px solid var(--hairline);
  padding-left: 8px;
}

/* =======================================================================
 * COMPARE ROW — 3 mini-stats, vertical stack on phone, single line on wider.
 * Variance shown as TEXT prefix ("+8.2%") — no colors, no arrows.
 * ======================================================================= */
.compare-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--hairline-faint);
  border-bottom: 1px solid var(--hairline-faint);
}
.compare-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  /* WHY: 44pt min height = Apple HIG tap target floor (card is read-only but consistency matters) */
  min-height: 36px;
}
.compare-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.005em;
  /* WHY: whitespace nowrap keeps "+8.2%" from breaking across lines on narrow widths */
  white-space: nowrap;
  flex-shrink: 0;
}
.compare-label {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  line-height: 1.3;
  text-wrap: balance;
  /* WHY: anti-clip — 4-digit year was truncating to "vs May 6, 202" at 430px viewport (audit 2026-05-14).
   *      max-width caps label to ~60% of row so 2-line wrap kicks in before edge-clip. */
  max-width: 60%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* WHY: thin horizontal divider between compares and sub-grid */
.rule-faint {
  border: 0;
  height: 1px;
  background: var(--hairline-faint);
  margin: 0;
}

/* =======================================================================
 * SUB-GRID — 4 sub-stats in 2x2. Smaller type, label below value.
 * ======================================================================= */
.sub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  padding: 2px 0;
}
.sub-item { text-align: left; }
.sub-value {
  font-size: 19px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.sub-label {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0;
}

/* =======================================================================
 * FOOT — single link + meta. 44pt tap target for the link.
 * ======================================================================= */
.glance-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--hairline-faint);
}
.foot-link {
  display: block;
  /* WHY: 44pt Apple HIG tap target — applies vertically via padding to keep text visually compact */
  min-height: 44px;
  padding: 12px 0;
  color: var(--link);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: -0.005em;
}
.foot-link:hover, .foot-link:focus { text-decoration: underline; }
.foot-link:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 4px; }
.foot-meta {
  font-size: 11px;
  color: var(--faint);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}

/* =======================================================================
 * LOADING SKELETON — placeholders, NOT spinners. Faint blocks pulse softly.
 * Active while aria-busy="true"; JS removes when data arrives.
 * ======================================================================= */
@keyframes skeleton-pulse {
  0%, 100% { background: var(--hairline-faint); }
  50%      { background: var(--hairline); }
}
[aria-busy="true"].hero-value {
  display: inline-block;
  width: 220px;
  height: 56px;
  color: transparent;
  border-radius: 6px;
  animation: skeleton-pulse 1.4s ease-in-out infinite;
}

/* =======================================================================
 * EMPTY STATE — replaces card content when no data for yesterday.
 * ======================================================================= */
.empty-state {
  padding: 48px 8px;
  text-align: left;
}
.empty-headline {
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: balance;
  margin-bottom: 8px;
}
.empty-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.45;
}

/* =======================================================================
 * REDUCED MOTION — kill skeleton pulse, keep static state.
 * ======================================================================= */
@media (prefers-reduced-motion: reduce) {
  [aria-busy="true"].hero-value { animation: none; background: var(--hairline-faint); }
}

/* =======================================================================
 * NARROW PHONE TIGHTENING — iPhone SE / 13 mini (375px wide) gets tighter type.
 * ======================================================================= */
@media (max-width: 380px) {
  .glance { padding-left: 18px; padding-right: 18px; gap: 12px; }
  .hero-value { font-size: clamp(38px, 11vw, 50px); }
  .sub-value { font-size: 17px; }
}
