/* ==========================================================================
   Zenix Academy — sub-page shell (legal pages + 404)

   /terms, /privacy and /delete-account are canonical here. They are the URLs
   the app stores are pointed at, so treat their wording as fixed: edit the
   text only on purpose, never incidentally while restyling.
   ========================================================================== */

/* ------------------------------------------------------------ page header -- */
/* The legal pages carry a reduced header: brand + one way back. No anchor nav
   and no drawer, so they need no JavaScript to be usable. */
.page-back {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  margin-inline-start: auto;
  padding: .55rem .9rem;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.page-back:hover { color: var(--accent-ink); background: var(--accent-softer); }
.page-back svg {
  inline-size: 16px; block-size: 16px;
  /* RTL: "back" points to the inline-start, which is visually right. */
  transition: transform var(--t-med) var(--ease-out);
}
.page-back:hover svg { transform: translateX(-4px); }

.page-hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-block: clamp(2.75rem, 6vw, 4.5rem) clamp(2rem, 4vw, 3rem);
  border-block-end: 1px solid var(--rule);
  background:
    radial-gradient(62% 120% at 88% 0%, rgba(11, 119, 124, .12), transparent 68%),
    radial-gradient(46% 90% at 6% 100%, rgba(68, 102, 107, .10), transparent 70%),
    var(--surface);
}
.page-hero h1 { font-size: var(--fs-3xl); max-width: 22ch; }
.page-hero .lead { margin-block-start: 1.1rem; }

.page-meta {
  margin-block-start: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem .85rem;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  font-size: var(--fs-xs);
  color: var(--ink-soft);
}

/* ------------------------------------------------------------ legal layout -- */
.legal {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  align-items: start;
  padding-block: clamp(2.5rem, 5vw, 4rem);
}
@media (max-width: 900px) { .legal { grid-template-columns: 1fr; } }

.legal__side { display: grid; gap: 1.75rem; }
@media (min-width: 901px) {
  .legal__side { position: sticky; inset-block-start: calc(var(--header-h) + 1.5rem); }
}

.doc-switch__title,
.toc__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-mute);
  margin-block-end: .75rem;
}

.doc-switch ul { display: grid; gap: .3rem; }
.doc-switch__link {
  display: block;
  padding: .6rem .85rem;
  border-radius: var(--r-md);
  color: var(--ink-soft);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.doc-switch__link:hover { color: var(--accent-ink); background: var(--accent-softer); }
.doc-switch__link[aria-current="page"] {
  color: var(--accent-ink);
  font-weight: 700;
  background: var(--accent-soft);
  border-color: var(--accent-line);
}

/* On a phone the sidebar sits above the text, so the table of contents would
   be a second wall to scroll past before reaching the first one. */
.toc { display: none; }
@media (min-width: 901px) { .toc { display: block; } }
.toc ul { display: grid; gap: .1rem; }
.toc a {
  display: flex;
  gap: .6rem;
  padding: .4rem .85rem;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: var(--fs-xs);
  line-height: 1.6;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.toc a:hover { color: var(--accent-ink); background: var(--accent-softer); }
.toc__num {
  flex: none;
  font-family: var(--font-wordmark);
  font-weight: 700;
  color: var(--accent);
  opacity: .55;
}

/* ------------------------------------------------------------------ prose -- */
.prose {
  max-width: 68ch;
  min-inline-size: 0;
}
.prose__section + .prose__section { margin-block-start: clamp(2.25rem, 4vw, 3rem); }
/* Anchors from the table of contents must not land under the sticky header.
   html{scroll-padding-block-start} covers it, this is the per-target guard for
   browsers that ignore it on a programmatic jump. */
.prose__section { scroll-margin-block-start: calc(var(--header-h) + 1.5rem); }

.prose h2 {
  display: flex;
  align-items: baseline;
  gap: .8rem;
  font-size: var(--fs-xl);
  margin-block-end: 1.1rem;
  padding-block-end: .75rem;
  border-block-end: 1px solid var(--rule);
}
.prose__num {
  flex: none;
  font-family: var(--font-wordmark);
  font-size: .8em;
  font-weight: 700;
  color: var(--accent);
  opacity: .5;
}
.prose h3 { font-size: var(--fs-lg); margin-block: 1.75rem .6rem; }
.prose p  { margin-block-end: 1.1rem; color: var(--ink-soft); }
.prose p:last-child { margin-block-end: 0; }
.prose b  { color: var(--ink); font-weight: 700; }

.prose ul { margin-block-end: 1.1rem; display: grid; gap: .6rem; }
.prose ul:last-child { margin-block-end: 0; }
.prose li {
  position: relative;
  padding-inline-start: 1.5rem;
  color: var(--ink-soft);
}
.prose li::before {
  content: "";
  position: absolute;
  inset-block-start: .78em;
  inset-inline-start: .35rem;
  inline-size: 6px; block-size: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.prose a { font-weight: 500; }

/* A qualifier the reader must not skim past — retention limits, what cannot be
   removed. Set apart rather than left as one more paragraph. */
.prose__note {
  margin-block-start: 1.1rem;
  padding: 1rem 1.15rem;
  padding-inline-start: 1.25rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border-inline-start: 3px solid var(--accent);
  font-size: var(--fs-sm);
  line-height: 1.8;
}

/* An email address is a Latin run inside Arabic: isolate it or bidi will
   reorder the parts around the @ and the dot. */
.mail {
  unicode-bidi: isolate;
  direction: ltr;
  font-weight: 700;
  word-break: break-all;
}

.contact-card {
  display: flex;
  gap: 1.1rem;
  align-items: flex-start;
  margin-block-start: clamp(2.5rem, 5vw, 3.5rem);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: var(--shadow-sm);
}
.contact-card__icon {
  inline-size: 46px; block-size: 46px;
  flex: none;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  color: var(--accent-ink);
}
.contact-card__icon svg { inline-size: 22px; block-size: 22px; }
.contact-card b { display: block; font-size: var(--fs-base); margin-block-end: .3rem; }
.contact-card p { font-size: var(--fs-sm); margin-block-end: .5rem; }

/* ------------------------------------------------------------------- 404 -- */
.notfound {
  min-block-size: calc(100dvh - var(--header-h));
  display: grid;
  place-items: center;
  text-align: center;
  padding-block: clamp(3rem, 8vw, 6rem);
  background:
    radial-gradient(58% 46% at 80% 6%, rgba(11, 119, 124, .13), transparent 70%),
    radial-gradient(46% 40% at 14% 92%, rgba(68, 102, 107, .12), transparent 72%),
    var(--paper);
}
.notfound__code {
  font-family: var(--font-wordmark);
  direction: ltr;
  unicode-bidi: isolate;
  font-size: clamp(5rem, 18vw, 10rem);
  font-weight: 700;
  line-height: 1;
  background-image: var(--sheen);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}
.notfound h1 { font-size: var(--fs-2xl); margin-block: 1rem .75rem; }
.notfound p  { color: var(--ink-soft); max-width: 44ch; margin-inline: auto; }
.notfound .btn { margin-block-start: 2rem; }
