/* rail.css: the left keeper column of final-6 (rail.js, work/FOUNDATION.md), 27 Sep 2026.
   The boxes, the rings list and their states are final-4's, value for value (final-4/demo.css:205-266 and the 1100 px
   column rules :411-425), under final-4's own class names (.tf-arts, .tf-box, .tf-ringwrap, .tf-ringlist, .tf-ring),
   which final-5/final-6's demo.css no longer uses. What is new is only where the column lives:
   - 1100 px and wider: a 120 px column left of the content, sticky 16 px from the top, crown box over rings box;
   - below 1100 px: final-4's row of the two boxes; once it has scrolled away it docks at the bottom of the window
     (64 px + the safe area), and the rings list rises above the dock.
   Page layout helpers: .rl-page (the column + 28 px + main grid, the four's edges at 1440) and .rl-feed (a section's
   hairline from the column, final-4's gold line, one per section). Tokens (--gold, --ink, --muted, --sans) are the
   page's (demo.css :root). */

/* ── the page grid: column, 28 px, main (at most 1068 px, so column + gap + main = today's four's 1216 px) ── */
.rl-page { position: relative; }
@media (min-width: 1100px) {
  .rl-page {
    display: grid; align-items: stretch;
    grid-template-columns: [full-start] minmax(24px, 1fr) [col-start] 120px [col-end] 28px [main-start] minmax(0, 1068px) [main-end] minmax(24px, 1fr) [full-end];
  }
  .rl-page > .rl { grid-column: col; grid-row: 1; }
  .rl-page > .rl-main { grid-column: main; grid-row: 1; min-width: 0; }
}

/* ── the rail ── */
.rl { position: relative; z-index: 20; }
.rl__slot { min-height: 104px; }

/* ── final-4's boxes, copied (final-4/demo.css:205-266) ── */
.tf-arts { position: relative; z-index: 4; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 76rem; min-height: 104px; margin: 0 auto; padding: 10px 16px 6px; }
.tf-arts > .tf-box, .tf-ringwrap { min-width: 0; }
.tf-ringwrap { display: flex; }
.tf-box {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  width: 100%; height: 88px; margin: 0; padding: 8px 10px 9px; border-radius: 14px; cursor: pointer;
  border: 1px solid #e8c6903d; background: linear-gradient(170deg, #1b2542, #10172b);
  box-shadow: inset 0 1px 0 #ffffff0f, 0 12px 24px -18px #000000d9;
  transition: border-color 240ms, box-shadow 420ms, background 420ms;
}
.tf-box:hover { border-color: #e8c69080; }
.tf-box__art { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 46px; pointer-events: none; }
.tf-box--crown .tf-art, .tf-outline { width: 60px; height: 45px; }
.tf-box--rings .tf-art { width: 44px; height: 44px; }
.tf-box--rings.has-two .tf-art { width: 38px; height: 38px; }
.tf-box__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 500 11.5px/1.25 var(--sans); letter-spacing: .05em; color: var(--muted); pointer-events: none; }
.tf-box .tf-art { transition: filter 420ms, opacity 420ms; }
/* resting: dimmed and quieter, still the master */
.tf-box:not(.is-on) .tf-art { opacity: .78; filter: saturate(.7) brightness(.8) drop-shadow(0 2px 2px #050812b3); }
/* on: lit, glowing, a warm light inside the box */
.tf-box.is-on {
  border-color: #e8c690b8;
  background: radial-gradient(110% 80% at 50% 62%, #ffc07c33, #ffc07c00 72%), linear-gradient(170deg, #1e2844, #111a30);
  box-shadow: 0 0 0 1px #e8c69033, 0 0 28px -6px #ffbe6e73, inset 0 1px 0 #ffffff17;
}
.tf-box.is-on .tf-art { opacity: 1; filter: brightness(1.08) drop-shadow(0 0 10px #ffc47cb3) drop-shadow(0 3px 4px #050812a6); }
.tf-box.is-on .tf-box__label { color: var(--gold); }
/* the newcomer: an empty outline where the crown will be */
.tf-box.is-empty { border-style: dashed; border-color: #e8c6909e; background: #121a30; }
.tf-outline { fill: none; stroke: var(--gold); stroke-width: 1.6; stroke-linejoin: round; stroke-dasharray: 4 3.4; opacity: .9; }
.tf-box.is-empty .tf-box__label { color: var(--ink); }
/* locked: no crown held, so no ring may come */
.tf-box[aria-disabled='true'] { cursor: not-allowed; border-color: #ffffff21; background: #10172a; box-shadow: none; }
.tf-box[aria-disabled='true']:hover { border-color: #ffffff21; }
.tf-box[aria-disabled='true'] .tf-art { opacity: .42; filter: saturate(.25) brightness(.72); }
.tf-box[aria-disabled='true'] .tf-box__label { white-space: normal; text-align: center; line-height: 1.15; }
.tf-lock { position: absolute; right: -10px; bottom: 0; width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linecap: round; }
.tf-arts.is-open .tf-box--rings { border-color: #e8c690cc; }
/* the rings list: a small sheet under the row; the rings rise out of the box */
.tf-ringlist {
  position: absolute; z-index: 6; left: 16px; right: 16px; top: calc(100% + 2px); margin: 0; padding: 8px; list-style: none;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px;
  border-radius: 14px; border: 1px solid #e8c6905c; background: #0e1528f5; box-shadow: 0 20px 40px -18px #000000f2;
}
.tf-ringlist[hidden] { display: none !important; }
.tf-ring {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 100%; min-height: 64px; margin: 0;
  padding: 6px; border-radius: 10px; border: 1px solid #ffffff17; background: #161f38; cursor: pointer; transition: border-color 200ms, background 300ms;
}
.tf-ring:hover { border-color: #e8c69080; }
.tf-ring__art { display: block; width: 32px; height: 32px; pointer-events: none; }
.tf-ring .tf-art { width: 32px; height: 32px; opacity: .8; filter: saturate(.7) brightness(.82); transition: filter 300ms, opacity 300ms; }
.tf-ring__name { font: 500 12.5px/1.2 var(--sans); color: var(--body); pointer-events: none; }
.tf-ring.is-on { border-color: #e8c690c7; background: radial-gradient(100% 90% at 50% 40%, #ffc07c2e, #ffc07c00 75%), #1a2440; }
.tf-ring.is-on .tf-art { opacity: 1; filter: brightness(1.08) drop-shadow(0 0 8px #ffc47cb3); }
.tf-ring.is-on .tf-ring__name { color: var(--gold); }
.tf-ringlist.is-rising .tf-ringlist__item { animation: tf-rise 320ms cubic-bezier(.3,.7,.2,1) both; animation-delay: calc(var(--i) * 45ms); }
@keyframes tf-rise { from { opacity: 0; transform: translateY(-22px) scale(.6); } to { opacity: 1; transform: none; } }
.tf-box:focus-visible, .tf-ring:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

@media (min-width: 720px) {
  .tf-arts { padding: 14px 24px 8px; min-height: 110px; }
  .rl__slot { min-height: 110px; }
  .tf-ringlist { left: 24px; right: 24px; }
}

/* ── the phone and tablet dock (below 1100 px): the same bar, fixed to the bottom once its slot has scrolled away ── */
@media (max-width: 1099.98px) {
  html[data-rl] body { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .rl.is-docked .rl__bar {
    position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; top: auto;
    max-width: none; min-height: 0; margin: 0;
    height: calc(64px + env(safe-area-inset-bottom, 0px)); padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
    background: #0e1528f5; border-top: 1px solid #e8c6905c; box-shadow: 0 -14px 28px -18px #000000e6;
    animation: rl-dock 220ms cubic-bezier(.25,.7,.2,1) both;
  }
  .rl.is-docked .tf-box { height: 48px; flex-direction: row; gap: 8px; padding: 4px 10px; border-radius: 12px; }
  .rl.is-docked .tf-box__art { height: 32px; align-items: center; flex: none; }
  .rl.is-docked .tf-box--crown .tf-art, .rl.is-docked .tf-outline { width: 43px; height: 32px; }
  .rl.is-docked .tf-box--rings .tf-art { width: 32px; height: 32px; }
  .rl.is-docked .tf-box--rings.has-two .tf-art { width: 28px; height: 28px; }
  .rl.is-docked .tf-box__label { max-width: none; min-width: 0; }
  .rl.is-docked .tf-lock { right: -8px; bottom: -2px; width: 13px; height: 13px; }
  .rl.is-docked .tf-ringlist { top: auto; bottom: calc(100% + 8px); left: 16px; right: 16px; }
  @keyframes rl-dock { from { transform: translateY(100%); } to { transform: none; } }
}

/* ── 1100 px and wider: the sticky column (final-4's column values: crown box 88, rings box 112; list beside it) ── */
@media (min-width: 1100px) {
  .rl { align-self: stretch; }
  .rl__slot { min-height: 0; height: 100%; }
  .rl__bar.tf-arts {
    position: sticky; top: 16px; display: flex; flex-direction: column; gap: 32px;
    max-width: none; min-height: 0; margin: 0; padding: 0;
  }
  .tf-box--rings { height: 112px; }
  .tf-ringwrap { position: relative; }
  .tf-ringlist { left: calc(100% + 12px); right: auto; top: 50%; translate: 0 -50%; width: 288px; gap: 6px; }

  /* .rl-feed: a section's hairline from the column (ground-simplicity L1: final-4's gold line, one per section) */
  .rl-feed { position: relative; }
  .rl-feed::before {
    content: ''; position: absolute; left: -28px; top: var(--rl-feed-y, 22px); width: 28px; height: 1px; pointer-events: none;
    background: linear-gradient(90deg, #e8c6904d, #e8c69026); transition: background 120ms;
  }
  .rl-feed::after {
    content: ''; position: absolute; left: -3px; top: calc(var(--rl-feed-y, 22px) - 2.5px); width: 6px; height: 6px; border-radius: 50%;
    background: #e8c69066; pointer-events: none;
  }
  html.rl-held .rl-feed::before { background: linear-gradient(90deg, #e8c690d9, #e8c69080); }
  html.rl-held .rl-feed::after { background: var(--gold); }
}

@media (prefers-reduced-motion: reduce) {
  .tf-box, .tf-box .tf-art, .tf-ring, .tf-ring .tf-art { transition: none; }
  .tf-ringlist.is-rising .tf-ringlist__item { animation: none; }
  .rl.is-docked .rl__bar { animation: none; }
}
