/* PulseCap — Visual DNA: gym clipboard / rubber mat / chalk
   Capricorn lock: accent tokens stay in base.css + capricorn-core.css */

:root {
  --journal-gold: rgba(255, 224, 74, 0.55);
  --journal-cyan: rgba(0, 242, 255, 0.45);
  --journal-paper: rgba(247, 243, 234, 0.92);
  --journal-chalk: rgba(26, 24, 20, 0.88);
  --journal-ink: rgba(10, 10, 15, 0.88);
  --journal-rule: rgba(139, 119, 80, 0.22);
  /* Cap chrome follows Ember accent (orange); red reserved for danger */
  --cap-accent: var(--pc-ff7a1a);
  --cap-accent-contrast: var(--pc-ffffff);
  --cap-accent-soft: rgba(255, 69, 58, 0.14);
}

[data-theme="light"] {
  --cap-accent: var(--pc-c41e3a);
  --cap-accent-soft: rgba(196, 30, 58, 0.12);
}

/* ── Typography (Capricorn lock — display + body split) ── */
h1, .topbar-title, .sh-t, .ob-title, .splash-word {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
}

.topbar-greeting, .row-title {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
}

.dash-stat-n, .stat-v, .readiness-score {
  font-family: var(--font-display-nums);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.topbar-sub, .stat-l, .field-label, .micro-label {
  letter-spacing: 0.02em;
  text-transform: none;
  font-size: 11px;
  font-weight: 700;
}

/* ── Boot splash — fixed overlay (content paints underneath for LCP) ── */
.clipboard-splash {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse 110% 70% at 50% 110%, rgba(0, 0, 0, 0.55), transparent 58%),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 3px,
      rgba(255, 255, 255, 0.012) 3px,
      rgba(255, 255, 255, 0.012) 4px
    ),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='r'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23r)' opacity='0.22'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--pc-0e0e0e) 0%, var(--pc-121212) 48%, var(--pc-0a0a0a) 100%);
}

.clipboard-splash--out {
  animation: clipboardSplashOut 0.18s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)) both;
  pointer-events: none;
}

@keyframes clipboardSplashOut {
  to { opacity: 0; transform: scale(1.02); }
}

.clipboard-board {
  position: relative;
  width: min(268px, 74vw);
  /* Single short entrance — no infinite bounce (kept first-visit ≤1s). */
  animation: clipboardBoardIn 0.4s cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

@keyframes clipboardBoardIn {
  from { opacity: 0; transform: scale(0.82) translateY(18px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.clipboard-clip {
  position: relative;
  z-index: 2;
  width: 76px;
  height: 30px;
  margin: 0 auto -10px;
  border-radius: 7px 7px 3px 3px;
  background: linear-gradient(180deg, var(--pc-5a5a60) 0%, var(--pc-35353a) 42%, var(--pc-1e1e22) 100%);
  box-shadow:
    0 3px 10px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.clipboard-clip::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 9px;
  border-radius: 2px;
  background: var(--pc-141416);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.65);
}

.clipboard-paper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 34px 24px 30px;
  border-radius: 10px;
  background: linear-gradient(168deg, var(--pc-242422) 0%, var(--pc-1a1a18) 55%, var(--pc-141412) 100%);
  border: 2px solid rgba(255, 255, 255, 0.07);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 69, 58, 0.08) inset,
    4px 6px 0 rgba(0, 0, 0, 0.28);
}

[data-theme="light"] .clipboard-paper {
  background: linear-gradient(168deg, var(--pc-f0ebe3) 0%, var(--pc-e4ddd2) 55%, var(--pc-d8d0c4) 100%);
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.18),
    4px 6px 0 rgba(139, 119, 80, 0.15);
}

.clipboard-chalk {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: inherit;
}

.clipboard-chalk__mark {
  position: absolute;
  display: block;
  height: 3px;
  border-radius: 2px;
  opacity: 0.55;
  transform-origin: left center;
}

.clipboard-chalk__mark--1 {
  top: 18%;
  left: 8%;
  width: 42%;
  background: rgba(255, 255, 255, 0.22);
  transform: rotate(-8deg);
}

.clipboard-chalk__mark--2 {
  top: 72%;
  right: 10%;
  width: 36%;
  background: rgba(255, 59, 48, 0.45);
  transform: rotate(6deg);
}

.clipboard-chalk__mark--3 {
  bottom: 14%;
  left: 12%;
  width: 28%;
  height: 2px;
  background: rgba(255, 255, 255, 0.14);
  transform: rotate(-14deg);
}

.clipboard-pulse {
  width: min(120px, 40vw);
  height: auto;
  filter: drop-shadow(0 0 10px rgba(255, 69, 58, 0.35));
}

.clipboard-pulse__line {
  stroke-dasharray: 140;
  stroke-dashoffset: 140;
  animation: clipboardPulseDraw 0.45s 0.12s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.clipboard-pulse__dot {
  opacity: 0;
  animation: clipboardPulseDot 0.25s 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes clipboardPulseDraw {
  to { stroke-dashoffset: 0; }
}

@keyframes clipboardPulseDot {
  from { opacity: 0; transform: scale(0); }
  to   { opacity: 1; transform: scale(1); }
}

#boot-splash .splash-word {
  font-size: clamp(24px, 6vw, 30px);
  font-weight: 800;
  color: var(--txt);
  letter-spacing: -0.04em;
  animation: splashFade 0.35s 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#boot-splash .splash-tag {
  font-size: 13px;
  color: var(--txt3);
  font-weight: 500;
  text-align: center;
  line-height: 1.45;
  max-width: 220px;
  animation: splashFade 0.35s 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#boot-splash .splash-skip-hint {
  font-size: 11px;
  color: var(--txt3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
  animation: splashFade 0.3s 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes splashFade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Today screen — journal page surface ── */
#view > .screen:has(.row-title) {
  position: relative;
}

#view > .screen:has(.row-title)::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='0.5'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, transparent, transparent 31px, var(--journal-rule) 31px, var(--journal-rule) 32px);
}

[data-theme="dark"] #view > .screen:has(.row-title)::before {
  opacity: 0.35;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='c'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)' opacity='0.25'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(255,255,255,0.025) 27px, rgba(255,255,255,0.025) 28px);
}

#view > .screen:has(.row-title) > * {
  position: relative;
  z-index: 1;
}

/* Stamped journal entries — stat + quest cards */
#view > .screen:has(.row-title) div:has(> .dash-stat-n),
#view > .screen:has(.row-title) .stats-row .stat,
#view > .screen:has(.row-title) div[onclick*="quests"] {
  background: var(--journal-chalk) ;
  border: 1px dashed var(--journal-gold) ;
  border-radius: 4px 12px 12px 4px ;
  box-shadow:
    2px 3px 0 rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.04) ;
  position: relative;
}

[data-theme="light"] #view > .screen:has(.row-title) div:has(> .dash-stat-n),
[data-theme="light"] #view > .screen:has(.row-title) .stats-row .stat,
[data-theme="light"] #view > .screen:has(.row-title) div[onclick*="quests"] {
  background: var(--journal-paper) ;
  border-color: var(--journal-cyan) ;
  box-shadow:
    2px 3px 0 rgba(139, 119, 80, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.6) ;
}

/* Sparingly: alternate stamp accent on quest card only */
#view > .screen:has(.row-title) div[onclick*="quests"] {
  border-style: dashed ;
  border-width: 1.5px ;
}

#view > .screen:has(.row-title) div:has(> .dash-stat-n):nth-child(2),
#view > .screen:has(.row-title) .stats-row .stat:nth-child(2) {
  border-color: var(--journal-cyan) ;
}

/* Quest active state keeps subtle gradient under stamp */
#view > .screen:has(.row-title) div[onclick*="quests"]:not(:has(.muted-12:only-child)) {
  background-image: linear-gradient(135deg, rgba(0, 242, 255, 0.04), rgba(255, 224, 74, 0.03)) ;
}

/* ── Empty states — blank journal page ── */
.cap-empty {
  position: relative;
  background: var(--journal-chalk) ;
  border: 1.5px dashed var(--journal-gold) ;
  border-radius: 4px 16px 16px 4px ;
  box-shadow:
    3px 4px 0 rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 2.25rem 1.5rem ;
  margin: 1rem 16px ;
}

[data-theme="light"] .cap-empty {
  background: var(--journal-paper) ;
  border-color: var(--journal-cyan) ;
  box-shadow:
    3px 4px 0 rgba(139, 119, 80, 0.1),
    inset 0 0 40px rgba(255, 255, 255, 0.4);
}

.cap-empty::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 14px;
  width: 28px;
  height: 28px;
  border: 1.5px dashed var(--journal-gold);
  border-radius: 50%;
  opacity: 0.45;
  pointer-events: none;
}

[data-theme="light"] .cap-empty::before {
  border-color: var(--journal-cyan);
  opacity: 0.35;
}

.cap-empty__icon {
  color: var(--c1);
  opacity: 0.85;
  margin-bottom: 0.85rem ;
}

.cap-empty__title {
  font-family: var(--font-display);
  font-size: 1.125rem ;
  color: var(--txt) ;
  letter-spacing: -0.025em;
}

.cap-empty__body {
  font-family: var(--font);
  color: var(--txt2) ;
  font-size: 0.8125rem;
  line-height: 1.55;
  font-style: italic;
}

.cap-empty__cta .btn-secondary {
  border-style: dashed;
  letter-spacing: 0.04em;
}

@media (prefers-reduced-motion: reduce) {
  #boot-splash { display: none !important; }
  .clipboard-board { animation: none; }
  .clipboard-pulse__line { stroke-dashoffset: 0; animation: none; }
  .clipboard-pulse__dot { opacity: 1; animation: none; }
  #boot-splash .splash-word,
  #boot-splash .splash-tag,
  #boot-splash .splash-skip-hint { animation: none; opacity: 1; transform: none; }
}

/* ── Today clipboard layout: mobile stack · desktop 3-pane ── */
.today-clipboard {
  position: relative;
}
.today-layout {
  display: block;
}
.today-rail {
  display: none;
}
.clipboard-clip {
  display: none;
}
.today-main {
  position: relative;
}
.today-main .clipboard-clip--main {
  display: block;
  width: 48px;
  height: 14px;
  margin: 0 auto 10px;
  border-radius: 3px 3px 6px 6px;
  background: linear-gradient(180deg, var(--pc-c0c4c8) 0%, var(--pc-8a9098) 100%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
  border: 1px solid rgba(0,0,0,0.25);
}
.today-rail__label {
  font-size: 11px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: 0.02em;
  color: var(--txt3);
  margin-bottom: 10px;
}
.today-body-preview {
  width: 100%;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg3);
  padding: 16px 12px;
  margin-bottom: 12px;
  cursor: pointer;
  text-align: center;
  color: inherit;
}
.today-body-preview__ring {
  width: 72px;
  height: 72px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--score-color, var(--c1)) 55%, transparent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--score-color, var(--c1)) 10%, transparent);
}
.today-body-preview__score {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 22px;
  line-height: 1;
  color: var(--score-color, var(--c1));
}
.today-body-preview__cap {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--txt3);
}
.today-body-preview__hint {
  font-size: 11px;
  color: var(--txt3);
}
.today-pr-row {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  color: inherit;
}
.today-pr-row__name {
  font-size: 12px;
  font-weight: 700;
  color: var(--txt);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.today-pr-row__stat {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 20px;
  color: var(--c1);
  line-height: 1.1;
  margin-top: 2px;
}
.today-pr-row__stat span {
  font-size: 11px;
  font-family: var(--font);
  font-weight: 600;
  color: var(--txt3);
  margin-left: 3px;
}
.today-pr-row__meta {
  font-size: 11px;
  color: var(--txt3);
  margin-top: 2px;
}
.today-pr-empty {
  padding: 12px 4px;
}
.today-pr-all {
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--c1);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 8px 0;
}

@media (min-width: 900px) {
  #view > .screen:has(.today-clipboard) {
    max-width: 1280px;
  }
  .today-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 240px;
    gap: 18px;
    align-items: start;
    padding: 0 8px;
  }
  .today-rail {
    display: block;
    position: sticky;
    top: 12px;
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 14px 12px;
    box-shadow: 3px 4px 0 rgba(0,0,0,0.18);
  }
  .today-rail .clipboard-clip {
    display: block;
    width: 36px;
    height: 10px;
    margin: -20px auto 12px;
    border-radius: 2px 2px 4px 4px;
    background: linear-gradient(180deg, var(--pc-c0c4c8) 0%, var(--pc-8a9098) 100%);
    border: 1px solid rgba(0,0,0,0.25);
  }
  .today-main {
    background: var(--bg2);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 8px 0 16px;
    box-shadow: 4px 5px 0 rgba(0,0,0,0.2);
  }
  .today-main .clipboard-clip--main {
    width: 56px;
    height: 16px;
  }
  .today-mobile-muscles {
    display: none;
  }
  /* Stamp-in cards on desktop */
  .today-main > div {
    animation: clipboardStamp 0.18s both;
  }
}

@keyframes clipboardStamp {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .today-main > div { animation: none; }
}
