/* ================================================================
   GRE AIYAZ — PRESS
   Loaded by every portal page and injected into every room at build
   time by tools/wire_portal.py, so one file is the whole site's
   answer to "what happens when this is touched".

   Kept apart from motion.css on purpose. That file is about things
   ARRIVING, and its room rules assume a page it knows. This one is
   about things ANSWERING, is safe on any page, and carries the exam
   exclusions that make it safe.
   ================================================================ */

/* ================================================================
   PRESS — controls that feel like objects

   Everything above is about things arriving. This is about things
   answering back when they are touched: a resting shadow so a control
   sits ON the page rather than being printed on it, a lit top edge so
   it has a thickness, a lift under the cursor, and — the part that
   actually sells it — somewhere to go when it is pushed. A control
   that does not move when you press it is what feels dead, far more
   than a flat colour does.

   Depth is built the same way each time, and never from one shadow:

     a tight shadow      the edge, so it reads as having thickness
     a wide soft shadow  the height off the page
     an inset hairline   the lit top edge — white on a dark surface,
                         nearly nothing on a cream one, which is right:
                         a pale button in daylight has no bright edge

   ---------------------------------------------------------------
   WHAT THIS DELIBERATELY DOES NOT TOUCH

   It would have been one line to write `button { … }`. That would
   have been wrong, and would have changed the most important screen
   in the portal.

   A timed mock imitates the real GRE. Its answer choices, its
   Next/Back bar and its footer are buttons in the markup, but to a
   student sitting a test they ARE the exam — and somebody who
   practises on answer choices that lift and glow meets a flat grey
   oval on test day. So every exam surface is named at the bottom of
   this file and left exactly as it was:

     the mock engine   #gre-content, .answer-choices, .answer-item,
                       .tc-opt, .qc-table, .ne-input, .hdr-btn,
                       .hdr-nav, .footer-submit
     the trainers      .opt — an answer, not an action, in every room
     the calculator    .cb, .calc-transfer, .modal-close-btn,
                       .hide-time-btn — the on-screen calculator and
                       the exam's own furniture
     anything .ex-*    the Verbal room's exam-mode chrome. Left out by
                       name: it is one letter away from being a button
                       a student presses, and one letter is not enough
                       to bet a mock on.
     exam mode         body.exam-open, .exam — AWA's timed essay, and
                       the Verbal room's exam look
     a room's page     .app is a card on the Training Rooms hub and the
                       Verbal room's whole page. Only the card is
                       lifted; the guard at the foot says why that
                       distinction is not cosmetic.

   So what follows applies to a NAMED list of things that mean "an
   action you press", and to nothing it has not been introduced to. A
   room generated tomorrow with button classes of its own stays
   untouched until someone adds them here on purpose, which is the
   right way round for a portal whose rooms are written elsewhere.
   ================================================================ */

:root {
  /* pale surfaces — cards, ghost buttons, chips */
  --press-rest: 0 1px 1px rgba(60,45,10,.14), 0 2px 4px rgba(60,45,10,.10),
                0 10px 22px rgba(60,45,10,.13);
  --press-over: 0 2px 4px rgba(90,68,12,.16), 0 6px 12px rgba(110,82,12,.14),
                0 20px 38px rgba(120,90,10,.22);
  --press-down: 0 1px 2px rgba(60,45,10,.20);
  --press-lip:  inset 0 1px 0 rgba(255,255,255,.9),
                inset 0 -2px 0 rgba(60,45,10,.055);
  /* The sheen. background-IMAGE only, so the colour underneath — which
     the theme owns — is never touched. On a pale card this is most of
     what makes it read as curved rather than printed. */
  --press-sheen: linear-gradient(180deg, rgba(255,255,255,.72), rgba(255,255,255,0) 58%);
  /* dark objects — the solid button, the top bar, the dock */
  --press-rest-d: 0 1px 1px rgba(15,10,2,.5), 0 2px 5px rgba(15,10,2,.34),
                  0 8px 18px rgba(15,10,2,.30);
  --press-over-d: 0 2px 5px rgba(15,10,2,.5), 0 14px 30px rgba(15,10,2,.42);
  --press-down-d: 0 1px 2px rgba(15,10,2,.55);
  --press-lip-d:  inset 0 1px 0 rgba(255,255,255,.22),
                  inset 0 -2px 0 rgba(0,0,0,.34);
  --press-sheen-d: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,0) 62%);
}
:root[data-theme="dark"] {
  --press-rest: 0 1px 1px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.45),
                0 10px 24px rgba(0,0,0,.45);
  --press-over: 0 2px 6px rgba(0,0,0,.6), 0 20px 40px rgba(0,0,0,.55);
  --press-down: 0 1px 2px rgba(0,0,0,.62);
  --press-lip:  inset 0 1px 0 rgba(255,255,255,.13),
                inset 0 -2px 0 rgba(0,0,0,.30);
  --press-sheen: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,0) 58%);
  --press-rest-d: 0 1px 1px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.48),
                  0 8px 20px rgba(0,0,0,.45);
  --press-over-d: 0 2px 6px rgba(0,0,0,.62), 0 14px 32px rgba(0,0,0,.58);
  --press-down-d: 0 1px 2px rgba(0,0,0,.66);
  --press-lip-d:  inset 0 1px 0 rgba(255,255,255,.18),
                  inset 0 -2px 0 rgba(0,0,0,.42);
  --press-sheen-d: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0) 62%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --press-rest: 0 1px 1px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.45),
                  0 10px 24px rgba(0,0,0,.45);
    --press-over: 0 2px 6px rgba(0,0,0,.6), 0 20px 40px rgba(0,0,0,.55);
    --press-down: 0 1px 2px rgba(0,0,0,.62);
    --press-lip:  inset 0 1px 0 rgba(255,255,255,.13),
                  inset 0 -2px 0 rgba(0,0,0,.30);
    --press-sheen: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,0) 58%);
    --press-rest-d: 0 1px 1px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.48),
                    0 8px 20px rgba(0,0,0,.45);
    --press-over-d: 0 2px 6px rgba(0,0,0,.62), 0 14px 32px rgba(0,0,0,.58);
    --press-down-d: 0 1px 2px rgba(0,0,0,.66);
    --press-lip-d:  inset 0 1px 0 rgba(255,255,255,.18),
                    inset 0 -2px 0 rgba(0,0,0,.42);
    --press-sheen-d: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,0) 62%);
  }
}

/* One curve and one pair of timings for every control on the site, so
   a button in the Runbook and a card in Quant answer identically. */
:root {
  --press-t: 170ms;
  --press-t-down: 90ms;          /* a press must land AT the finger */
}

/* ---------- dark objects: the solid button, the dock ----------
   The top bar's buttons were here until Oct 2026. The bar is plain
   words now, Apple's way (portal.css), and a word has nothing to press. */
:root .btn:not(.ghost),
:root .bigbtn:not(.ghost),
:root #ga-note-btn,
:root #ga-dock #ga-back, :root #ga-dock #ga-home {
  box-shadow: var(--press-rest-d), var(--press-lip-d);
  background-image: var(--press-sheen-d);
  transition: box-shadow var(--press-t) var(--ga-ease, ease),
              transform var(--press-t) var(--ga-ease, ease),
              background-color var(--press-t) ease,
              border-color var(--press-t) ease;
}

/* ---------- pale objects: ghosts, chips, the small console buttons ---------- */
:root .btn.ghost, :root .bigbtn.ghost, :root .chip,
:root .addbtn, :root .myedit, :root .gobtn, :root .offbtn, :root .resetb,
:root .iconbtn, :root .themebtn, :root .dbtn, :root .mini-btn, :root .psel {
  box-shadow: var(--press-rest), var(--press-lip);
  background-image: var(--press-sheen);
  transition: box-shadow var(--press-t) var(--ga-ease, ease),
              transform var(--press-t) var(--ga-ease, ease),
              background-color var(--press-t) ease,
              border-color var(--press-t) ease;
}

/* ---------- the big surfaces ----------
   The room cards on the hub, Quant's module tiles, the set rows, the
   Runbook's picker. These already rose under the cursor; they were
   missing weight at rest and anywhere to go when pushed.

   `.app` is written `body.pg .app`, and the `body.pg` is load-bearing.
   On the Training Rooms hub `.app` is a room card. In the Verbal room
   `.app` is the page itself — the wrapper holding the fixed sidebar and
   the full-screen timed-reading layer. Same five letters, opposite
   jobs, and lifting the second one strobes the screen; see the guard at
   the foot of this file for why. Only the portal's own pages carry
   `body.pg`, so this reaches the card and can never reach the room. */
:root body.pg .app,
:root .mod, :root .setrow, :root .rbcard, :root .sec-tile,
:root .hcard, :root .mod-row, :root .pt-row, :root .vrow {
  box-shadow: var(--press-rest), var(--press-lip);
  background-image: var(--press-sheen);
  transition: box-shadow 200ms var(--ga-ease, ease),
              transform 200ms var(--ga-ease, ease),
              border-color 200ms ease;
}

/* ---------- under the cursor ---------- */
@media (hover: hover) {
  :root .btn:not(.ghost):hover:not(:disabled),
  :root .bigbtn:not(.ghost):hover:not(:disabled),
  :root #ga-note-btn:hover,
  :root #ga-dock #ga-back:hover, :root #ga-dock #ga-home:hover {
    box-shadow: var(--press-over-d), var(--press-lip-d);
    transform: translateY(-2px);
  }
  :root .btn.ghost:hover:not(:disabled), :root .bigbtn.ghost:hover:not(:disabled),
  :root .chip:hover, :root .addbtn:hover, :root .myedit:hover,
  :root .gobtn:hover, :root .offbtn:hover,
  :root .iconbtn:hover, :root .themebtn:hover, :root .dbtn:hover,
  :root .mini-btn:hover, :root .psel:hover {
    box-shadow: var(--press-over), var(--press-lip);
    transform: translateY(-2px);
  }
  :root body.pg .app:hover, :root .mod:hover, :root .setrow:hover,
  :root .rbcard:hover, :root .sec-tile:hover,
  :root .hcard:hover, :root .mod-row:hover, :root .pt-row:hover, :root .vrow:hover {
    box-shadow: var(--press-over), var(--press-lip);
    transform: translateY(-3px);
  }
}

/* ---------- and the press ---------- */
:root .btn:active:not(:disabled), :root .bigbtn:active:not(:disabled),
:root #ga-note-btn:active,
:root #ga-dock #ga-back:active, :root #ga-dock #ga-home:active {
  transform: translateY(1px);
  box-shadow: var(--press-down-d), var(--press-lip-d);
  transition-duration: var(--press-t-down);
}
:root .chip:active, :root .addbtn:active, :root .myedit:active,
:root .gobtn:active, :root .offbtn:active, :root .resetb:active,
:root .iconbtn:active, :root .themebtn:active, :root .dbtn:active,
:root .mini-btn:active, :root .psel:active {
  transform: translateY(1px);
  box-shadow: var(--press-down);
  transition-duration: var(--press-t-down);
}
/* A card is too big to travel; it settles instead. */
:root body.pg .app:active, :root .mod:active, :root .setrow:active,
:root .rbcard:active, :root .sec-tile:active,
:root .hcard:active, :root .mod-row:active, :root .pt-row:active, :root .vrow:active {
  transform: translateY(0) scale(.992);
  box-shadow: var(--press-down);
  transition-duration: var(--press-t-down);
}

/* ---------- keyboard ----------
   Whatever the mouse is given, the Tab key is given. */
:root .btn:focus-visible, :root .bigbtn:focus-visible, :root .chip:focus-visible,
:root body.pg .app:focus-visible, :root .mod:focus-visible, :root .setrow:focus-visible,
:root .rbcard:focus-visible, :root #ga-note-btn:focus-visible {
  transform: translateY(-2px);
}

/* ================================================================
   THE EXAM IS NOT TOUCHED
   Last, so it wins over everything above however it was reached. A
   timed screen looks exactly as it looked yesterday.
   ================================================================ */
:root #gre-content .btn, :root #gre-content .bigbtn, :root #gre-content .chip,
:root .answer-choices button, :root .answer-item, :root .tc-opt,
:root .qc-table button, :root .hdr-btn, :root .hdr-nav,
:root .footer-submit, :root .ne-input,
:root .opt, :root .opts .opt, :root .qcopt, :root .qc-opts .qcopt,
:root .ansbar, :root .ansbar *,
:root body.exam-open .btn, :root body.exam-open .bigbtn,
:root body.exam-open .chip, :root body.exam-open .bar a,
:root .exam .btn, :root .exam .bigbtn, :root .exam .chip, :root .exam .opt {
  box-shadow: none;
  background-image: none;
}
:root #gre-content .btn:hover, :root #gre-content .btn:active,
:root #gre-content .bigbtn:hover, :root #gre-content .bigbtn:active,
:root .answer-choices button:hover, :root .answer-choices button:active,
:root .answer-item:hover, :root .answer-item:active,
:root .tc-opt:hover, :root .tc-opt:active,
:root .hdr-btn:hover, :root .hdr-btn:active,
:root .hdr-nav:hover, :root .hdr-nav:active,
:root .footer-submit:hover, :root .footer-submit:active,
:root .opt:hover, :root .opt:active,
:root .opts .opt:hover, :root .opts .opt:active,
:root .qcopt:hover, :root .qcopt:active,
:root body.exam-open .btn:hover, :root body.exam-open .btn:active,
:root body.exam-open .bigbtn:hover, :root body.exam-open .bigbtn:active,
:root .exam .btn:hover, :root .exam .btn:active,
:root .exam .bigbtn:hover, :root .exam .bigbtn:active,
:root .exam .opt:hover, :root .exam .opt:active {
  transform: none;
  box-shadow: none;
}

/* ================================================================
   THE GUARD — nothing that holds a pinned layer is a card

   A transform on an element makes that element the containing block
   for every position:fixed thing inside it. So a three-pixel lift on
   a wrapper takes a full-screen layer inside it and shrinks it to the
   wrapper's own box. And that is not a one-off glitch, it is a loop:
   the layer was under the cursor, now it is not, so the lift drops,
   so the layer springs back to full screen, so it is under the cursor
   again — about ten times a second, which reads as the screen
   strobing.

   It happened. `.app` is a room card on the Training Rooms hub and
   ALSO the Verbal room's whole page wrapper, which holds a fixed
   sidebar and the full-screen timed-reading layer. Scoping the lift
   above to `body.pg` fixes that one by name.

   This catches the next one. A surface holding a pinned layer is a
   page, not a card, whatever it is called — so it keeps its shadow
   and gives up its travel. The real guard is the test that walks
   every room looking for this shape; this is the belt for it.
   ================================================================ */
:root .app:has(.exam),      :root .mod:has(.exam),
:root .setrow:has(.exam),   :root .rbcard:has(.exam),
:root .sec-tile:has(.exam), :root .hcard:has(.exam),
:root .mod-row:has(.exam),  :root .pt-row:has(.exam),
:root .vrow:has(.exam),     :root .app:has(> .sidebar) {
  transform: none !important;
}

/* Somebody who has asked their machine for less movement keeps the
   depth and loses the travel. The weight was never the problem. */
@media (prefers-reduced-motion: reduce) {
  :root .btn, :root .bigbtn, :root .chip, :root .bar a, :root .bar button,
  :root body.pg .app, :root .mod, :root .setrow, :root .rbcard, :root .sec-tile,
  :root .addbtn, :root .myedit, :root .gobtn, :root .offbtn,
  :root #ga-note-btn, :root #ga-dock #ga-back, :root #ga-dock #ga-home {
    transform: none !important;
  }
}
