/**
 * assets/css/legal.css
 *
 * Styles for legal and error pages:
 *   .page--privacy
 *   .page--terms
 *   .page--delete-data
 *   .page--404
 *
 * Loaded only on these pages via $pageStyles.
 * Base tokens and shared components come from global.css + components.css.
 */

/* =========================================================
   LEGAL PAGE — SHARED LAYOUT
   ========================================================= */

.page--privacy  .legal-body,
.page--terms    .legal-body,
.page--delete-data .legal-body {
  padding-block: var(--space-16) var(--space-24);
}

/* Hero / page header */
.legal-hero {
  padding-block: var(--space-16) var(--space-12);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-16);
}

.legal-hero__eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-lantern);
  margin-bottom: var(--space-4);
}

.legal-hero__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 4vw, var(--text-5xl));
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--moon-white);
  margin-bottom: var(--space-5);
}

.legal-hero__meta {
  font-size: var(--text-sm);
  color: var(--color-text-3);
}

/* =========================================================
   LEGAL CONTENT WRAPPER
   ========================================================= */

.legal-content {
  /* Stacks sections with flow spacing */
}

/* =========================================================
   LEGAL SECTIONS
   ========================================================= */

.legal-section {
  margin-bottom: var(--space-16);
}

.legal-section:last-child {
  margin-bottom: 0;
}

.legal-section__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 2.5vw, var(--text-2xl));
  font-weight: 400;
  color: var(--gold-lantern);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid rgba(232, 201, 122, 0.15);
  position: relative;
}

.legal-section__title::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 2.5rem;
  height: 1px;
  background: var(--gold-lantern);
}

/* =========================================================
   LEGAL PROSE
   ========================================================= */

.legal-prose p {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-text-2);
  max-width: 68ch;
  margin-bottom: var(--space-5);
}

.legal-prose p:last-child {
  margin-bottom: 0;
}

.legal-prose a {
  color: var(--gold-lantern);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color var(--duration-fast) var(--ease-gentle),
              text-decoration-color var(--duration-fast) var(--ease-gentle);
}

.legal-prose a:hover {
  color: var(--moon-white);
  text-decoration-color: transparent;
}

/* =========================================================
   LEGAL LISTS
   ========================================================= */

.legal-list {
  list-style: none;
  margin-bottom: var(--space-5);
}

.legal-list li {
  position: relative;
  padding-left: var(--space-6);
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-text-2);
  margin-bottom: var(--space-3);
}

.legal-list li::before {
  content: '\2726';
  position: absolute;
  left: 0;
  top: 0.05em;
  color: var(--gold-lantern);
  font-size: var(--text-xs);
  opacity: 0.7;
}

.legal-list li:last-child {
  margin-bottom: 0;
}

/* Ordered list variant */
.legal-list--ordered {
  counter-reset: legal-counter;
}

.legal-list--ordered li {
  counter-increment: legal-counter;
}

.legal-list--ordered li::before {
  content: counter(legal-counter) '.';
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--gold-lantern);
  opacity: 0.8;
  top: 0.2em;
}

/* =========================================================
   WARNING BOX
   ========================================================= */

.legal-warning {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border: 1px solid rgba(212, 168, 83, 0.3);
  border-left: 3px solid var(--gold-warm);
  border-radius: var(--radius-md);
  background: rgba(212, 168, 83, 0.05);
  margin-bottom: var(--space-6);
}

.legal-warning__icon {
  flex-shrink: 0;
  font-size: var(--text-lg);
  line-height: 1.5;
  opacity: 0.85;
}

.legal-warning__text {
  flex: 1;
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--moon-soft);
}

.legal-warning__text strong {
  display: block;
  font-weight: 500;
  color: var(--gold-warm);
  margin-bottom: var(--space-1);
}

/* =========================================================
   STORAGE DETAIL CARD
   ========================================================= */

.legal-storage-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
}

.legal-storage-card__label {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lavender-soft);
  margin-bottom: var(--space-4);
}

.legal-storage-card p {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--color-text-2);
  margin-bottom: var(--space-3);
}

.legal-storage-card p:last-child {
  margin-bottom: 0;
}

/* =========================================================
   SECTION DIVIDER
   ========================================================= */

.legal-divider {
  border: none;
  border-top: 1px solid var(--glass-border);
  margin-block: var(--space-12);
}

/* =========================================================
   DISCLAIMER BOX (bottom of legal pages)
   ========================================================= */

.legal-disclaimer {
  margin-top: var(--space-16);
  padding: var(--space-6) var(--space-8);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.legal-disclaimer p {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text-3);
  max-width: none;
  margin: 0;
}

/* =========================================================
   DELETE DATA PAGE — SPECIFIC
   ========================================================= */

.delete-zone {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  margin-bottom: var(--space-8);
}

.delete-zone__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--moon-white);
  margin-bottom: var(--space-3);
}

.delete-zone__desc {
  font-size: var(--text-sm);
  line-height: 1.75;
  color: var(--color-text-2);
  margin-bottom: var(--space-6);
  max-width: 56ch;
}

.delete-zone__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  align-items: center;
}

/* Delete zone — danger variant */
.delete-zone--danger {
  border-color: rgba(180, 60, 60, 0.3);
  background: rgba(180, 60, 60, 0.04);
}

.delete-zone--danger .delete-zone__title {
  color: #e08080;
}

/* Storage availability notice */
.storage-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  margin-bottom: var(--space-8);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
}

.storage-status__dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  background: var(--moon-dim);
}

.storage-status--ok    .storage-status__dot { background: #6db88a; }
.storage-status--warn  .storage-status__dot { background: var(--gold-warm); }
.storage-status--error .storage-status__dot { background: #c05050; }

.storage-status__text {
  color: var(--color-text-2);
}

/* Live region for status announcements */
.delete-live-region {
  font-size: var(--text-sm);
  color: var(--color-text-3);
  min-height: 1.5em;
  margin-top: var(--space-3);
}

/* =========================================================
   CONFIRM DIALOG
   ========================================================= */

/*
 * .dialog-backdrop and .dialog come from components.css.
 * These rules extend for the delete-data page specifics.
 */

.delete-confirm-list {
  list-style: none;
  margin: var(--space-5) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.delete-confirm-list li {
  display: flex;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-2);
  line-height: 1.6;
}

.delete-confirm-list li::before {
  content: '\00B7';
  color: var(--gold-lantern);
  flex-shrink: 0;
  font-size: var(--text-lg);
  line-height: 1.3;
}

.dialog__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-6);
  justify-content: flex-end;
}

/* =========================================================
   404 PAGE
   ========================================================= */

.page--404 .main-404 {
  min-height: calc(100svh - 12rem);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-block: var(--space-24);
}

.error-404 {
  text-align: center;
  max-width: 32rem;
  margin-inline: auto;
}

.error-404__number {
  font-family: var(--font-display);
  font-size: clamp(6rem, 20vw, 12rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.04em;
  color: transparent;
  background: linear-gradient(
    135deg,
    rgba(232, 201, 122, 0.7) 0%,
    rgba(157, 142, 196, 0.5) 50%,
    rgba(232, 201, 122, 0.3) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  margin-bottom: var(--space-6);
  animation: drift-in var(--duration-slow) var(--ease-gentle) both;
}

.error-404__title {
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 4vw, var(--text-4xl));
  font-weight: 300;
  color: var(--moon-white);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-5);
  animation: drift-in var(--duration-slow) var(--ease-gentle) 100ms both;
}

.error-404__text {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-text-2);
  margin-bottom: var(--space-10);
  max-width: 42ch;
  margin-inline: auto;
  animation: drift-in var(--duration-slow) var(--ease-gentle) 200ms both;
}

.error-404__stars {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-10);
  animation: drift-in var(--duration-drift) var(--ease-gentle) 300ms both;
}

.error-404__star {
  color: var(--gold-lantern);
  opacity: 0.25;
  font-size: var(--text-sm);
  animation: twinkle 3s var(--ease-gentle) infinite alternate;
}

.error-404__star:nth-child(2) { animation-delay: 0.6s; opacity: 0.4; }
.error-404__star:nth-child(3) { animation-delay: 1.2s; opacity: 0.2; }
.error-404__star:nth-child(4) { animation-delay: 0.3s; opacity: 0.5; }
.error-404__star:nth-child(5) { animation-delay: 0.9s; opacity: 0.2; }

.error-404__action {
  animation: drift-in var(--duration-slow) var(--ease-gentle) 400ms both;
}

/* =========================================================
   ANIMATIONS
   ========================================================= */

@keyframes drift-in {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes twinkle {
  from { opacity: 0.1; transform: scale(0.9); }
  to   { opacity: 0.6; transform: scale(1.1); }
}

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

@media (max-width: 640px) {
  .legal-hero {
    padding-block: var(--space-12) var(--space-8);
  }

  .legal-section {
    margin-bottom: var(--space-12);
  }

  .delete-zone {
    padding: var(--space-6);
  }

  .delete-zone__actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .dialog__actions {
    flex-direction: column-reverse;
  }

  .dialog__actions .btn {
    width: 100%;
    justify-content: center;
  }
}
