/* ============================================================================
   STARFALL — TERMS PAGE
   css/terms-page.css
   ----------------------------------------------------------------------------
   The terms document used to be the last section of the desk page: thirty
   clauses stacked under the CTA, reachable only by scrolling past everything
   else. It now has its own address, and this sheet is the only thing that is
   new — the clause typography itself still comes from terminal-pro.css §13,
   the tokens and buttons from terminal.css, so the legal text and the desk can
   never drift apart visually.

   What this layer adds is what a reference document needs and a landing page
   does not:
     · a sticky bar with a way back to the desk, and a reading-progress line
     · a hero that states the revision before you start reading
     · a contents rail that sticks, searches and marks the clause you are in
     · each clause as a panel, with a gold flash when you arrive from a link
     · a page-level "top" button, and a print stylesheet that drops the chrome
     · an ultrawide layout: past 1440px the shell widens and the width goes into
       the margin the clause numbers sit in, not into longer lines of legal text
   ========================================================================== */

/* ==========================================================================
   01. SHELL & BACKGROUND
   ========================================================================== */
body.tp {
  background: var(--bg);
  color: var(--ink);
}

.tp__bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.tp__bg-grid {
  position: absolute;
  inset: -10%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 5%, transparent 72%);
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 5%, transparent 72%);
}
.tp__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  animation: tpDrift 26s ease-in-out infinite;
}
.tp__orb--a {
  width: 620px; height: 620px;
  top: -220px; left: -160px;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.22), transparent 68%);
}
.tp__orb--b {
  width: 520px; height: 520px;
  top: 22%; right: -180px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.14), transparent 68%);
  animation-delay: -9s;
}
.tp__orb--c {
  width: 560px; height: 560px;
  bottom: -240px; left: 32%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.13), transparent 70%);
  animation-delay: -17s;
}
.tp__vig {
  position: absolute;
  inset: 0;
  background: radial-gradient(130% 80% at 50% -10%, transparent 30%, rgba(4, 6, 12, 0.86) 100%);
}
@keyframes tpDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50%      { transform: translate3d(34px, -26px, 0) scale(1.07); }
}

.tp__main,
.tp__bar,
.tp__foot {
  position: relative;
  z-index: 1;
}
.tp__main {
  width: min(100% - 40px, var(--maxw));
  margin-inline: auto;
  padding-bottom: 30px;
}

/* ==========================================================================
   02. READING PROGRESS + TOP BUTTON
   ========================================================================== */
.tp__progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 120;
  background: rgba(255, 255, 255, 0.05);
}
.tp__progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.8);
}

.tp__top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 110;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 16px 0 13px;
  border: 1px solid var(--line-gold);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(16, 22, 36, 0.94), rgba(9, 13, 22, 0.94));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink-2);
  font: 700 11px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  box-shadow: var(--shadow-1);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s, color 0.2s, border-color 0.2s;
}
.tp__top svg { width: 15px; height: 15px; }
.tp__top.is-on { opacity: 1; visibility: visible; transform: translateY(0); }
.tp__top:hover { color: #fff; border-color: rgba(var(--accent-rgb), 0.7); }

/* ==========================================================================
   03. TOP BAR
   ========================================================================== */
.tp__bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
  padding: 0 max(20px, calc((100% - var(--maxw)) / 2));
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(4, 6, 12, 0.95), rgba(4, 6, 12, 0.7));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}
.tp__brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.tp__brandtxt { display: grid; gap: 1px; }
.tp__brandtxt b {
  font-family: var(--display);
  font-size: 13px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}
.tp__brandtxt em {
  font: 600 9.5px/1 var(--mono);
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.tp__nav { display: flex; gap: 20px; margin-left: 8px; }
.tp__nav a {
  position: relative;
  font: 600 11.5px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
  transition: color 0.22s;
}
.tp__nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent);
  transition: right 0.28s var(--ease);
}
.tp__nav a:hover { color: var(--ink); }
.tp__nav a:hover::after { right: 0; }

.tp__barright { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.tp__stamp {
  padding: 6px 11px;
  border: 1px dashed var(--line-gold);
  border-radius: 999px;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--accent);
  white-space: nowrap;
}

/* Narrow screens get an arrow into a 34px tile instead of the labelled button:
   the brand stays readable and the bar never has to squeeze or wrap. */
.tp__miniback {
  display: none;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink-2);
  transition: color 0.2s, border-color 0.2s;
}
.tp__miniback svg { width: 16px; height: 16px; }
.tp__miniback:hover { color: #fff; border-color: var(--line-gold); }

/* ==========================================================================
   04. HERO
   ========================================================================== */
.tp__hero { padding: 76px 0 40px; max-width: 90ch; }
.tp__title {
  font-family: var(--display);
  font-size: clamp(2.3rem, 6.2vw, 4.1rem);
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0 0 18px;
}
.tp__title u { text-decoration: none; color: var(--accent); }
.tp__lead { color: var(--ink-2); font-size: 1.06rem; line-height: 1.75; max-width: 68ch; }
.tp__lead b { color: var(--accent); }

.tp__facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0 0;
  max-width: 720px;
}
.tp__facts li {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.008));
}
.tp__facts b {
  display: block;
  font-family: var(--display);
  font-size: 1.18rem;
  color: var(--ink);
  letter-spacing: 0.01em;
}
.tp__facts span {
  display: block;
  margin-top: 3px;
  font: 600 9.5px/1.4 var(--mono);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--faint);
}
.tp__meta {
  margin-top: 18px;
  font: 600 10.5px/1.8 var(--mono);
  letter-spacing: 0.05em;
  color: var(--faint);
}

/* ==========================================================================
   05. CONTENTS RAIL (builds on terminal-pro.css §13)
   ========================================================================== */
.tp__terms { padding-top: 6px; }

.tp__search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.34);
  transition: border-color 0.22s, box-shadow 0.22s;
}
.tp__search:focus-within {
  border-color: var(--line-gold);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.1);
}
.tp__search svg { width: 14px; height: 14px; color: var(--faint); flex-shrink: 0; }
.tp__search input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 12px/1.3 var(--ui);
  letter-spacing: 0.02em;
  outline: none;
}
.tp__search input::placeholder { color: var(--faint); }
.tp__search input::-webkit-search-cancel-button { filter: invert(0.6); }
.tp__search-note {
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.08em;
  color: var(--accent);
}

.tp__terms .terms__idx { max-height: calc(100vh - 124px); overflow-y: auto; }
.tp__terms .terms__idx ol.is-empty::after {
  content: 'no clause matches that';
  grid-column: 1 / -1;
  font: 600 11px/1.6 var(--mono);
  color: var(--faint);
}
.tp__terms .terms__idx a.is-on {
  color: var(--accent);
  border-bottom-color: transparent;
}
.tp__terms .terms__idx a.is-on::after {
  content: '';
  display: inline-block;
  width: 5px; height: 5px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.9);
  vertical-align: middle;
}

/* ==========================================================================
   06. CLAUSE PANEL
   --------------------------------------------------------------------------
   The clauses keep their hairline rhythm; what is added here is the panel
   they sit in, the gold flash when a clause is the link target, and enough
   breathing room at the top for the number that hangs in the margin.
   ========================================================================== */
.tp__terms .terms__items {
  padding: clamp(20px, 2.6vw, 40px) clamp(18px, 2.6vw, 42px) clamp(6px, 1vw, 14px);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.036), rgba(255, 255, 255, 0.004));
  box-shadow: var(--shadow-2);
}
.tp__terms .terms__item {
  border-radius: 12px;
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.tp__terms .terms__item:target {
  background: rgba(var(--accent-rgb), 0.055);
  box-shadow: -44px 0 0 -40px var(--accent), inset 0 0 0 1px rgba(var(--accent-rgb), 0.16);
  animation: tpFlash 1.6s var(--ease) 1;
}
@keyframes tpFlash {
  0%   { background: rgba(var(--accent-rgb), 0.24); }
  100% { background: rgba(var(--accent-rgb), 0.055); }
}
.tp__terms .terms__item h3 em { transition: color 0.22s, transform 0.22s; }
.tp__terms .terms__item:hover h3 em { transform: translateX(-2px); }

.tp__back { margin-bottom: 10px; }

/* ==========================================================================
   07. FOOTER
   ========================================================================== */
.tp__foot {
  width: min(100% - 40px, var(--maxw));
  margin: 30px auto 0;
  padding: 22px 0 40px;
  border-top: 1px solid var(--line);
}
.tp__foot-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  font: 600 11px/1.6 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
}
.tp__foot-box b { color: var(--accent); }
.tp__foot-box nav { display: flex; flex-wrap: wrap; gap: 16px; margin-left: auto; }
.tp__foot-box nav a { color: var(--muted); transition: color 0.2s; }
.tp__foot-box nav a:hover { color: var(--ink); }
.tp__legal {
  margin-top: 16px;
  max-width: 108ch;
  color: var(--faint);
  font-size: 0.82rem;
  line-height: 1.8;
}

/* ==========================================================================
   08. RESPONSIVE
   ========================================================================== */
@media (max-width: 1080px) {
  .tp__terms .terms__items { padding: 26px 22px 8px; }
  .tp__terms .terms__idx { max-height: none; overflow: visible; }
  .tp__terms .terms__idx ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .tp__bar { padding: 0 16px; gap: 12px; }
  .tp__nav { display: none; }
  .tp__stamp { display: none; }
}
@media (max-width: 620px) {
  .tp__barright .btn { display: none; }
  .tp__miniback { display: grid; }
  .tp__brandtxt b { font-size: 12px; letter-spacing: 0.13em; }
  .tp__brandtxt em { letter-spacing: 0.1em; }
}
@media (max-width: 720px) {
  .tp__hero { padding-top: 52px; }
  .tp__facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp__terms .terms__items { padding: 22px 16px 6px; border-radius: var(--r-lg); }
  .tp__terms .terms__item:target { box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.18); }
  .tp__top { right: 14px; bottom: 14px; }
  .tp__top span { display: none; }
  .tp__top { padding: 0 12px; }
}

/* ==========================================================================
   09. ULTRAWIDE
   --------------------------------------------------------------------------
   The desk's shell is 1320px, because a landing page that stretches to 3440px
   reads as a banner. A reference document is the other case: at 2560px a
   1320px column leaves two thirds of the screen empty, the rail stops looking
   like part of the page and the document starts to look like a PDF someone
   forgot to zoom. So the terms shell widens in two steps — and the width it
   gains is spent on the margin the clause numbers hang in, not on longer
   lines: every paragraph keeps a cap near 92 characters, which is the point
   past which an eye loses its place on the way back to the left edge.
   ========================================================================== */
@media (min-width: 1440px) {
  .tp__main,
  .tp__foot { width: min(100% - 64px, 1520px); }
  .tp__hero { max-width: none; }
  .tp__lead { max-width: 84ch; }
  .tp__facts { max-width: none; }
  .tp__terms { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 48px; }
  .tp__terms .terms__items { padding-inline: clamp(38px, 3.4vw, 62px); }
  .tp__terms .terms__item { padding-left: 72px; }
  .tp__terms .terms__item h3 em { left: -72px; font-size: 15px; }
  .tp__terms .terms__item > p,
  .tp__terms .terms__item > ul { max-width: 92ch; }
  .tp__legal { max-width: 120ch; }
}
@media (min-width: 1800px) {
  .tp__main,
  .tp__foot { width: min(100% - 96px, 1720px); }
  .tp__terms { grid-template-columns: minmax(0, 330px) minmax(0, 1fr); gap: 56px; }
  .tp__terms .terms__items { padding-inline: 68px; }
  .tp__terms .terms__item { padding-left: 84px; }
  .tp__terms .terms__item h3 em { left: -84px; }
}

/* ==========================================================================
   10. MOTION / PRINT
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .tp__orb { animation: none; }
  .tp__top { transition: opacity 0.15s linear, visibility 0.15s linear; transform: none; }
  .tp__terms .terms__item:target { animation: none; }
}

@media print {
  .tp__bg,
  .tp__bar,
  .tp__progress,
  .tp__top,
  .tp__terms .terms__idx,
  .tp__back { display: none !important; }
  body.tp { background: #fff; color: #000; }
  .tp__main, .tp__foot { width: auto; }
  .tp__terms { display: block; }
  .tp__terms .terms__items {
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }
  .tp__terms .terms__item,
  .terms__item p,
  .tp__lead,
  .tp__legal { color: #111; }
  .tp__terms .terms__item { page-break-inside: avoid; }
}
