/* ==========================================================================
   Terms of Collaboration (/terms-of-services)
   Public design system only: obsidian canvas, Solar Gold, Dusk Violet,
   the site's Graphik type and its glass surfaces. Same editorial hero
   pattern as the work archive.
   ========================================================================== */

body.terms-body {
  background-color: var(--bg-canvas, #080811);
  color: var(--text-primary, #f8fafc);
}

.terms-page {
  position: relative;
  padding-bottom: clamp(64px, 8vw, 120px);
}

.terms-wrap {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 48px);
  box-sizing: border-box;
}

/* ------------------------------------------------------------------ hero */
.terms-hero {
  padding: clamp(110px, 12vw, 160px) 0 clamp(40px, 5vw, 64px);
  border-bottom: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  background: radial-gradient(circle at 50% 0%, rgba(var(--accent-violet-rgb, 120, 113, 205), 0.15) 0%, transparent 70%);
}

.terms-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 28px;
}

.terms-home-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  color: var(--text-muted, #64748b);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.terms-home-link:hover,
.terms-home-link:focus-visible {
  color: var(--accent-gold, #f5c542);
}

.terms-version {
  color: var(--accent-gold, #f5c542);
  font-size: 0.85rem;
  font-weight: 600;
}

.terms-eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent-gold, #f5c542);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.terms-title {
  margin: 0 0 16px;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
  font-weight: 700;
  line-height: var(--lh-heading-ar, 1.3);
  letter-spacing: 0;
}

.terms-lede {
  max-width: 680px;
  margin: 0;
  color: var(--text-secondary, #a0aec0);
  font-size: clamp(1rem, 1.3vw, 1.2rem);
  line-height: 1.8;
}

/* ---------------------------------------------------------------- layout */
.terms-layout {
  display: grid;
  gap: 24px;
  padding-top: clamp(32px, 4vw, 56px);
}

@media (min-width: 1024px) {
  .terms-layout {
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 72px;
    align-items: start;
  }
}

.terms-content-col {
  min-width: 0;
  max-width: 780px;
}

/* ------------------------------------------------------- table of contents */
.terms-toc {
  min-width: 0;
}

@media (min-width: 1024px) {
  .terms-toc {
    position: sticky;
    top: calc(var(--global-header-height, 74px) + 32px);
    max-height: calc(100vh - var(--global-header-height, 74px) - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  }

  .terms-toc::-webkit-scrollbar {
    width: 4px;
  }

  .terms-toc::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
  }

  .terms-toc-count {
    display: none;
  }
}

.terms-toc-box {
  border: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  border-radius: 20px;
  background: var(--bg-card, rgba(18, 18, 34, 0.72));
}

.terms-toc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 0 20px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.terms-toc-summary::-webkit-details-marker {
  display: none;
}

.terms-toc-summary::after {
  content: '';
  width: 8px;
  height: 8px;
  margin-inline-start: auto;
  border-inline-end: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.6;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.terms-toc-box[open] .terms-toc-summary::after {
  transform: rotate(-135deg);
}

.terms-toc-count {
  color: var(--accent-gold, #f5c542);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 1024px) {
  .terms-toc-box {
    border: 0;
    background: transparent;
  }

  .terms-toc-summary {
    min-height: 0;
    padding: 0 0 16px;
    color: var(--text-muted, #64748b);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
    cursor: default;
    pointer-events: none;
  }

  .terms-toc-summary::after {
    display: none;
  }
}

.terms-toc-list {
  margin: 0;
  padding: 0 8px 12px;
  list-style: none;
}

@media (min-width: 1024px) {
  .terms-toc-list {
    padding: 0;
    border-inline-start: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  }
}

.terms-toc-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 12px;
  color: var(--text-secondary, #a0aec0);
  font-size: 0.88rem;
  line-height: 1.5;
  text-decoration: none;
  transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (max-width: 1023px) {
  .terms-toc-link {
    min-height: 48px;
  }
}

.terms-toc-link:hover,
.terms-toc-link:focus-visible {
  color: var(--text-primary, #f8fafc);
  background: rgba(255, 255, 255, 0.04);
}

.terms-toc-num {
  flex: none;
  width: 22px;
  color: var(--text-muted, #64748b);
  font-size: 0.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.terms-toc-link[aria-current] {
  color: var(--accent-gold, #f5c542);
}

.terms-toc-link[aria-current] .terms-toc-num {
  color: var(--accent-gold, #f5c542);
}

@media (min-width: 1024px) {
  .terms-toc-link {
    border-radius: 0;
    padding-inline: 16px 8px;
  }

  .terms-toc-link[aria-current]::before {
    content: '';
    position: absolute;
    inset-block: 8px;
    inset-inline-start: -1px;
    width: 2px;
    border-radius: 2px;
    background: var(--accent-gold, #f5c542);
  }
}

/* ------------------------------------------------------------ notice card */
.terms-notice {
  display: flex;
  gap: 16px;
  padding: clamp(20px, 3vw, 28px);
  margin-bottom: clamp(40px, 5vw, 56px);
  border: 1px solid var(--border-accent, rgba(245, 197, 66, 0.35));
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(var(--accent-gold-rgb, 245, 197, 66), 0.08), rgba(var(--accent-gold-rgb, 245, 197, 66), 0.02));
}

.terms-notice-icon {
  flex: none;
  margin-top: 4px;
  color: var(--accent-gold, #f5c542);
}

.terms-notice-title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
}

.terms-notice-ar {
  margin: 0;
  color: var(--text-primary, #f8fafc);
  font-size: 1.02rem;
  line-height: 1.9;
}

.terms-notice-en,
.terms-final-en {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  color: var(--text-muted, #64748b);
  font-family: var(--font-latin-body, inherit);
  font-size: 0.9rem;
  line-height: 1.7;
  text-align: start;
}

/* ---------------------------------------------------------------- parties */
.terms-section-label {
  margin: 0 0 16px;
  color: var(--text-muted, #64748b);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.terms-parties {
  margin-bottom: clamp(40px, 5vw, 56px);
}

.terms-parties-grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .terms-parties-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.terms-party {
  padding: 24px;
  border: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  border-radius: 20px;
  background: var(--bg-card, rgba(18, 18, 34, 0.72));
}

.terms-party-tag {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent-gold, #f5c542);
  font-size: 0.78rem;
  font-weight: 700;
}

.terms-party h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
}

.terms-party p {
  margin: 0;
  color: var(--text-secondary, #a0aec0);
  font-size: 0.95rem;
  line-height: 1.8;
}

/* -------------------------------------------------------------- sections */
.terms-list {
  border-top: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
}

.term-card:focus {
  outline: none;
}

.term-card {
  padding-block: clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  scroll-margin-top: calc(var(--global-header-height, 74px) + 32px);
}

.term-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
}

.term-num-badge {
  flex: none;
  min-width: 2ch;
  color: var(--accent-gold, #f5c542);
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.term-title {
  margin: 0;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  font-weight: 700;
  line-height: 1.4;
}

.term-content {
  padding-inline-start: calc(2ch + 16px);
}

@media (max-width: 640px) {
  .term-content {
    padding-inline-start: 0;
  }
}

.term-items-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: term-item;
}

.term-items-list > li {
  position: relative;
  padding-inline-start: 32px;
  margin-bottom: 14px;
  color: var(--text-secondary, #a0aec0);
  font-size: 1rem;
  line-height: 1.9;
  counter-increment: term-item;
}

.term-items-list > li:last-child {
  margin-bottom: 0;
}

.term-items-list > li::before {
  content: counter(term-item);
  position: absolute;
  inset-inline-start: 0;
  top: 0.15em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(var(--accent-gold-rgb, 245, 197, 66), 0.12);
  color: var(--accent-gold, #f5c542);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.term-paragraph {
  margin: 0;
  color: var(--text-secondary, #a0aec0);
  font-size: 1rem;
  line-height: 1.9;
}

.term-sublist {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.term-sublist > li {
  position: relative;
  padding-inline-start: 18px;
}

.term-sublist > li::before {
  content: '';
  position: absolute;
  inset-inline-start: 2px;
  top: 0.8em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gold, #f5c542);
}

.term-items-list > li.term-emphasis {
  color: var(--text-primary, #f8fafc);
  font-weight: 700;
}

/* ------------------------------------------------------------ final card */
.terms-final {
  margin-top: clamp(48px, 6vw, 72px);
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid var(--border-subtle, rgba(165, 180, 252, 0.1));
  border-radius: 24px;
  background:
    radial-gradient(circle at 50% 0%, rgba(var(--accent-gold-rgb, 245, 197, 66), 0.1) 0%, transparent 60%),
    var(--bg-card, rgba(18, 18, 34, 0.72));
  text-align: center;
}

.terms-final-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 16px;
  border-radius: 50%;
  background: rgba(var(--accent-gold-rgb, 245, 197, 66), 0.14);
  color: var(--accent-gold, #f5c542);
}

.terms-final-title {
  margin: 0 0 12px;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 700;
}

.terms-final-ar {
  max-width: 600px;
  margin: 0 auto;
  color: var(--text-secondary, #a0aec0);
  line-height: 1.9;
}

.terms-final-en {
  max-width: 600px;
  margin-inline: auto;
  text-align: center;
}

.terms-final-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.terms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 9999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.terms-btn:hover {
  transform: translateY(-1px);
}

.terms-btn--gold {
  border: 0;
  background: var(--accent-gold, #f5c542);
  color: #080811;
}

.terms-btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary, #f8fafc);
}

.terms-home-link:focus-visible,
.terms-toc-link:focus-visible,
.terms-toc-summary:focus-visible,
.terms-btn:focus-visible {
  outline: 2px solid var(--accent-gold, #f5c542);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .terms-final-actions .terms-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terms-btn,
  .terms-toc-link,
  .terms-home-link,
  .terms-toc-summary::after {
    transition: none;
  }

  .terms-btn:hover {
    transform: none;
  }
}

/* ----------------------------------------------------------------- print */
@media print {
  @page {
    margin: 18mm 16mm;
  }

  body.terms-body {
    background: #ffffff !important;
    color: #111111 !important;
  }

  .site-header,
  .site-editorial-footer,
  .terms-toc,
  .terms-hero-top,
  .terms-final-actions,
  .om-dock,
  #ownerAccessBtn {
    display: none !important;
  }

  .terms-hero {
    padding: 0 0 16px;
    background: none;
    border-color: #dddddd;
  }

  .terms-layout {
    display: block;
    padding-top: 16px;
  }

  .terms-content-col {
    max-width: none;
  }

  .terms-title,
  .term-title,
  .terms-notice-title,
  .terms-party h3,
  .terms-final-title {
    color: #111111;
  }

  .terms-lede,
  .terms-notice-ar,
  .terms-party p,
  .term-items-list > li,
  .term-paragraph,
  .terms-final-ar {
    color: #333333;
  }

  .terms-eyebrow,
  .term-num-badge,
  .terms-party-tag {
    color: #8a6a00;
  }

  .terms-notice,
  .terms-party,
  .terms-final {
    background: none;
    border-color: #dddddd;
  }

  .term-card {
    break-inside: avoid;
    border-color: #dddddd;
  }

  .term-items-list > li::before {
    background: none;
    color: #8a6a00;
    border: 1px solid #8a6a00;
  }

  .term-items-list > li.term-emphasis {
    color: #111111;
  }
}
