/* ==========================================================================
   U01 — Utility templates
   One page, one section per template, addressed by hash:
   #notfound (404 "Signal lost."), #legal, #thanks, #consent, #gate.
   Behavior: js/pages/u01-utility-templates.js
   ========================================================================== */

/* Deep links land below the sticky header (100px) + template nav (52px). */
.utility-section {
  scroll-margin-top: 152px;
}

/* Plain link buttons used across the templates */
.utility-btn {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
}

.utility-btn--tall {
  height: 52px;
  padding: 0 18px;
}

.utility-btn--primary,
.utility-btn--primary:hover {
  padding: 0 18px;
  border: 0;
  background: var(--action);
  color: var(--on-action);
  font-weight: 600;
}

.utility-btn--primary.utility-btn--tall {
  gap: 10px;
  padding: 0 20px;
}

/* --------------------------------------------------------------------------
   Template index (sticky below the site header)
   -------------------------------------------------------------------------- */
.template-nav {
  position: sticky;
  top: 100px;
  z-index: 30;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.template-nav__inner {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 52px;
  overflow-x: auto;
}

.template-nav__label {
  margin-right: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  white-space: nowrap;
}

.template-nav__link,
.template-nav__link:hover {
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 12px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   404 · Signal lost (FluxField dipole behind the copy)
   -------------------------------------------------------------------------- */
.notfound {
  position: relative;
  display: flex;
  min-height: calc(100vh - 152px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.notfound__field {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.notfound__inner {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: clamp(40px, 8vh, 96px) var(--gutter-site);
}

.notfound__eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
}

.notfound__title {
  font-size: clamp(64px, 13vw, 220px);
  line-height: .82;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -.055em;
}

.notfound__text {
  max-width: 46ch;
  font-size: 19px;
  color: var(--text-2);
}

.notfound__search {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  height: 56px;
  padding: 0 16px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
}

.notfound__search .icon {
  color: #EDEFF2;
}

.notfound__input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 400 17px var(--font-sans);
  outline: none;
}

.notfound__routes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.notfound__pause {
  align-self: flex-start;
  height: 36px;
  padding: 0 14px;
  white-space: nowrap;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: normal;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Legal page (Cleanroom subtree)
   -------------------------------------------------------------------------- */
.legal {
  position: relative;
  padding: clamp(64px, 7vw, 112px) 0;
  background: var(--canvas);
  color: var(--text);
  border-bottom: 1px solid var(--line);
}

.legal__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: 48px;
  max-width: 1200px;
}

.legal__toc {
  position: sticky;
  top: 180px;
  align-self: start;
}

.legal__toc-label {
  margin-bottom: 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.legal__toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.legal__toc-link,
.legal__toc-link:hover {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  font-size: 14px;
  color: var(--text-2);
}

.legal__num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.legal__body {
  grid-column: span 2;
  min-width: 0;
  max-width: 70ch;
}

.legal__title {
  margin-top: 14px;
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: .98;
  font-weight: 700;
  font-stretch: 122%;
  letter-spacing: -.035em;
}

.legal__clause {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.legal__clause-title {
  font-size: 22px;
  font-weight: 600;
}

.legal__clause-num {
  margin-right: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-3);
}

.legal__clause-text {
  margin-top: 12px;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text-2);
}

/* --------------------------------------------------------------------------
   Thank-you page
   -------------------------------------------------------------------------- */
.thanks {
  position: relative;
  padding: clamp(64px, 8vw, 128px) 0;
  border-bottom: 1px solid var(--line);
}

.thanks__inner {
  max-width: 1100px;
}

.thanks__status {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--success);
}

.thanks__title {
  margin-top: 16px;
  font-size: clamp(44px, 7vw, 112px);
  line-height: .88;
  font-weight: 750;
  font-stretch: 125%;
  letter-spacing: -.045em;
}

.thanks__text {
  max-width: 52ch;
  margin-top: 20px;
  font-size: 19px;
  color: var(--text-2);
}

.thanks__steps {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  margin-top: 36px;
}

.thanks__step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  background: var(--surface-1);
}

.thanks__when {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
}

.thanks__when--done {
  color: var(--success);
}

.thanks__step-text {
  font-size: 14px;
  color: var(--text-2);
}

.thanks__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

/* --------------------------------------------------------------------------
   Cookie consent · states
   -------------------------------------------------------------------------- */
.consent {
  position: relative;
  padding: clamp(64px, 7vw, 112px) 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-1);
}

.consent__tabs {
  display: inline-flex;
  margin-top: 24px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
}

.consent__tab {
  height: 40px;
  padding: 0 14px;
  white-space: nowrap;
  border: 0;
  border-radius: 1px;
  background: transparent;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: normal;
  cursor: pointer;
}

.consent__tab[aria-selected="true"] {
  background: var(--text);
  color: var(--canvas);
}

.consent__stage {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  min-height: 320px;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--canvas);
}

.consent-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 720px;
  padding: 20px;
  background: var(--surface-1);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
}

.consent-panel--settings {
  gap: 6px;
}

.consent-panel__heading {
  margin-bottom: 6px;
}

.consent-panel__text {
  font-size: 14px;
  color: var(--text-2);
}

.consent-panel__choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.consent-panel__btn {
  height: 48px;
  padding: 1px 6px;
  border: 1px solid var(--text);
  border-radius: var(--r-1);
  background: transparent;
  color: var(--text);
  font: 600 15px var(--font-sans);
  cursor: pointer;
}

.consent-panel__btn--link {
  border: 0;
  font-weight: 500;
  text-decoration: underline;
}

.consent-panel__btn--save {
  padding: 0 20px;
}

.consent-panel__save {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.consent-category {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.consent-category__title {
  font-size: 15px;
}

.consent-category__text {
  font-size: 13px;
  color: var(--text-2);
}

/* Toggle switch: aria-checked drives the look; disabled = always-on category */
.consent-switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 24px;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: transparent;
  cursor: pointer;
}

.consent-switch[aria-checked="true"] {
  border-color: var(--action);
  background: var(--action);
}

.consent-switch:disabled {
  opacity: .6;
}

.consent-switch__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--text-2);
  transition: transform 250ms cubic-bezier(.34, 1.3, .64, 1);
}

.consent-switch[aria-checked="true"] .consent-switch__knob {
  background: var(--on-action);
  transform: translateX(20px);
}

.consent-saved {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 720px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: var(--surface-1);
  font-size: 14px;
}

.consent-saved__reopen {
  height: 40px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: 500 14px var(--font-sans);
  text-decoration: underline;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Export-control gate · states
   -------------------------------------------------------------------------- */
.gate {
  position: relative;
  padding: clamp(64px, 7vw, 112px) 0;
}

.gate__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: 12px;
  margin-top: 24px;
}

.gate-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 260px;
  padding: 22px;
  border: 1px solid var(--line-strong);
  background: var(--surface-1);
}

.gate-card__kind {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-2);
}

.gate-card__title {
  font-size: 19px;
  line-height: 1.25;
}

.gate-card__text {
  font-size: 14px;
  color: var(--text-2);
}

.gate-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  margin-top: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-1);
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

.gate-card__cta--primary {
  border-color: var(--action);
  background: var(--action);
  color: var(--on-action);
}

.gate-card__cta--muted {
  opacity: .5;
}

/* State colors */
.gate-card--region {
  border-color: var(--warning);
}

.gate-card--region .gate-card__kind {
  color: var(--warning);
}

.gate-card--blocked {
  border-color: var(--critical);
}

.gate-card--blocked .gate-card__kind {
  color: var(--critical);
}

.gate-card--pending {
  border-style: dashed;
}

.gate-card--pending .gate-card__kind .icon {
  color: var(--text);
}

.gate-card--approved {
  border-color: var(--success);
}

.gate-card--approved .gate-card__kind {
  color: var(--success);
}
