/* ============================================
   Cloud Pratica — Terms of Service Styles
   ============================================ */

/* ── Layout ── */
.terms-layout {
  padding-top: var(--space-8);
  padding-bottom: var(--space-16);
}

.terms-layout__inner {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-12);
  align-items: start;
}

/* ── Sidebar (PC) ── */
.terms-sidebar {
  display: block;
}

.terms-sidebar__sticky {
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  padding-right: var(--space-4);
}

/* Scrollbar styling */
.terms-sidebar__sticky::-webkit-scrollbar {
  width: 3px;
}

.terms-sidebar__sticky::-webkit-scrollbar-track {
  background: transparent;
}

.terms-sidebar__sticky::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.terms-sidebar__heading {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border);
}

.terms-sidebar__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.terms-sidebar__link {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  border-left: 2px solid transparent;
  transition: all var(--transition-fast);
  line-height: var(--leading-normal);
}

.terms-sidebar__link:hover {
  color: var(--color-text-secondary);
  background: rgba(255, 255, 255, 0.03);
}

.terms-sidebar__link.active {
  color: var(--color-accent);
  background: var(--color-accent-glow);
  border-left-color: var(--color-accent);
  font-weight: var(--weight-medium);
}

/* ── Mobile TOC ── */
.terms-toc-mobile {
  display: none;
  position: sticky;
  top: 60px;
  z-index: var(--z-dropdown);
  background: var(--color-bg-secondary);
  border-bottom: 1px solid var(--color-border);
  padding: 0 var(--container-padding);
}

.terms-toc-mobile__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) 0;
  background: none;
  border: none;
  color: var(--color-text-secondary);
  font-family: var(--font-primary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
}

.toc-chevron {
  margin-left: auto;
  transition: transform var(--transition-base);
}

.terms-toc-mobile__toggle.open .toc-chevron {
  transform: rotate(180deg);
}

.terms-toc-mobile__list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-slow);
}

.terms-toc-mobile__list.open {
  max-height: 600px;
  padding-bottom: var(--space-4);
}

.terms-toc-mobile__list a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.terms-toc-mobile__list a:hover,
.terms-toc-mobile__list a:active {
  color: var(--color-accent);
}

/* ── Content ── */
.terms-content {
  min-width: 0;
}

.terms-content__intro {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

.terms-article {
  margin-bottom: var(--space-10);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
  scroll-margin-top: 100px;
}

.terms-article:last-of-type {
  border-bottom: none;
}

.terms-article__title {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-5);
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-accent);
}

.terms-article__list {
  padding-left: var(--space-6);
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.terms-article__list > li {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.terms-article__list > li::marker {
  color: var(--color-accent);
  font-weight: var(--weight-semibold);
}

.terms-article__sublist {
  list-style: none;
  padding-left: var(--space-4);
  margin-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.terms-article__sublist > li {
  position: relative;
  padding-left: var(--space-5);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.terms-article__sublist > li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-text-muted);
}

.terms-article__sublist .terms-article__sublist > li::before {
  background: transparent;
  border: 1px solid var(--color-text-muted);
}

.terms-content__date {
  margin-top: var(--space-12);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-align: center;
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .terms-layout__inner {
    grid-template-columns: 220px 1fr;
    gap: var(--space-8);
  }
}

@media (max-width: 768px) {
  .terms-sidebar {
    display: none;
  }

  .terms-toc-mobile {
    display: block;
  }

  .terms-layout__inner {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .terms-article {
    scroll-margin-top: 120px;
  }

  .terms-article__title {
    font-size: var(--text-lg);
  }
}
