/* =====================================================================
   SURFACES — card depth, light-mode treatment, hover motion.
   Shared by every page; load AFTER motion.css.

   Why this file exists
   --------------------
   Light mode was a pure palette swap. Every card-like element relies on a
   1px border for definition, which glows against near-black but disappears
   against cream — card-vs-page separation was 1.09:1 with no resting
   shadow anywhere. Dark UIs get depth from luminance; light UIs get it
   from shadow, and only the first was ever built.

   How it wins the cascade
   -----------------------
   Each page's own <style> block comes after this file, so equal-specificity
   rules would lose. Everything here is deliberately one step higher:
     html[data-theme="light"]     (0,1,1) beats [data-theme="light"] (0,1,0)
     [data-theme="light"] .card   (0,2,0) beats .card                (0,1,0)
     .mo-js .card                 (0,2,0) beats .card                (0,1,0)
   That keeps all seven inline stylesheets untouched.
   ===================================================================== */

/* ---------- ELEVATION TOKENS ------------------------------------------
   New names, so nothing here collides with the existing palette vars.
   Dark keeps almost no shadow — on near-black it would be invisible, and
   the gold border already does the work.                                */
:root{
  --elev-1:0 1px 2px rgba(0,0,0,.34);
  --elev-2:0 2px 6px rgba(0,0,0,.38), 0 18px 40px rgba(0,0,0,.45);
  --card-surface:linear-gradient(180deg,rgba(255,255,255,.028),rgba(255,255,255,0));
  --rule-rest:rgba(212,175,55,.22);
  --sweep:linear-gradient(90deg,var(--primary),var(--primary-dark));
}

/* ---------- LIGHT PALETTE ---------------------------------------------
   Deeper page + true white card lifts separation 1.09:1 -> 1.21:1, and the
   layered warm shadows carry the rest. Accent gold stays #7A5C1A: the
   lighter #8A6A1E fails AA on this background (4.18:1), so it is used only
   for non-text decoration below.                                         */
html[data-theme="light"]{
  --bg:#F1E9D9;
  --bg-2:#E9DFC9;
  --surface:#FFFFFF;
  --surface-2:#FBF6EA;
  --card:#FFFFFF;
  --line:rgba(122,92,26,.30);
  --line-2:rgba(122,92,26,.14);
  --glass:rgba(241,233,217,.86);
  --shadow:0 2px 6px rgba(92,70,26,.10), 0 18px 38px rgba(92,70,26,.18);

  --elev-1:0 1px 2px rgba(92,70,26,.07), 0 4px 10px rgba(92,70,26,.07);
  --elev-2:0 2px 6px rgba(92,70,26,.10), 0 18px 38px rgba(92,70,26,.18);
  --card-surface:linear-gradient(180deg,#FFFFFF 0%,#FDF8EE 100%);
  --rule-rest:rgba(122,92,26,.18);
}

/* ---------- CARD SURFACES ---------------------------------------------
   .card   index      .stat/.stat-box  project stat blocks
   .obj    objectives
   Deliberately excluded:
     .spec   seamless grid with shared cell borders — elevating individual
             cells would break the table it is meant to read as
     .find   borderless top-rule component, and on project.html it sits on
             a dark band where a light card treatment would be wrong
     .fig-frame gets resting elevation only, keeping its teal hover identity */
.mo-js .card,
.mo-js .stat,
.mo-js .stat-box,
.mo-js .obj{
  position:relative;
  overflow:hidden;
  background-image:var(--card-surface);
  box-shadow:var(--elev-1);
  transition:box-shadow .3s ease, transform .3s var(--mo-ease),
             border-color .3s ease;
}

/* Bold editorial: a standing rule across the top edge of every card.
   Drawn as an inset shadow so it costs no layout and never shifts text. */
[data-theme="light"] .card,
[data-theme="light"] .stat,
[data-theme="light"] .stat-box,
[data-theme="light"] .obj{
  box-shadow:var(--elev-1), inset 0 3px 0 var(--rule-rest);
}

/* The gold wash on .stat was built for a near-black background; on cream it
   reads as a muddy tan. Light mode gets the clean white->warm surface. */
[data-theme="light"] .stat{background-color:var(--card)}

.mo-js .fig-frame{box-shadow:var(--elev-1)}

/* ---------- HOVER: LIFT + SWEEPING ACCENT BAR -------------------------
   A gold bar slides across the top edge. transform only, so it stays on
   the compositor.                                                        */
.mo-js .card::before,
.mo-js .stat::before,
.mo-js .stat-box::before,
.mo-js .obj::before{
  content:"";position:absolute;top:0;left:0;right:0;height:3px;z-index:2;
  background:var(--sweep);
  transform:translateX(-100%);
  transition:transform .55s var(--mo-ease);
  pointer-events:none;
}
.mo-js .card:hover::before,
.mo-js .stat:hover::before,
.mo-js .stat-box:hover::before,
.mo-js .obj:hover::before,
.mo-js .card:focus-visible::before{transform:translateX(0)}

.mo-js .card:hover,
.mo-js .stat:hover,
.mo-js .stat-box:hover,
.mo-js .obj:hover{
  transform:translateY(-4px);
  box-shadow:var(--elev-2);
  border-color:var(--primary);
}
[data-theme="light"] .card:hover,
[data-theme="light"] .stat:hover,
[data-theme="light"] .stat-box:hover,
[data-theme="light"] .obj:hover{
  box-shadow:var(--elev-2), inset 0 3px 0 transparent;
}

/* .spec is a seamless grid, so it gets a wash rather than elevation. */
.mo-js .spec{transition:background-color .25s ease}
[data-theme="light"] .spec:hover{background-color:#FBF6EA}

/* ---------- SMALL PARTS ----------------------------------------------- */
[data-theme="light"] .tag{
  background:#FBF4E4;
  border-color:rgba(122,92,26,.26);
  color:#5F4711;
}
[data-theme="light"] .theme-toggle{background:rgba(255,255,255,.6)}

/* ---------- REDUCED MOTION -------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  .mo-js .card,.mo-js .stat,.mo-js .stat-box,.mo-js .obj,
  .mo-js .fig-frame,.mo-js .spec{transition:none}
  .mo-js .card::before,.mo-js .stat::before,
  .mo-js .stat-box::before,.mo-js .obj::before{display:none}
  .mo-js .card:hover,.mo-js .stat:hover,
  .mo-js .stat-box:hover,.mo-js .obj:hover{transform:none}
}
