/* Guide pages (guides, hubs, about, editorial policy, methodology). Loaded after styles.css, only by those pages, so the landing page stays tiny.
   Uses the tokens of styles.css only. Text colours are --text, --text-2 and --accent (all covered by tests/contrast.test.mjs). */

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
}

.main-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  color: var(--text-2);
  text-decoration: none;
}

.main-nav a:hover {
  color: var(--text);
  text-decoration: underline;
}

.guide {
  max-width: 46rem;
}

.guide h1 {
  margin-bottom: 0.5rem;
  font-size: clamp(1.75rem, 5.5vw, 2.5rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.guide h2 {
  scroll-margin-top: 1rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.breadcrumb li {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.breadcrumb li + li::before {
  content: "\203A";
  margin-right: 0.5rem;
  color: var(--text-2);
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  color: var(--text-2);
}

.breadcrumb [aria-current="page"] {
  color: var(--text);
}

.byline {
  margin: 0 0 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.draft {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
}

.answer,
.note,
.disagree,
.emergency,
.next-step {
  margin: 1.25rem 0;
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.answer {
  border-left: 5px solid var(--accent-strong);
  font-size: 1.125rem;
}

.answer p,
.note p,
.emergency p,
.emergency ul,
.next-step p {
  margin: 0 0 0.5rem;
}

.answer p:last-child,
.note p:last-child,
.emergency p:last-child,
.next-step p:last-child {
  margin-bottom: 0;
}

.emergency {
  border: 2px solid var(--accent);
}

/* the App Store badge inside the next-step box: left-aligned like the text above it */
.next-step .store {
  justify-content: flex-start;
  margin-top: 0.75rem;
}

.next-step {
  border-left: 5px solid var(--accent);
}

.emergency h2,
.next-step h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.emergency ul {
  padding-left: 1.25rem;
}

.note-warning {
  border-left: 5px solid var(--accent-strong);
}

.note-title {
  font-size: 1.0625rem;
}

.disagree h3 {
  margin-top: 0;
}

.advice {
  margin: 0.75rem 0 0;
}

.table-wrap {
  margin: 0.75rem 0 1.25rem;
  overflow-x: auto;
}

.table-wrap:focus-visible {
  outline-offset: 2px;
}

table {
  width: 100%;
  min-width: 28rem;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.45;
}

caption {
  padding: 0 0 0.5rem;
  text-align: left;
  color: var(--text-2);
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.5rem 0.625rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

thead th {
  color: var(--text);
  border-bottom-width: 2px;
}

tbody th {
  font-weight: 650;
}

.steps {
  padding-left: 1.5rem;
}

.cite {
  font-size: 0.75em;
  line-height: 0;
}

.cite a {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0.25rem 0.0625rem;
  text-align: center;
  text-decoration: none;
}

.sources ol,
.related ul {
  padding-left: 1.4rem;
}

.sources li,
.related li {
  margin-bottom: 0.5rem;
  overflow-wrap: anywhere;
}

.sources li:target {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.disclaimer {
  margin-top: 1.5rem;
  font-size: 0.9375rem;
  color: var(--text-2);
}

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

/* planner */

.planner {
  display: grid;
  gap: 0.25rem 1rem;
  margin: 1rem 0;
  padding: 1rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.planner p {
  margin: 0 0 0.75rem;
}

.planner label {
  display: block;
  margin-bottom: 0.25rem;
}

.planner input[type="text"],
.planner select {
  width: 100%;
  min-height: 3rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}

.planner input[aria-invalid="true"] {
  border-color: var(--accent);
}

.planner [hidden] {
  display: none;
}

.planner-result p {
  margin: 0 0 0.5rem;
}

@media (min-width: 40rem) {
  .planner {
    grid-template-columns: 1fr 1fr;
  }

  .planner > button,
  .planner > #pl-error,
  .planner > .planner-result {
    grid-column: 1 / -1;
  }
}

/* tools (calculators and helpers, tools/*.js): the form is a .planner, these are the extras */

.planner .field {
  margin: 0 0 0.75rem;
}

.planner textarea {
  width: 100%;
  min-height: 5.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
  resize: vertical;
}

.planner textarea[aria-invalid="true"],
.planner select[aria-invalid="true"] {
  border-color: var(--accent);
}

.planner .hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.planner .check-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
}

.planner input[type="checkbox"] {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  accent-color: var(--accent-strong);
}

.planner .field-wide {
  grid-column: 1 / -1;
}

.tool-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.tool-result .lead {
  font-size: 1.375rem;
  font-weight: 700;
  line-height: 1.3;
}

.tool-result .warn {
  padding-left: 0.75rem;
  border-left: 5px solid var(--accent-strong);
}

.tool-result h3 {
  margin: 1rem 0 0.5rem;
  font-size: 1.125rem;
}

.tool-result ul,
.tool-result ol {
  margin: 0 0 0.75rem;
  padding-left: 1.4rem;
}

.tool-result .table-wrap {
  margin: 0.5rem 0 0.75rem;
}

@media (min-width: 40rem) {
  .planner > #tl-error,
  .planner > .tool-result,
  .planner > .tool-buttons {
    grid-column: 1 / -1;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --surface: #fff;
    --text: #000;
    --text-2: #222;
    --accent: #000;
    --accent-strong: #000;
    --border: #000;
  }

  body {
    background-image: none;
  }

  .site-header,
  .breadcrumb,
  .skip-link,
  .next-step,
  .tool-buttons,
  footer,
  .cookie-actions {
    display: none;
  }

  .planner {
    border: 0;
  }

  .planner input,
  .planner textarea,
  .planner select {
    border-color: currentcolor;
  }

  .tool-printable .field,
  .tool-printable #tl-error {
    display: none;
  }

  .tool-printable .table-wrap {
    overflow: visible;
  }

  .tool-printable table {
    min-width: 0;
  }

  .tool-printable td,
  .tool-printable th {
    padding: 0.6rem 0.5rem;
  }
}

/* ---------- visual layer: page heroes, cards, numbered sections ---------- */

.page-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin: 0.5rem 0 1.75rem;
  padding: 1.75rem 1.5rem 1.5rem;
  border-radius: 1.5rem;
  background: radial-gradient(ellipse at 100% 0%, rgba(229, 72, 77, 0.22), transparent 60%), var(--surface);
  border: 1px solid rgba(107, 122, 143, 0.3);
}

.page-hero h1 {
  margin-top: 0.5rem;
}

.page-hero p:last-child {
  margin-bottom: 0;
}

.page-hero-art {
  float: right;
  width: 3.5rem;
  height: 5.5rem;
  margin: 0 0 0.5rem 1rem;
  filter: drop-shadow(0 0.5rem 1rem rgba(229, 72, 77, 0.45));
}

.hero-icon {
  display: inline-grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 1rem;
  background: rgba(255, 127, 134, 0.14);
  color: var(--accent);
}

.hero-icon .icon {
  width: 2rem;
  height: 2rem;
}

.hub-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.25rem;
  padding: 0.2rem 0.8rem 0.2rem 0.5rem;
  border-radius: 999px;
  background: rgba(255, 127, 134, 0.12);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 650;
  text-decoration: none;
}

.hub-chip .icon {
  width: 1.25rem;
  height: 1.25rem;
}

.topic-hero .byline {
  margin-bottom: 0;
}

.answer {
  padding: 1.1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  background: linear-gradient(90deg, rgba(229, 72, 77, 0.12), var(--surface) 70%);
}

/* numbered section headings */
.guide-body {
  counter-reset: sec;
}

.guide-body > section > h2 {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(107, 122, 143, 0.25);
}

.guide-body > section > h2::before {
  counter-increment: sec;
  content: counter(sec);
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.65rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1rem;
  font-weight: 750;
}

/* hub cards on the guides index */
.prose ul.hub-cards,
.prose ul.topic-cards,
.related ul {
  display: grid;
  gap: 0.85rem;
  padding: 0;
  list-style: none;
}

.hub-cards {
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
}

.prose .hub-cards li,
.prose .topic-cards li {
  margin: 0;
}

.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  padding: 1.15rem;
  border-radius: 1.1rem;
  background: var(--surface);
  border: 1px solid rgba(107, 122, 143, 0.3);
  color: var(--text);
  text-decoration: none;
}

.hub-card:hover {
  color: var(--text);
  border-color: var(--accent);
}

.hub-card .hub-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  margin-bottom: 0.4rem;
  border-radius: 0.8rem;
  background: rgba(255, 127, 134, 0.12);
  color: var(--accent);
}

.hub-card .hub-name {
  font-weight: 750;
  font-size: 1.1rem;
}

.hub-card .hub-desc {
  color: var(--text-2);
  font-size: 0.925rem;
  line-height: 1.45;
}

.hub-card .count {
  margin-top: auto;
  padding-top: 0.4rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 650;
}

/* topic cards (hub lists, start here) */
.topic-card,
.related li {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 2.5rem 0.95rem 1.1rem;
  border-radius: 1rem;
  background: var(--surface);
  border: 1px solid rgba(107, 122, 143, 0.3);
  color: var(--text-2);
  font-size: 0.95rem;
}

.topic-card::after,
.related li::after {
  content: "→";
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-weight: 700;
}

.topic-card a,
.related li a {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.topic-card a::before,
.related li a::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.topic-card:hover,
.related li:hover {
  border-color: var(--accent);
}

/* app call-to-action with the flame */
.next-step {
  position: relative;
  overflow: hidden;
  padding: 1.5rem 1.5rem 1.5rem 6.5rem;
  border-radius: 1.25rem;
  background: radial-gradient(ellipse at 0% 50%, rgba(242, 193, 78, 0.16), transparent 55%), var(--surface);
}

.cta-flame {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  width: 3.5rem;
  height: 5.5rem;
  filter: drop-shadow(0 0.5rem 1rem rgba(229, 72, 77, 0.45));
}

.next-step .store {
  justify-content: flex-start;
}

@media (max-width: 30rem) {
  .next-step {
    padding-left: 1.25rem;
    padding-top: 5.5rem;
  }

  .cta-flame {
    width: 2.5rem;
    height: 3.9rem;
  }
}

/* legal pages and site header: the brand flame comes from styles.css */
.site-header {
  padding-bottom: 0.25rem;
}
