/*
 * FilexFlow Legal Pages
 * Canonical presentation owner for:
 * Terms of Service / Privacy Policy / Legal Notice
 */

/* ============================================================
   PAGE LAYOUT
   ============================================================ */

.layout-terms,
.layout-privacy,
.layout-legal {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  gap: 24px;
  align-items: start;
}

/*
 * Desktop:
 * document + summary/navigation sidebar.
 *
 * The width itself is owned by the existing FilexFlow shell.
 * These pages therefore consume 100% of the shell instead of
 * introducing another narrower page maximum.
 */
@media (min-width: 960px) {
  .layout-terms,
  .layout-privacy,
  .layout-legal {
    grid-template-columns:
      minmax(0, 1.8fr)
      minmax(280px, 0.72fr);
    gap: 24px;
  }
}

.card-terms-main,
.card-privacy-main,
.card-legal-main,
.card-terms-side,
.card-privacy-side,
.card-legal-side {
  min-width: 0;
  width: 100%;
}

.card-terms-main .card-inner,
.card-privacy-main .card-inner,
.card-legal-main .card-inner {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-terms-side .card-inner,
.card-privacy-side .card-inner,
.card-legal-side .card-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
}


/* ============================================================
   LABELS
   ============================================================ */

.card-terms-main .hero-label,
.card-terms-side .hero-label,
.card-privacy-main .hero-label,
.card-privacy-side .hero-label,
.card-legal-main .hero-label,
.card-legal-side .hero-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  align-self: flex-start;
}

.hero-label-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #22c55e;
}

.hero-label-text {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}


/* ============================================================
   DOCUMENT HEADER
   ============================================================ */

.legal-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.legal-header .card-title {
  margin: 0;
}

.legal-header .card-subtitle {
  font-size: 0.9rem;
  max-width: 720px;
}

.legal-meta {
  font-size: 0.8rem;
  opacity: 0.8;
}


/* ============================================================
   LEGAL DOCUMENT BODY
   ============================================================ */

.legal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.6;
}

.legal-section {
  min-width: 0;
  scroll-margin-top: 24px;
}

.legal-section h2 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.legal-section p,
.legal-section li {
  font-size: 0.9rem;
  line-height: 1.6;
}

.legal-section ul,
.legal-section ol {
  padding-left: 20px;
}


/* ============================================================
   SUMMARY SIDEBAR
   ============================================================ */

.card-terms-side .card-title {
  font-size: 1.1rem;
}

.card-privacy-side .card-title,
.card-legal-side .card-title {
  font-size: 1.05rem;
}

.card-terms-side .card-subtitle,
.card-privacy-side .card-subtitle,
.card-legal-side .card-subtitle {
  line-height: 1.5;
}


/* Key points */

.legal-keypoints {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.85rem;
}

.layout-terms .legal-keypoints {
  margin: 0;
}

.layout-privacy .legal-keypoints,
.layout-legal .legal-keypoints {
  margin: 8px 0 0;
}

.legal-keypoints li {
  position: relative;
  padding-left: 15px;
  line-height: 1.45;
}

.legal-keypoints li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #22c55e;
}


/* ============================================================
   QUICK NAVIGATION
   ============================================================ */

/*
 * Existing HTML anchors are retained.
 * Presentation makes their navigation role explicit.
 */
.legal-side-links {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  margin-top: 2px;
  font-size: 0.82rem;
}

.legal-side-links a {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 36px;
  padding: 8px 11px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 9px;
  background: rgba(148, 163, 184, 0.06);
  color: inherit;
  line-height: 1.3;
  text-decoration: none;
  opacity: 0.95;
  transition:
    border-color 140ms ease,
    background 140ms ease,
    transform 140ms ease;
}

.legal-side-links a::after {
  content: "→";
  flex: 0 0 auto;
  margin-left: auto;
  padding-left: 10px;
  opacity: 0.6;
}

.legal-side-links a:hover,
.legal-side-links a:focus-visible {
  border-color: rgba(96, 165, 250, 0.5);
  background: rgba(96, 165, 250, 0.1);
  text-decoration: none;
}

.legal-side-links a:focus-visible {
  outline: 2px solid rgba(96, 165, 250, 0.55);
  outline-offset: 2px;
}


/* Related legal documents */

.legal-side-secondary {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  opacity: 0.9;
}

.legal-side-secondary::after {
  content: "↗";
  margin-left: 6px;
  font-size: 0.78em;
  opacity: 0.6;
}

.legal-side-secondary:hover,
.legal-side-secondary:focus-visible {
  text-decoration: underline;
  opacity: 1;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 959px) {
  .layout-terms,
  .layout-privacy,
  .layout-legal {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .card-terms-side,
  .card-privacy-side,
  .card-legal-side {
    margin-top: 0;
  }
}

@media (max-width: 640px) {
  .layout-terms,
  .layout-privacy,
  .layout-legal {
    gap: 16px;
  }

  .legal-side-links a {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .legal-side-links a {
    transition: none;
  }
}