/* ──────────────────────────────────────────────────────────────────────────────
   RustCraft "Forge Prime": the finishing layer over Forged Depth.
   Same colours, same pages, same features: this file only refines how things are
   drawn. Slab edges are thinner and the shadows under them are layered like real
   light, so surfaces read as precise rather than chunky. Glass carries a fine grain,
   a top sheen and small corner brackets. Buttons get a machined face, a specular
   band, an embossed label and a slow light sweep on the main calls to action.
   Big screens (1440p, 4K) scale the whole page up instead of leaving it tiny.
   Loaded after every other stylesheet. CSS only: no scripts, no outside hosts.
   ────────────────────────────────────────────────────────────────────────────── */

:root {
  --prime-ease: cubic-bezier(.22, 1, .36, 1);
  --prime-tick: rgba(255, 186, 130, 0.34);
  --prime-rim: rgba(214, 204, 255, 0.16);
  --prime-rim-hi: rgba(255, 196, 150, 0.42);
  /* soft, layered light: what makes a panel look photographed instead of drawn */
  --prime-ambient: 0 1px 1px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.3), 0 6px 12px -2px rgba(0, 0, 0, 0.35), 0 16px 32px -8px rgba(0, 0, 0, 0.5), 0 32px 64px -24px rgba(0, 0, 0, 0.7);
  --prime-grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.05'/%3E%3C/svg%3E");
  /* glass: grain, a top sheen, two corner brackets, then the old tint (one notch richer) */
  --glass:
    var(--prime-grain) 0 0 / 160px 160px repeat,
    linear-gradient(var(--prime-tick), var(--prime-tick)) 11px 11px / 13px 1px no-repeat,
    linear-gradient(var(--prime-tick), var(--prime-tick)) 11px 11px / 1px 13px no-repeat,
    linear-gradient(var(--prime-tick), var(--prime-tick)) calc(100% - 11px) calc(100% - 11px) / 13px 1px no-repeat,
    linear-gradient(var(--prime-tick), var(--prime-tick)) calc(100% - 11px) calc(100% - 11px) / 1px 13px no-repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 32%),
    linear-gradient(155deg, rgba(44, 34, 78, 0.6), rgba(13, 10, 26, 0.82) 62%);
  --glass-hi:
    var(--prime-grain) 0 0 / 160px 160px repeat,
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 32%),
    linear-gradient(155deg, rgba(62, 46, 104, 0.64), rgba(17, 13, 32, 0.84) 62%);
}

/* ── type: crisper rendering, even numbers, calmer captions ── */
html { -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; font-kerning: normal; }
body { font-feature-settings: "kern" 1, "liga" 1; }
.stat b, .num, .dl-card .mono, .scard .price, [class*="count"] { font-variant-numeric: tabular-nums; }
::placeholder { color: rgba(172, 168, 198, 0.62); opacity: 1; }
::selection { background: rgba(255, 122, 40, 0.5); color: #fff; text-shadow: none; }

/* the big titles: two precise steps of metal and a soft glow, instead of a tall stack */
.sec-head h2, .door h2, .final h2, .page-hero h1, .sup-head h2 {
  filter: drop-shadow(0 1px 0 #c75f22) drop-shadow(0 1.5px 0 #6a2a0e) drop-shadow(0 10px 18px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 30px rgba(255, 107, 26, 0.2)); }
.sec-head p, .final-sub { line-height: 1.7; }

/* ── focus: a clean double ring that shows on every surface ── */
:focus-visible { outline: 2px solid var(--ion); outline-offset: 3px; }
.btn:focus-visible, .nav .icon-link:focus-visible, .scard:focus-visible { outline: 2px solid #9ff3ff; outline-offset: 3px; box-shadow: var(--btn-shadow, none), 0 0 0 6px rgba(62, 230, 255, 0.18); }

/* ── buttons: machined slabs ──
   A thinner edge, light that falls off in layers, a hairline inner rim, and a label
   pressed into the face. */
.btn {
  --ex: 3px;
  font-weight: 800; letter-spacing: 0.075em;
  border-color: rgba(206, 194, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 50%),
    linear-gradient(180deg, rgba(50, 39, 86, 0.86), rgba(17, 13, 32, 0.92));
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.025), inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 calc(var(--ex) * 0.5) 0 var(--side-hi, rgba(32, 25, 56, 0.95)), 0 var(--ex) 0 var(--side, rgba(6, 5, 12, 0.95)),
    0 calc(var(--ex) + 1px) 2px rgba(0, 0, 0, 0.45), 0 calc(var(--ex) + 4px) 10px -3px rgba(0, 0, 0, 0.55), 0 calc(var(--ex) + 12px) 26px -10px rgba(0, 0, 0, 0.7),
    0 14px 34px -12px var(--glow, transparent);
  transition: transform 0.5s var(--spring, cubic-bezier(.2, 1.35, .35, 1)), box-shadow 0.4s var(--prime-ease), background 0.3s, border-color 0.3s, color 0.2s, filter 0.25s;
}
.btn:hover { --ex: 4px; border-color: rgba(214, 202, 255, 0.5); }
.btn:active { --ex: 1px; transform: translateY(2px); }
.btn svg { transition: transform 0.45s var(--spring, cubic-bezier(.2, 1.35, .35, 1)); filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35)); }
.btn:hover svg { transform: translateY(-1px) scale(1.08); }
.btn:active svg { transform: none; }
.btn.ghost, .btn.pf-glass { background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0) 50%), rgba(12, 9, 24, 0.55); }

/* the rust and green ones: a four-stop face with a specular band and an embossed label */
.btn.hot {
  color: #1d0a00; border-color: rgba(255, 214, 170, 0.95); text-shadow: 0 1px 0 rgba(255, 214, 170, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.06) 46%, rgba(255, 255, 255, 0) 52%),
    radial-gradient(120% 120% at 50% 120%, rgba(255, 61, 127, 0.32), transparent 55%),
    linear-gradient(180deg, #ffb46a 0%, #ff8030 36%, #ff6416 62%, #e2470c 100%); }
.btn.go {
  color: #022610; border-color: rgba(196, 255, 222, 0.95); text-shadow: 0 1px 0 rgba(214, 255, 232, 0.55);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.06) 46%, rgba(255, 255, 255, 0) 52%),
    radial-gradient(120% 120% at 50% 120%, rgba(62, 230, 255, 0.3), transparent 55%),
    linear-gradient(180deg, #8dfdbc 0%, #44ec98 38%, #22d47e 62%, #12b062 100%); }
.btn.hot, .btn.go {
  --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -2px 4px rgba(110, 20, 0, 0.28),
    0 calc(var(--ex) * 0.5) 0 var(--side-hi, rgba(32, 25, 56, 0.95)), 0 var(--ex) 0 var(--side, rgba(6, 5, 12, 0.95)),
    0 calc(var(--ex) + 1px) 2px rgba(0, 0, 0, 0.45), 0 calc(var(--ex) + 4px) 10px -3px rgba(0, 0, 0, 0.55), 0 calc(var(--ex) + 12px) 26px -10px rgba(0, 0, 0, 0.6),
    0 12px 38px -8px var(--glow, transparent); }
.btn.go { --btn-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 -2px 4px rgba(0, 70, 30, 0.28),
    0 calc(var(--ex) * 0.5) 0 var(--side-hi, rgba(32, 25, 56, 0.95)), 0 var(--ex) 0 var(--side, rgba(6, 5, 12, 0.95)),
    0 calc(var(--ex) + 1px) 2px rgba(0, 0, 0, 0.45), 0 calc(var(--ex) + 4px) 10px -3px rgba(0, 0, 0, 0.55), 0 calc(var(--ex) + 12px) 26px -10px rgba(0, 0, 0, 0.6),
    0 12px 38px -8px var(--glow, transparent); }
.btn.hot small, .btn.go small { text-shadow: none; opacity: 0.78; }
.btn.danger { text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5); }

/* the big calls to action: a slightly deeper edge, and a sweep of light every few seconds */
.hero-cta .btn, .final .btn, .dl-actions .btn { --ex: 4px; }
:is(.hero-cta, .final, .dl-actions) .btn:hover { --ex: 6px; }
:is(.hero-cta, .final, .dl-actions) .btn:active { --ex: 1px; transform: translateY(3px); }
@media (prefers-reduced-motion: no-preference) {
  :is(.hero-cta, .final, .dl-actions, .wl-acts) .btn:is(.hot, .go)::after { animation: primeSweep 6.5s var(--prime-ease) 1.6s infinite; }
  :is(.hero-cta, .final, .dl-actions, .wl-acts) .btn.go::after { animation-delay: 2.1s; }
  :is(.hero-cta, .final, .dl-actions, .wl-acts) .btn:is(.hot, .go):hover::after { animation: none; }
}
@keyframes primeSweep { 0% { transform: translateX(-120%); } 22%, 100% { transform: translateX(120%); } }

/* smaller buttons keep a thin edge */
:is(.btn.up-mini, .btn.pf-mini, .btn.bb-btn, .nav .btn, .mem-row .btn, .ann-acts .btn, .fp-row .btn, .fi-acts .btn, .up-new, .forum-gate .btn, .pc-acts .btn, .wl-acts .btn, .cm-acts .btn) { --ex: 2px; }
:is(.btn.up-mini, .btn.pf-mini, .btn.bb-btn, .nav .btn, .mem-row .btn, .ann-acts .btn, .fp-row .btn, .fi-acts .btn, .up-new, .forum-gate .btn, .pc-acts .btn, .wl-acts .btn, .cm-acts .btn):hover { --ex: 3px; }
:is(.btn.up-mini, .btn.pf-mini, .btn.bb-btn, .nav .btn, .mem-row .btn, .ann-acts .btn, .fp-row .btn, .fi-acts .btn, .up-new, .forum-gate .btn, .pc-acts .btn, .wl-acts .btn, .cm-acts .btn):active { --ex: 1px; transform: translateY(1px); }

/* small keys: icon buttons, fitting-room tools, close buttons */
.nav .icon-link, .fit-ib, .fit-emo, .ann-tb, .fl-act { --kex: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 55%), rgba(16, 12, 30, 0.78); border-color: rgba(206, 194, 255, 0.2); }
:is(.nav .icon-link, .fit-ib, .fit-emo, .ann-tb, .fl-act):hover { --kex: 3px; border-color: rgba(255, 196, 150, 0.5); color: #fff; }

/* tabs: the lit key gets the same machined face as the rust buttons */
.tab-thumb, .seg button[aria-checked="true"], .seg button[aria-pressed="true"], .auth-tabs button.on, .store-tabs button[aria-pressed="true"] {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.05) 48%, rgba(255, 255, 255, 0) 54%),
    linear-gradient(180deg, #ffb46a 0%, #ff8030 38%, #ff6416 64%, #e2470c 100%); }
.seg, .auth-tabs { background-image: var(--prime-grain); background-size: 160px 160px; }
.store-tabs button { border-color: rgba(206, 194, 255, 0.16); }
.store-tabs button:not([aria-pressed="true"]):hover { border-color: rgba(255, 196, 150, 0.4); color: #fff; }

/* ── cards: precise glass ──
   A 3px edge (it was 5) and layered ambient light. Hovering lifts and warms the rim. */
:is(.link-card, .steps li, .post, .dl-card, .dl-notes, .dl-steps li, .forum-cat, .forum-post, .forum-empty, .forum-gate, .sup-card, .set-card, .cm-card) {
  --slab: 3px;
  border-color: var(--prime-rim);
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px rgba(255, 255, 255, 0.02), inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 var(--slab) 0 -1px var(--slab-dark, rgba(9, 7, 18, 0.94)), 0 calc(var(--slab) + 1px) 0 -1px var(--slab-rim, rgba(196, 181, 255, 0.07)),
    var(--prime-ambient), 0 0 60px -18px var(--halo, transparent); }
:is(.link-card, .steps li, .post, .dl-card, .forum-cat, .sup-card, .cm-card):hover { --slab: 6px; border-color: var(--prime-rim-hi); }
.link-card:hover { border-color: transparent; }
.forum-thread { border-color: var(--prime-rim); }
.faq details { border-color: var(--prime-rim); transition: border-color 0.3s, box-shadow 0.4s var(--prime-ease), background 0.3s; }
.faq details:hover { border-color: rgba(255, 196, 150, 0.3); }
.door { --slab: 5px; }
.door:hover { --slab: 9px; }
.scard { --slab: 3px; border-color: rgba(206, 194, 255, 0.14); }
.scard:hover { --slab: 6px; }
.status-row { border-color: rgba(214, 204, 255, 0.22); background: var(--prime-grain) 0 0 / 160px 160px repeat, linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 30%), linear-gradient(160deg, rgba(38, 30, 68, 0.76), rgba(10, 8, 20, 0.88)); }
.wl-card { border-color: rgba(255, 186, 130, 0.3); }

/* ── smooth opening: FAQ and other disclosures grow open instead of snapping ── */
@media (prefers-reduced-motion: no-preference) {
  :root { interpolate-size: allow-keywords; }
  .faq details::details-content { height: 0; overflow: clip; transition: height 0.45s var(--prime-ease), content-visibility 0.45s allow-discrete; }
  .faq details[open]::details-content { height: auto; }
  .faq summary::after { transition: transform 0.45s var(--spring, cubic-bezier(.2, 1.35, .35, 1)), background 0.3s, color 0.3s; }
  .faq details[open] summary::after { transform: rotate(45deg); }
}

/* ── nav: a cleaner deck ── */
.nav { box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.03), 0 10px 30px -18px rgba(0, 0, 0, 0.9); }
.nav .brand img { transition: filter 0.4s var(--prime-ease), transform 0.5s var(--spring, cubic-bezier(.2, 1.35, .35, 1)); }
.nav .brand:hover img { transform: translateY(-1px) scale(1.03); filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 14px rgba(255, 107, 26, 0.45)); }
.nav ul a { letter-spacing: 0.02em; }

/* ── bands: a hairline of light where one section meets the next ── */
.band + .band { border-top: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(255, 170, 110, 0.18) 30%, rgba(139, 92, 246, 0.18) 70%, transparent) 1; }

/* ── dialogs: a frosted scrim and a rimmed panel ── */
.scrim, .settings-scrim { backdrop-filter: blur(12px) saturate(1.25); -webkit-backdrop-filter: blur(12px) saturate(1.25); }

/* ── text fields: the well gets a cleaner rim and a softer focus glow ── */
:is(.auth-field, .set-field, .fp-row, .conn-row, .pf-search, .bb-card, .dn-grid) :is(input, textarea, select) { border-color: rgba(206, 194, 255, 0.18); }
:is(.auth-field, .set-field, .fp-row, .conn-row, .pf-search, .bb-card, .dn-grid) :is(input, textarea, select):hover { border-color: rgba(206, 194, 255, 0.32); }

/* ── scrollbars: thin and lit ── */
html { scrollbar-color: rgba(255, 128, 48, 0.55) rgba(8, 6, 16, 0.9); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: rgba(6, 5, 12, 0.95); }
::-webkit-scrollbar-thumb { border: 2px solid rgba(6, 5, 12, 0.95); border-radius: 10px; background: linear-gradient(180deg, #ff9a52, #e2470c 60%, #8b5cf6); }
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #ffb46a, #ff6416 60%, #a37bff); }

/* ── high-density screens: hairlines at a true half pixel ── */
@media (min-resolution: 2dppx) {
  .btn { --btn-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 0.5px rgba(255, 255, 255, 0.04), inset 0 -1px 0 rgba(0, 0, 0, 0.35),
    0 calc(var(--ex) * 0.5) 0 var(--side-hi, rgba(32, 25, 56, 0.95)), 0 var(--ex) 0 var(--side, rgba(6, 5, 12, 0.95)),
    0 calc(var(--ex) + 1px) 2px rgba(0, 0, 0, 0.45), 0 calc(var(--ex) + 4px) 10px -3px rgba(0, 0, 0, 0.55), 0 calc(var(--ex) + 12px) 26px -10px rgba(0, 0, 0, 0.7),
    0 14px 34px -12px var(--glow, transparent); }
}

/* ── the sky: a painted deep-space backdrop behind every page ──
   One still picture (rendered by tools/render_sky.py: emission nebulae in the site's colours, soft dust
   pillars, young star clusters and fine stars) replaces the old gradient nebula. It drifts very slowly;
   the live starfield from js/fx.js still twinkles on top.
   - Until the picture arrives, the old soft nebula shows, so the first frames look as they always did.
   - The picture is only asked for once js/fx.js has marked the sky .live (fx.js is deferred), so it
     never competes with the page's own scripts on a slow connection.
   - Which picture: 1920 for ordinary screens and phones in landscape, 3840 wherever the screen has
     more real pixels than that (big, Retina and scaled screens, tablets in landscape), the portrait
     one on tall screens.
   - The sky is as tall as the largest viewport, so it doesn't jump when a phone's toolbar slides away. */
.cosmos {
  background:
    radial-gradient(38% 32% at 12% 18%, rgba(139, 92, 246, 0.26), transparent 70%),
    radial-gradient(30% 28% at 88% 12%, rgba(255, 107, 26, 0.2), transparent 70%),
    radial-gradient(42% 36% at 76% 78%, rgba(62, 230, 255, 0.11), transparent 70%),
    radial-gradient(46% 40% at 18% 92%, rgba(255, 61, 127, 0.12), transparent 70%),
    radial-gradient(70% 60% at 50% 50%, rgba(30, 18, 60, 0.6), transparent 80%),
    #04030a; }
@supports (height: 100lvh) { .cosmos { bottom: auto; height: 100lvh; } }
.cosmos::before { inset: -3%; background: none 50% 50% / cover no-repeat; animation: primeSky 120s ease-in-out infinite alternate; will-change: transform; }
.cosmos.live::before { background-image: url("../assets/prime/sky-1920.webp?v=3"); }
@media (min-width: 2200px), (min-resolution: 1.2dppx) and (min-width: 1600px), (min-resolution: 1.5dppx) and (min-width: 1000px),
  (min-resolution: 2dppx) and (min-width: 700px) and (min-height: 600px),
  (-webkit-min-device-pixel-ratio: 1.2) and (min-width: 1600px), (-webkit-min-device-pixel-ratio: 1.5) and (min-width: 1000px),
  (-webkit-min-device-pixel-ratio: 2) and (min-width: 700px) and (min-height: 600px) {
  .cosmos.live::before { background-image: url("../assets/prime/sky-3840.webp?v=3"); }
}
@media (max-aspect-ratio: 4/5) {
  .cosmos.live::before { background-image: url("../assets/prime/sky-portrait.webp?v=3"); }
}
.cosmos::after { opacity: 0.22; }
@keyframes primeSky { from { transform: scale(1.0) translate3d(0, 0, 0); } to { transform: scale(1.05) translate3d(-1%, 0.7%, 0); } }
@media (prefers-reduced-motion: reduce) { .cosmos::before { animation: none; } }
@media print { .cosmos::before, .cosmos.live::before { background: none; } }

/* ── big screens: 1440p and 4K get a larger page, not a postage stamp in the middle ── */
@media (min-width: 2200px) { html { font-size: 112.5%; } }
@media (min-width: 2800px) { html { font-size: 137.5%; } }
@media (min-width: 3400px) { html { font-size: 162.5%; } }

@media (prefers-reduced-motion: reduce) {
  .btn svg, .btn:hover svg { transition: none; transform: none; }
  .nav .brand:hover img { transform: none; }
}

