/* ══════════════════════════════════════════════════════════════════
   VISION SINDH — PREMIUM LAYER
   Loaded last. Everything here is polish over a page that is already
   complete without it. Rules:
     · ember is LIGHT only — rims, glows, tips, highlights. Never a fill.
     · tokens only (--ink/--paper/--ash/--line) so every rule inverts
       automatically inside .on-ink and the footer.
     · nothing here may create layout the page depends on.
   See docs/PREMIUM-IDEAS.md for the reasoning behind each block.
   ══════════════════════════════════════════════════════════════════ */

:root {
  --ember: #d9611f;
  --ember-hot: #ffcf9e;
  --bone: #e9e4da;
}

/* ═══ 1 · STRATA — how deep you are in the dig ══════════════════════
   A hairline riding the header's bottom edge. Ash track, bone fill,
   one ember coal at the working edge. Scroll-driven; native scroll
   timeline where the browser has one, rAF only where it doesn't,
   nothing at all without JS.                                        */
.strata {
  position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: rgba(233, 228, 218, 0.10);
  pointer-events: none; overflow: hidden;
}
.strata__fill {
  position: absolute; inset: 0;
  background: var(--bone);
  transform-origin: left center;
  transform: scaleX(var(--p, 0));
}
.strata__tip {
  position: absolute; top: -1px; bottom: -1px; width: 2px;
  left: calc(var(--p, 0) * 100%);
  margin-left: -1px;
  background: var(--ember-hot);
  opacity: clamp(0, calc(var(--p, 0) * 14), 1);
  box-shadow: 0 0 5px 1px var(--ember), 0 0 13px 3px rgba(217, 97, 31, 0.5);
}
@keyframes strataFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes strataTip {
  0%   { left: 0;    opacity: 0; }
  7%   { opacity: 1; }
  100% { left: 100%; opacity: 1; }
}
@supports (animation-timeline: scroll()) {
  .strata__fill { animation: strataFill linear both; animation-timeline: scroll(root block); }
  .strata__tip  { animation: strataTip  linear both; animation-timeline: scroll(root block); }
}

/* ═══ 2 · THE VEIL — object continuity across navigation ════════════
   The chrome does not move between pages; the stratum below it does.
   Browsers without View Transitions navigate exactly as before —
   the honest fallback is the current behaviour.                     */
@view-transition { navigation: auto; }
.hdr { view-transition-name: vs-chrome; }
@keyframes vsSink { to   { opacity: 0; transform: translateY(6px)  scale(0.994); } }
@keyframes vsRise { from { opacity: 0; transform: translateY(-10px); } }
::view-transition-old(root) { animation: vsSink 220ms cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vsRise 420ms cubic-bezier(0.22, 1, 0.36, 1) both; }
::view-transition-group(vs-chrome) { animation-duration: 0s; }

/* ═══ 3 · THE ROLL — the receipts, as a roll of names ═══════════════
   Built by premium.js from names already in the page. Decorative and
   marked so; the grid below remains the record.                     */
.roll {
  margin-block: clamp(26px, 4vh, 40px) clamp(30px, 5vh, 48px);
  border-block: 1px solid var(--line);
  padding-block: 15px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent);
}
.roll__track {
  display: flex; align-items: center; width: max-content;
  animation: rollRun 62s linear infinite;
}
.roll__track > span {
  font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-soft); white-space: nowrap;
}
.roll__track > i {
  flex: none; display: block; width: 3px; height: 3px;
  margin-inline: clamp(18px, 3vw, 34px);
  transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(217, 97, 31, 0.55), 0 0 7px 1px rgba(217, 97, 31, 0.5);
}
@keyframes rollRun { to { transform: translate3d(-50%, 0, 0); } }
.roll:hover .roll__track,
.roll:focus-within .roll__track { animation-play-state: paused; }

/* ═══ 4 · THE INDEX — catalogued, not collected ═════════════════════ */
.proof-grid { counter-reset: proof; }
.proof-card { counter-increment: proof; }
.proof-card figcaption { position: relative; padding-top: 12px; }
.proof-card figcaption::before {
  content: counter(proof, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.18em; color: var(--ash);
  display: block; margin-bottom: 5px;
}
.proof-card figcaption::after {
  content: ""; position: absolute; top: 0; left: 2.6em; right: 0;
  border-top: 1px solid var(--line);
}

/* ═══ 5 · SHAGUN — the auspicious rupee, finally visible ════════════
   "Every price ends in one — shagun, the auspicious rupee, encoded
   into the price list." Applied only where it is actually true.     */
.shagun { position: relative; }
.shagun::after {
  content: ""; position: absolute; left: -0.03em; right: -0.03em; bottom: -0.03em;
  height: 1px; background: var(--ember);
  box-shadow: 0 0 6px rgba(217, 97, 31, 0.85), 0 0 15px rgba(217, 97, 31, 0.42);
}
.shagun-tag {
  font-family: var(--font-display); font-weight: 400;
  font-size: 0.5em; color: var(--ash);
  margin-left: 0.6em; vertical-align: 0.52em; letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ═══ 6 · THE LAST COAL — the descent ends in ash, on every page ════
   DIRECTION.md: "…and descends again toward Last Rites and the
   footer." The footer is the floor of the dig, so it is ink
   everywhere — not only on the descent pages. The lamp is built the
   way src/models/diya.js says a lamp must be built: the flame is not
   geometry, it is a light plus an additive glow. No mesh, no GL.    */
.foot {
  position: relative;
  border-top: 0;
  --paper: #131110; --paper-2: #0d0c0a;
  --ink: #e9e4da; --ink-soft: #b5aea1;
  --ash: #7a746a; --line: #2e2a25; --white: #17150f;
  background: #0d0c0a; color: var(--ink);
}
.foot::before {                       /* the last bridge — solid stops, like .bridge */
  content: ""; position: absolute; left: 0; right: 0;
  bottom: 100%; height: clamp(56px, 10vh, 120px);
  background: linear-gradient(to bottom, #efece6, #0d0c0a);
  pointer-events: none;
}
body.descent .foot::before { background: linear-gradient(to bottom, #131110, #0d0c0a); }
.foot .wrap { position: relative; z-index: 1; }
.foot__sindhu {                       /* the mark, half-buried */
  position: absolute; left: 0; bottom: clamp(60px, 9vh, 104px); z-index: 0;
  font-family: var(--font-display); font-weight: 400;
  font-size: clamp(74px, 11vw, 152px); line-height: 0.82;
  letter-spacing: -0.01em; white-space: nowrap;
  color: color-mix(in srgb, var(--bone) 9%, transparent);
  pointer-events: none; user-select: none;
}
.foot__coal {                         /* the flame: light only */
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px; z-index: 2;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent, rgba(217, 97, 31, 0.30) 16%, rgba(217, 97, 31, 0.62) 50%,
    rgba(217, 97, 31, 0.30) 84%, transparent);
}
.foot__coal::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 132px;
  background: radial-gradient(58% 100% at 50% 100%, rgba(217, 97, 31, 0.14), transparent 72%);
}
.foot__clock {
  margin-top: 18px; color: var(--ash);
  display: flex; align-items: center; gap: 10px;
}
.foot__clock b {
  font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--ink-soft); letter-spacing: 0.1em;
}
.foot__clock::before {
  content: ""; width: 4px; height: 4px; border-radius: 50%; flex: none;
  box-shadow: 0 0 0 1px rgba(217, 97, 31, 0.5), 0 0 7px 1px rgba(217, 97, 31, 0.55);
}
@media (max-width: 780px) {
  .foot__sindhu { bottom: auto; top: clamp(30px, 6vh, 60px); opacity: 0.45; }
}

/* ═══ 10 · THE PEEL — cloth is lifted, not dissolved ════════════════
   The alternate view is uncovered by a wipe rising from the hem, and
   keeps settling out of scale after the wipe lands. Same logic as the
   spine zipper: it peels, it never snaps. Guarded, so a browser
   without clip-path keeps site.css's crossfade instead.             */
@supports (clip-path: inset(0 0 0 0)) {
  @media (prefers-reduced-motion: no-preference) {
    .card .card__alt {
      opacity: 1;
      clip-path: inset(100% 0 0 0);
      transform: scale(1.045);
      transition: clip-path 0.72s var(--ease), transform 1.25s var(--ease);
    }
    .card.is-peek .card__alt { clip-path: inset(0 0 0 0); transform: scale(1); }
  }
}

/* ═══ 7 · THE RAIL — the catalogue states its extent ════════════════ */
.shop-count { color: var(--ash); margin: -20px 0 30px; font-variant-numeric: tabular-nums; }
@media (max-width: 780px) {
  .filters {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; margin-block: 24px 26px;
    padding-inline: var(--gutter); margin-inline: calc(var(--gutter) * -1);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 46px), transparent);
            mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 46px), transparent);
  }
  .filters::-webkit-scrollbar { display: none; }
  .filters button { flex: none; }
  .shop-count { margin: -14px 0 26px; }
}

/* ═══ 8 · CHROME — selection, caret, deep links, focus ══════════════ */
::selection { background: color-mix(in srgb, var(--ember) 24%, transparent); color: var(--ink); text-shadow: none; }
::target-text { background: color-mix(in srgb, var(--ember) 20%, transparent); color: var(--ink); }
html { scrollbar-color: var(--ash) transparent; scrollbar-width: thin; caret-color: var(--ember); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; box-shadow: 0 0 0 5px rgba(217, 97, 31, 0.16); }
.hdr :focus-visible { box-shadow: 0 0 0 5px rgba(217, 97, 31, 0.22); }

/* ═══ REDUCED MOTION — every moving thing above stops, nothing is lost */
@media (prefers-reduced-motion: reduce) {
  .roll { overflow: visible; -webkit-mask-image: none; mask-image: none; }
  .roll__track { animation: none; width: auto; flex-wrap: wrap; justify-content: center; row-gap: 8px; }
  .roll__track > [data-clone] { display: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* ═══ 9 · THE RECORD — "This piece is no longer in production.
   The record remains." So the site can produce the record.         */
@media print {
  .hdr, .strata, .roll, .foot__coal, .foot__sindhu, .skip, .filters,
  .related, .bridge, .bridge--up, .cinema, .proof-note, [data-scrolltop] { display: none !important; }
  :root { --paper: #fff; --ink: #000; --ink-soft: #222; --ash: #555; --line: #bbb; }
  body, .on-ink, .foot { background: #fff !important; color: #000 !important; }
  .foot { --ink: #000; --ink-soft: #222; --ash: #555; --line: #bbb; }
  .foot::before { display: none; }
  .pdp { grid-template-columns: 1fr 1fr; }
  .pdp__gallery figure:not(:first-child) { display: none; }
  .pdp__info { position: static; }
  .shagun::after { box-shadow: none; background: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9px; color: #555; word-break: break-all; }
  .foot a[href^="http"]::after { content: ""; }
  section, .pdp__specs, .foot { break-inside: avoid; }
}
