/* ============================================================
   GZ IAO — design polish layer
   Loads last. Typography, motion, depth, and micro-interaction.
   ============================================================ */

:root {
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-serif: "Spectral", Georgia, serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --glow-gold: 0 0 28px #63dfca1f;
  --glow-violet: 0 0 34px #8b5cf61f;
  --lift: 0 18px 40px #00000055;
}

html[data-theme="light"] {
  --lift: 0 12px 28px #1a2a3816;
  --glow-gold: 0 0 24px #24766a10;
  --glow-violet: 0 0 24px #6a54c910;
}

/* ---------------- typography ---------------- */

body {
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
.entry-copy h1,
.panel h2,
.hero-copy h1,
.mp-head h1,
.gate-hero h1,
.deck-head h1,
.rec-card h3,
.directive-body h3,
.corr-card h3,
.profile-card h3,
.modal-title,
.finding h3,
.empty-center b,
.drop-zone b,
.paper input {
  font-family: var(--font-display) !important;
  font-weight: 500;
  letter-spacing: -0.012em;
}

.entry-copy h1,
.hero-copy h1,
.mp-head h1,
.gate-hero h1 {
  font-weight: 500;
  letter-spacing: -0.022em;
}

.panel-sub,
.oracle-read,
.deck-line,
.entry-copy p,
.mp-head p,
.rec-card > p,
.directive-body p,
.corr-card p,
.warn-note,
.tmpl span,
.paper textarea,
.gate-setup {
  font-family: var(--font-serif) !important;
}

/* small caps labels get the UI face for crispness */
.kicker,
.entry-kicker,
.strip-cell small,
.oracle-facts small,
.directive-meta small,
.stat-card small,
.side-section > header b,
.mp-footer,
.privacy-row,
.chart-legend,
.intake label,
.pill-status,
.top-state,
.ghost-btn,
.prime-btn,
.entry-signin,
.theme-toggle,
.deck-stat span,
.evi-card small,
.chrono-status,
.layer-list em,
.profile-facts small,
.corr-card .c-kicker,
.grade-cell small {
  font-family: var(--font-ui);
  font-feature-settings: "tnum" 1;
}

/* numerals in stat positions read better with lining figures */
.deck-stat b,
.strip-cell b,
.stat-card b,
.big-score b,
.money,
.ring-value b,
.pulse-stat b,
.bar-row b,
.score-ring b {
  font-family: var(--font-display);
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.01em;
}

::selection {
  background: #63dfca38;
  color: var(--paper);
}

/* ---------------- surfaces & depth ---------------- */

.panel,
.stat-card,
.ql,
.strip-cell,
.directive,
.hero,
.ledger-tabs,
.tabbar,
.mod-index,
.grade-track,
.corr-card,
.profile-card {
  position: relative;
  transition:
    border-color 0.3s var(--ease),
    box-shadow 0.3s var(--ease),
    transform 0.3s var(--ease);
}

.panel::after,
.hero::after,
.directive::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #ffffff14 22%, #ffffff14 78%, transparent);
  pointer-events: none;
  border-radius: inherit;
}

html[data-theme="light"] .panel::after,
html[data-theme="light"] .hero::after,
html[data-theme="light"] .directive::after {
  background: linear-gradient(90deg, transparent, #00000010 22%, #00000010 78%, transparent);
}

.panel:hover,
.corr-card:hover {
  border-color: var(--panel-line-bright);
  box-shadow: var(--lift);
}

.stat-card:hover,
.profile-card:not(.is-ghost):hover {
  transform: translateY(-2px);
  box-shadow: var(--lift);
}

.hero {
  box-shadow: var(--glow-gold), 0 24px 60px #00000040;
}

.oracle-panel {
  box-shadow: var(--glow-violet), 0 20px 50px #00000045;
}

/* ---------------- motion ---------------- */

@keyframes gz-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes gz-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes gz-breathe {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.content > section,
.content > div {
  animation: gz-rise 0.5s var(--ease) both;
}

.content > *:nth-child(1) { animation-delay: 0.02s; }
.content > *:nth-child(2) { animation-delay: 0.06s; }
.content > *:nth-child(3) { animation-delay: 0.1s; }
.content > *:nth-child(4) { animation-delay: 0.14s; }
.content > *:nth-child(5) { animation-delay: 0.18s; }
.content > *:nth-child(6) { animation-delay: 0.22s; }
.content > *:nth-child(n + 7) { animation-delay: 0.26s; }

.entry-hero,
.entry-modules,
.gate-hero {
  animation: gz-rise 0.6s var(--ease) both;
}

.entry-modules {
  animation-delay: 0.12s;
}

.entry-seal {
  animation: gz-fade 1.1s var(--ease) both;
}

.top-state i,
.pill-status i,
.hero-kicker i,
.now-line i {
  animation: gz-breathe 3.4s ease-in-out infinite;
}

/* ---------------- controls ---------------- */

.ghost-btn,
.prime-btn,
.entry-signin,
.theme-toggle,
.side-signout,
.chips button,
.seg button,
.chrono-open,
.ask-chips button,
.vault-form button,
.deck-signout {
  transition:
    color 0.2s var(--ease),
    background 0.2s var(--ease),
    border-color 0.2s var(--ease),
    transform 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}

.ghost-btn:hover,
.vault-form button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px #00000040;
}

.prime-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px #63dfca2e;
}

.prime-btn:active,
.ghost-btn:active,
.entry-signin:active {
  transform: translateY(0);
}

.top-cap {
  transition: transform 0.25s var(--ease), filter 0.2s var(--ease);
  box-shadow: 0 0 24px #63dfca2e;
}

.top-cap:hover {
  transform: rotate(90deg) scale(1.06);
}

.side-item {
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.side-item strong {
  transition: color 0.2s var(--ease), letter-spacing 0.2s var(--ease);
}

.side-item:hover strong {
  color: var(--gold);
}

.side-item.is-active {
  box-shadow: inset 0 0 26px #63dfca0d;
}

.ql-item,
.ledger-tab,
.grade-cell,
.tmpl {
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.grade-cell:hover,
.tmpl:hover {
  background: #63dfca0a;
}

.evi-card {
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease);
}

.evi-card:hover {
  border-color: var(--gold-soft);
  transform: translateY(-2px);
}

/* focus visibility */

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 3px #63dfca1c;
}

/* ---------------- rings & glyphs ---------------- */

.ring {
  transition: background 0.6s var(--ease);
}

.ring-wrap::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed var(--panel-line);
  opacity: 0.5;
  pointer-events: none;
}

.hero-seal,
.brand-mark {
  transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease);
}

.entry-brand:hover .brand-mark,
.side-head:hover .brand-mark {
  box-shadow: 0 0 26px #63dfca33;
}

.empty-center .glyph {
  animation: gz-breathe 4.2s ease-in-out infinite;
}

/* ---------------- lists & tables ---------------- */

.vault-list li,
.chrono-list li,
.table-lite tr {
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.vault-list li:hover {
  border-color: var(--panel-line-bright);
  background: #ffffff05;
}

.table-lite tbody tr:hover {
  background: #63dfca08;
}

/* ---------------- scrollbars ---------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--panel-line-bright) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--panel-line-bright);
  border: 3px solid transparent;
  background-clip: content-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-soft);
  background-clip: content-box;
}

/* ---------------- toast ---------------- */

@keyframes gz-toast {
  from {
    opacity: 0;
    transform: translate(-50%, 14px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.toast {
  animation: gz-toast 0.3s var(--ease) both;
  backdrop-filter: blur(8px);
}

.modal {
  animation: gz-fade 0.2s var(--ease) both;
  backdrop-filter: blur(3px);
}

.modal .gate-panel {
  animation: gz-rise 0.3s var(--ease) both;
  box-shadow: var(--lift);
}

/* ---------------- rhythm & hierarchy ---------------- */

.panel {
  padding: 26px 30px 28px;
  border-radius: 14px;
}

.content {
  gap: 20px;
  padding-top: 30px;
}

.panel h2,
.deck-head h1 {
  font-size: 26px;
  line-height: 1.15;
  margin: 10px 0 6px;
}

.panel-sub {
  font-size: 13px;
  line-height: 1.75;
  max-width: 74ch;
}

.kicker {
  font-size: 8.5px;
  letter-spacing: 0.26em;
  font-weight: 600;
}

/* sidebar refinement — nav scrolls, identity stays pinned */

.side {
  overflow: hidden;
}

.side > nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.side-foot {
  background: var(--side-bg);
  box-shadow: 0 -12px 24px -12px #00000060;
}

.side-item {
  padding: 11px 24px;
}

.side-item strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.side-item span {
  font-size: 10.5px;
  opacity: 0.85;
}

.side-section {
  padding: 16px 0 6px;
}

.side-section + .side-section {
  border-top: 1px solid var(--panel-line);
}

.side-section > header b {
  font-size: 8.5px;
  letter-spacing: 0.26em;
  font-weight: 600;
}

.side-head {
  min-height: 96px;
}

/* hero */

.hero {
  padding: 34px 38px;
  border-radius: 14px;
}

.hero-copy h1 {
  margin: 10px 0 10px;
}

.hero-seal {
  width: 80px;
  height: 80px;
  box-shadow:
    0 0 40px #63dfca24,
    inset 0 0 24px #63dfca12;
}

.hero-seal span {
  font-size: 16px;
}

/* strip + stat cards */

.strip {
  gap: 1px;
}

.strip-cell {
  padding: 18px 22px;
}

.strip-cell b {
  font-size: 16px;
}

.stat-card {
  padding: 18px 22px;
  border-radius: 12px;
}

.stat-card b {
  font-size: 32px;
  margin: 12px 0 5px;
}

/* module page heads */

.mp-head {
  padding: 12px 4px 22px;
}

.mp-head h1 {
  margin: 10px 0 10px;
}

.mp-head p {
  font-size: 13.5px;
  line-height: 1.75;
}

/* quiet the grid overlay on the entry page a touch */

.entry-grid {
  opacity: 0.26;
}

/* landing modules */

.entry-modules article {
  padding: 16px 19px;
  transition: background 0.25s var(--ease);
}

.entry-modules article:hover {
  background: #63dfca12;
}

/* ---------------- sharing controls ---------------- */

.share-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: none;
  font-family: var(--font-ui);
  font-size: 10.5px;
}

.share-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.share-toggle > span {
  width: 34px;
  height: 18px;
  border: 1px solid var(--panel-line-bright);
  border-radius: 999px;
  position: relative;
  flex: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.share-toggle > span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--faint);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}

.share-toggle input:checked + span {
  background: #63dfca24;
  border-color: var(--gold-soft);
}

.share-toggle input:checked + span::after {
  transform: translateX(16px);
  background: var(--gold);
}

.share-toggle input:focus-visible + span {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.share-row {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.share-row small {
  color: var(--faint);
  font-size: 9.5px;
}

.share-badge {
  margin-left: 10px;
  padding: 2px 7px;
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  color: var(--gold);
  font-family: var(--font-ui);
  font-style: normal;
  font-size: 7px;
  letter-spacing: 0.16em;
  vertical-align: 2px;
}

.rec-actions-row {
  grid-column: 1 / -1;
  justify-self: end;
  display: flex;
  gap: 14px;
}

.vault-list .rec-actions-row button {
  border: 0;
  background: none;
  color: var(--faint);
  padding: 0;
  cursor: pointer;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-ui);
  font-size: 7px;
  transition: color 0.2s var(--ease);
}

.vault-list .rec-actions-row button:hover {
  color: var(--gold);
}

.vault-list .rec-actions-row button.is-destroy:hover {
  color: #d98181;
}

.vault-list .rec-actions-row button:disabled {
  cursor: default;
  opacity: 0.6;
}

.side-field {
  border-top: 1px solid var(--panel-line);
  padding: 12px 24px 0;
  color: var(--faint);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.side-field i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  flex: none;
}

/* ---------------- accessibility ---------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
