/* Lesson 04: shared styles of a level-1 site of several pages (one CSS for every page). */

:root {
  --bg: #F2F3F5;
  --surface: #FFFFFF;
  --fg: #1A1D23;
  --muted: #5B6170;
  --accent: #E8622A;      /* the one accent: the main action */
  --on-accent: #1A1D23;   /* 6.0:1 on the accent */
  --line: #D5D8DE;
  --font: "Archivo", system-ui, sans-serif;
}

/* Transitions between pages: a short cross-fade, the header stays in place. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); line-height: 1.6; }
a { color: inherit; }
a:focus-visible, button:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--fg); outline-offset: 3px; }
.wrap { max-width: 64rem; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }

/* Header and footer: identical in every page. */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 1rem; padding-block: 0.75rem; flex-wrap: wrap; }
.brand { font-weight: 800; font-stretch: 112.5%; text-decoration: none; margin-right: auto; }
.amp { font-stretch: 100%; }
.site-nav ul { display: flex; gap: 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-nav a { text-decoration: none; padding-block: 0.25rem; }
.site-nav a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); }
.cta { display: inline-block; background: var(--accent); color: var(--on-accent); font-weight: 600;
       padding: 0.7rem 1.25rem; border-radius: 999px; text-decoration: none; border: 0; font: inherit; cursor: pointer; }
.site-footer { margin-top: 4rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem; }
.site-footer .wrap { padding-block: 1.5rem; }

main { padding-block: 3rem; }
h1 { font-stretch: 125%; font-weight: 800; line-height: 1.05; font-size: clamp(2rem, 6vw, 3.75rem); margin: 0 0 1rem; max-width: 18ch; }
h2 { font-size: clamp(1.25rem, 3vw, 1.75rem); margin: 2.5rem 0 1rem; }
.lead { color: var(--muted); max-width: 38rem; font-size: 1.125rem; }
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); margin-top: 2rem; }
.card { background: var(--surface); border-radius: 16px; padding: 1.5rem; }
.card h2 { margin-top: 0; }
.note { color: var(--muted); font-size: 0.875rem; }

/* Tabs (W3C pattern). The selected tab is underlined in the accent. */
[role="tablist"] { display: flex; gap: 0.5rem; border-bottom: 1px solid var(--line); }
[role="tab"] { font: inherit; background: none; border: 0; padding: 0.75rem 1rem; cursor: pointer; color: var(--muted); }
[role="tab"][aria-selected="true"] { color: var(--fg); font-weight: 700; box-shadow: inset 0 -3px 0 var(--accent); }
[role="tabpanel"] { padding-block: 1.5rem; }
table { border-collapse: collapse; width: 100%; background: var(--surface); border-radius: 12px; overflow: hidden; }
th, td { text-align: left; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }

/* Accordion: a button inside each heading; the mark turns when open. */
.faq h3 { margin: 0; border-bottom: 1px solid var(--line); }
.faq h3 button { font: inherit; font-weight: 600; width: 100%; text-align: left; background: none; border: 0;
                 padding: 1rem 0; cursor: pointer; display: flex; justify-content: space-between; gap: 1rem; color: inherit; }
.faq h3 button::after { content: "+"; font-weight: 400; transition: transform 0.2s; }
.faq h3 button[aria-expanded="true"]::after { transform: rotate(45deg); }
.faq h3 + div { padding: 0.5rem 0 1rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .faq h3 button::after { transition: none; } }

/* Dialog: native <dialog>, the browser handles focus, Escape and the inert page. */
dialog { border: 0; border-radius: 16px; padding: 1.5rem; max-width: min(32rem, 90vw); background: var(--surface); color: var(--fg); }
dialog::backdrop { background: rgb(26 29 35 / 0.55); }
dialog h2 { margin-top: 0; }
.link-button { font: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: inherit; }
