/*
 * SCROLLBAR OWNER: Styles/scrollbars.css
 * Scrollbar appearance is centralized there. This file may own overflow,
 * scroll-snap and scrollbar-gutter behavior, but must not style scrollbar chrome.
 */

/*
 * Terms — Tracks-aligned legal file.
 * Plan: docs/MILLENOVA_TERMS_IMPLEMENTATION_PLAN.md
 * Shared policy pages, shell chrome, player and mobile dock remain owned elsewhere.
 */

.page-terms {
  background:
    radial-gradient(circle at 18% 5%, rgba(255,58,167,.09), transparent 30rem),
    radial-gradient(circle at 86% 30%, rgba(110,242,255,.04), transparent 30rem),
    var(--mn-bg);
}

@media (min-width: 901px) {
  body.page-terms > .site-header {
    display: none;
  }
}

.terms-page {
  width: auto;
  max-width: 1580px;
  min-width: 0;
  margin-right: auto;
  padding: clamp(2rem, 4vw, 4rem);
  box-sizing: border-box;
}

.terms-file {
  --terms-line-soft: rgba(255,255,255,.06);
  --terms-font-mono: var(
    --mn-font-mono,
    "Fira Code",
    ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace
  );

  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mn-text);
  font-size: 15px;
  line-height: 1.7;
  container: terms-file / inline-size;
}

.terms-file p {
  margin: 0;
}

.terms-mono {
  font-family: var(--terms-font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* ---------- Tracks/About header model ---------- */

.terms-file__identity {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--mn-line);
}

.terms-file__identity-main {
  min-width: 0;
  flex: 1 1 auto;
}

.terms-file__identity .mn-kicker {
  margin: 0 0 .55rem;
  color: var(--mn-pink);
  font-size: .7rem;
}

.terms-file__identity h1 {
  max-width: 13ch;
  margin: 0;
  font-family: var(--mn-font-display);
  font-size: clamp(2.7rem, 6vw, 5.7rem);
  font-weight: 500;
  letter-spacing: -.065em;
  line-height: .92;
  text-wrap: balance;
}

.terms-file .terms-file__intro {
  max-width: 72ch;
  margin: 1.35rem 0 0;
  color: var(--mn-text-soft);
  font-size: .7rem;
  line-height: 1.6;
}

.terms-file__identity-meta {
  flex: 0 0 auto;
  display: grid;
  justify-items: end;
  gap: .8rem;
  padding-bottom: .15rem;
}

.terms-file__ref {
  color: var(--mn-muted);
  white-space: nowrap;
}

.terms-file__stamp {
  padding: 5px 9px;
  border: 1.5px solid rgba(255,58,167,.55);
  color: rgba(255,58,167,.8);
  font-size: 10px;
  letter-spacing: .2em;
  transform: rotate(-6deg);
}

/* ---------- Terms metadata ---------- */

.terms-file__meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-bottom: 1px solid var(--mn-line);
}

.terms-file__meta > div {
  min-width: 0;
  padding: 12px 14px 12px 0;
}

.terms-file__meta > div + div {
  padding-left: 14px;
  border-left: 1px solid var(--terms-line-soft);
}

.terms-file__meta dt {
  margin-bottom: 4px;
  color: var(--mn-muted);
}

.terms-file__meta dd {
  margin: 0;
  color: var(--mn-text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.terms-file__meta .terms-file__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--mn-cyan);
}

.terms-file__status::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--mn-cyan);
  animation: terms-signal-pulse 2.4s infinite;
}

@keyframes terms-signal-pulse {
  0% { box-shadow: 0 0 0 0 rgba(110,242,255,.55); }
  70% { box-shadow: 0 0 0 7px rgba(110,242,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(110,242,255,0); }
}

/* ---------- Continuous terms register ---------- */

.terms-file__section {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 20px;
  padding: 24px 0;
  border-bottom: 1px solid var(--mn-line);
  scroll-margin-top: 24px;
}

.terms-file__section h2 {
  margin: 2px 0 0;
  color: var(--mn-text);
  font: 500 11px/1.4 var(--terms-font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.terms-file__code {
  display: block;
  margin-bottom: 3px;
  color: var(--mn-pink);
  font-size: 12px;
}

.terms-file__section:nth-of-type(even) .terms-file__code {
  color: var(--mn-cyan);
}

.terms-file__copy {
  min-width: 0;
  max-width: 84ch;
}

.terms-file__copy p {
  color: var(--mn-text-soft);
}

.terms-file__copy p + p {
  margin-top: 10px;
}

.terms-file__links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 14px;
}

.terms-file__links a {
  border-bottom: 1px solid rgba(110,242,255,.3);
  color: var(--mn-cyan);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
}

.terms-file__links a:hover,
.terms-file__links a:focus-visible {
  border-bottom-color: var(--mn-cyan);
  outline: none;
}

.terms-file__footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  padding-top: 16px;
  color: var(--mn-muted);
}

.terms-file__footer span:first-child {
  color: var(--mn-text-soft);
}

/* ---------- Document-width adaptation ---------- */

@container terms-file (max-width: 740px) {
  .terms-file__section {
    grid-template-columns: 120px minmax(0, 1fr);
  }
}

/* ---------- Narrow ---------- */

@media (max-width: 800px) {
  .terms-page {
    padding: 24px clamp(16px, 5vw, 32px) 40px;
  }

  .terms-file__identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 1.15rem;
    padding: 0 0 1.35rem;
  }

  .terms-file__identity-main {
    width: 100%;
  }

  .terms-file__identity h1 {
    max-width: 100%;
    font-size: clamp(2.15rem, 10vw, 3.45rem);
    line-height: .94;
    overflow-wrap: anywhere;
  }

  .terms-file .terms-file__intro {
    margin-top: .9rem;
  }

  .terms-file__identity-meta {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .7rem 1rem;
  }

  .terms-file__stamp {
    transform: none;
  }

  .terms-file__meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .terms-file__meta > div {
    padding: 10px 10px 10px 0;
  }

  .terms-file__meta > div:nth-child(odd) {
    padding-left: 0;
    border-left: 0;
  }

  .terms-file__meta > div:nth-child(even) {
    padding-left: 10px;
  }

  .terms-file__meta > div:nth-child(n+3) {
    border-top: 1px solid var(--terms-line-soft);
  }

  .terms-file__section {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 20px 0;
  }

  .terms-file__code {
    display: inline;
    margin-right: 6px;
  }

  .terms-file__copy {
    max-width: none;
  }

  .terms-file__footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .terms-file__identity .mn-kicker {
    font-size: .6rem;
    letter-spacing: .15em;
  }

  .terms-file__identity h1 {
    font-size: clamp(2rem, 10vw, 2.65rem);
  }

  .terms-file__ref {
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terms-file__status::before {
    animation: none;
  }
}
