/* Reset, typography, page frame (header, footer) and layout helpers. */
*, *::before, *::after { box-sizing: border-box; }
/* "hidden" must win over display rules such as .stack or .btn. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.03em; font-weight: 700; overflow-wrap: break-word; hyphens: auto; }
h1 { font-size: clamp(32px, 6vw, 56px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 18px; letter-spacing: -0.01em; }
p, ul, ol, dl { margin: 0; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
img { display: block; max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 640px; }
.stack { display: flex; flex-direction: column; gap: var(--gap, 16px); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--gap, 12px); }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.lead { font-size: 18px; color: var(--muted); max-width: 36em; }

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

.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 72px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-height: var(--touch); }
.logo { width: 38px; height: 38px; }
.wordmark { font-size: 21px; font-weight: 700; letter-spacing: -0.03em; }
.wordmark span { color: var(--muted); font-weight: 500; }
/* Wide header: text links in a row, then account (avatar) and logout as round icons. */
.nav { display: flex; align-items: center; gap: 4px; }
.nav-link, .nav-compact > .nav-requests {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--touch); padding: 0 12px;
  border-radius: var(--radius-pill); color: var(--ink-2); font-weight: 600; font-size: 15px; text-decoration: none;
}
.nav-link:hover { background: var(--bg-soft); color: var(--ink); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-ink); }
.nav-sep { width: 1px; height: 24px; margin: 0 8px; background: var(--line); }
.nav-icon {
  display: inline-grid; place-items: center; width: var(--touch); height: var(--touch); padding: 0; border: 0;
  border-radius: 50%; background: none; color: var(--ink-2); cursor: pointer; text-decoration: none;
}
.nav-icon:hover { background: var(--bg-soft); color: var(--ink); }
.nav-icon[aria-current="page"] { box-shadow: 0 0 0 2px var(--accent); }
.nav-icon .avatar { width: 32px; height: 32px; font-size: 14px; }
.nav-logout { display: contents; }
.nav-wide .nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Below 900 px a menu replaces the row of links (details/summary, no JavaScript). */
.nav-compact { display: none; align-items: center; gap: 12px; }
.nav-burger { position: relative; }
.nav-burger summary { list-style: none; width: var(--touch); padding: 0; justify-content: center; cursor: pointer; }
.nav-burger summary::-webkit-details-marker { display: none; }
.nav-burger[open] summary { background: var(--bg-soft); }
.nav-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: min(280px, calc(100vw - 32px));
  display: flex; flex-direction: column; padding: 8px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-strong);
}
.nav-panel a, .nav-panel button {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--touch); padding: 0 12px;
  border: 0; border-radius: var(--radius-xs); background: none; color: var(--ink); font: 600 16px var(--font);
  text-align: left; text-decoration: none; cursor: pointer;
}
.nav-panel a:hover, .nav-panel button:hover { background: var(--bg-soft); }
.nav-panel .btn { box-shadow: none; }
.nav-panel .nav-icon, .nav-panel .nav-link { display: flex; align-items: center; justify-content: flex-start; width: 100%; height: auto; border-radius: var(--radius-xs); }
.nav-panel [aria-current="page"] { background: var(--accent-soft); color: var(--accent-soft-ink); }
.nav-panel .nav-logout { display: block; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
@media (max-width: 900px) {
  .nav-wide { display: none; }
  .nav-compact { display: flex; }
}

.messages { padding-top: 16px; }

.site-footer { background: var(--footer-bg); color: var(--footer-ink); padding: 40px 0; font-size: 14px; margin-top: 64px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-footer a { color: var(--footer-ink); display: inline-flex; align-items: center; min-height: var(--touch); }

@media (max-width: 760px) {
  .site-header .wrap { min-height: 60px; gap: 12px; }
  .logo { width: 32px; height: 32px; }
  .wordmark { font-size: 19px; }
  .wordmark span { display: none; }
}

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.h3 { font-size: 18px; letter-spacing: -0.01em; }
.prewrap { white-space: pre-line; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

/* Very narrow phones: the logo symbol alone keeps the header on one line. */
@media (max-width: 400px) {
  .wordmark { display: none; }
}
