/* Mobile-first starter styles. Base rules target phones; min-width queries add layout for larger screens. */
:root {
  --bg: #ffffff; --surface: #f5f6f8; --text: #15181d; --muted: #5b6370;
  --border: #dde1e6; --accent: #2457d6; --accent-text: #ffffff;
  --radius: 12px; --gap: clamp(12px, 3vw, 24px);
  --tap: 44px; /* minimum touch target */
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* fluid type: 16px on phones up to 18px on desktops */
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.5;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --surface: #1b1f25; --text: #e8eaed; --muted: #a0a7b1;
          --border: #2c323a; --accent: #6f98ff; --accent-text: #0b1020; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  display: flex; flex-direction: column;
  /* keep content clear of notches and home indicators */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
img, video, svg { max-width: 100%; height: auto; }
h1 { font-size: clamp(1.75rem, 1.3rem + 2vw, 2.75rem); line-height: 1.15; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }

.container { width: 100%; max-width: 1100px; margin-inline: auto; padding-inline: 16px; }
main { flex: 1; padding-block: var(--gap); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 16px; top: 16px; background: var(--surface); padding: 8px 12px; z-index: 10; }

/* Top bar: menu button on phones, inline links on wider screens */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px; padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; margin-right: auto; min-height: var(--tap); display: flex; align-items: center; }
.menu-toggle, .btn {
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius); font: inherit; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.nav { display: none; width: 100%; flex-direction: column; }
.nav.open { display: flex; }
.nav a { min-height: var(--tap); display: flex; align-items: center; padding: 0 8px; color: var(--text); text-decoration: none; border-radius: 8px; }
.nav a[aria-current="page"] { font-weight: 600; color: var(--accent); }

.lead { color: var(--muted); max-width: 60ch; }
.grid { display: grid; grid-template-columns: 1fr; gap: var(--gap); margin-block: var(--gap); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card p { color: var(--muted); margin: 0; }

.form { display: grid; gap: 8px; max-width: 520px; }
.form label { font-weight: 600; margin-top: 8px; }
/* 16px+ inputs stop iOS from zooming in on focus */
.form input { font: inherit; font-size: max(16px, 1rem); min-height: var(--tap); padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); width: 100%; }
.btn { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; margin-top: 12px; }
.status { color: var(--muted); min-height: 1.5em; margin: 0; }
.footer { color: var(--muted); padding-block: 16px; border-top: 1px solid var(--border); }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Hover effects only on devices that actually hover (mouse), not on touch screens */
@media (hover: hover) and (pointer: fine) {
  .nav a:hover { background: var(--surface); }
  .btn:hover { filter: brightness(1.08); }
}

/* Tablet and up */
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
/* Desktop and up */
@media (min-width: 960px) {
  .menu-toggle { display: none; }
  .nav { display: flex; width: auto; flex-direction: row; gap: 4px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
