/* authored. archive base styles. Sans only; the only italic is the wordmark full stop (.dot). */
*, *::before, *::after { box-sizing: border-box; }
em, i, cite, dfn, address, var { font-style: normal; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-weight: 500; letter-spacing: -0.01em; margin: 0 0 0.5em; line-height: 1.2; }
h1 { font-size: clamp(26px, 3.2vw, 36px); }
h2 { font-size: 21px; }
h3 { font-size: 16px; }
p { margin: 0 0 1em; }
.mono, code, kbd { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* Wordmark: typed in Geist; the full stop is the brand mark and the one italic. */
.wordmark { font: 500 18px/1 var(--sans); letter-spacing: -0.02em; text-decoration: none; color: inherit; white-space: nowrap; }
.wordmark .dot { font-style: italic; }
.wordmark .product { font-weight: 400; color: var(--muted); margin-left: 6px; }

/* Layout. Row 1, the band: wordmark, project, doors, search, Send a note, initials (sticky on a laptop).
   Row 2: the door's sections. Row 3: the current section's pages, nested underneath. The phone has a tab bar. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 20px;
  height: 56px; padding: 0 var(--gutter);
  background: var(--accent); color: var(--accent-ink);
}
.topbar[hidden] { display: none; }
.topbar .wordmark .product { color: inherit; opacity: 0.65; }
.topbar .doors { display: flex; align-items: center; gap: 2px; font-size: 14px; padding-left: 18px; border-left: 1px solid color-mix(in srgb, currentColor 22%, transparent); height: 24px; white-space: nowrap; min-width: 0; }
.topbar .doors:empty { display: none; }
.topbar .door-project { opacity: 0.65; margin-right: 10px; font: inherit; color: inherit; background: none; border: 0; padding: 0; }
.topbar .door-project.is-switch { cursor: pointer; opacity: 0.9; }
.topbar .door-project.is-switch:hover { opacity: 1; }
.door-tabs { display: flex; align-items: stretch; height: 56px; }
.door-tab { display: flex; align-items: center; padding: 0 10px; text-decoration: none; opacity: 0.7; border-bottom: 2px solid transparent; border-top: 2px solid transparent; }
.door-tab:hover { opacity: 1; }
.door-tab.is-second { font-size: 13px; }
.door-tab[aria-current] { opacity: 1; font-weight: 500; border-bottom-color: currentColor; }
.topbar .who { margin-left: auto; font-size: 13px; display: flex; gap: 12px; align-items: center; }
.topbar .who button { color: inherit; border-color: color-mix(in srgb, currentColor 35%, transparent); background: transparent; }
.topbar .who button.me { width: 32px; height: 32px; padding: 0; justify-content: center; align-items: center; flex: none; border-radius: 50%; font: 500 11px/1 var(--mono); letter-spacing: 0.02em; }
.topbar .who button.me[aria-expanded="true"] { background: color-mix(in srgb, currentColor 14%, transparent); }

/* Menus under a button (project switch, initials) */
.nav-pop { position: relative; }
.nav-menu { position: absolute; top: calc(100% + 10px); left: 0; z-index: 60; min-width: 220px; padding: 6px 0; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px color-mix(in srgb, var(--encre-bleue) 14%, transparent); font-size: 14px; }
.nav-menu.is-right { left: auto; right: 0; }
.nav-menu a, .nav-menu button { display: block; width: 100%; text-align: left; padding: 8px 16px; text-decoration: none; font: inherit; color: inherit; background: none; border: 0; border-radius: 0; cursor: pointer; }
.nav-menu a:hover, .nav-menu button:hover, .nav-menu a:focus-visible, .nav-menu button:focus-visible { background: var(--accent-soft); outline: none; }
.nav-menu a[aria-current] { font-weight: 500; }
.nav-menu hr { margin: 6px 0; }
.nav-menu-head { padding: 8px 16px 10px; display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.nav-menu-head .muted { font-size: 12px; }
.nav-menu-label { font: 500 10.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 10px 16px 4px; }

/* Rows 2 and 3 */
.subnav { background: var(--bg); border-bottom: 1px solid var(--line); padding: 0 calc(var(--gutter) - 10px); }
.subnav[hidden] { display: none; }
.nav-sections, .nav-pages { display: flex; align-items: stretch; gap: 2px; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-sections { height: 44px; border-bottom: 1px solid var(--line); font-size: 14px; }
.nav-pages { height: 38px; font-size: 13px; }
.nav-sections a, .nav-pages a { display: flex; align-items: center; gap: 6px; padding: 0 10px; text-decoration: none; color: var(--muted); }
.nav-sections a { border-bottom: 2px solid transparent; margin-bottom: -1px; }
.nav-sections a:hover, .nav-pages a:hover { color: var(--ink); }
.nav-sections a[aria-current] { color: var(--ink); font-weight: 500; border-bottom-color: currentColor; }
.nav-pages a[aria-current] { color: var(--ink); font-weight: 500; }
.nav-count { display: inline-block; min-width: 18px; padding: 1px 5px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 10.5px; font-weight: 500; line-height: 1.4; text-align: center; }

/* Phone tab bar and More sheet */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(var(--tabs, 5), 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line); }
.tabbar[hidden] { display: none; }
.tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 4px 0; min-height: 48px; justify-content: center; font: 500 10.5px/1.2 var(--sans); color: var(--muted); text-decoration: none; background: none; border: 0; border-radius: 0; }
.tabbar [aria-current] { color: var(--ink); }
.tab-icon { display: block; line-height: 0; }
body.has-tabbar { --tabbar-h: calc(61px + env(safe-area-inset-bottom)); }
body.has-tabbar .footer { padding-bottom: calc(20px + var(--tabbar-h)); }
.nav-sheet-back { position: fixed; inset: 0; z-index: 95; background: rgba(20, 24, 43, 0.45); display: flex; align-items: flex-end; }
.nav-sheet { width: 100%; max-height: 80vh; overflow: auto; background: var(--bg); color: var(--ink); border-radius: 14px 14px 0 0; padding: 8px 0 calc(16px + env(safe-area-inset-bottom)); }
.nav-sheet-grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 2px auto 6px; }
.nav-sheet .nav-menu-label { padding: 12px 20px 4px; }
.nav-sheet a, .nav-sheet button { display: block; width: 100%; text-align: left; padding: 11px 20px 11px 32px; font: 400 15px/1.3 var(--sans); color: inherit; text-decoration: none; background: none; border: 0; border-radius: 0; }
.nav-sheet a[aria-current] { font-weight: 500; }
.nav-sheet .nav-count { margin-left: 8px; }

.collection-pick { font-size: 13px; background: transparent; color: inherit; border: 1px solid rgba(255,255,255,0.3); padding: 4px 8px; border-radius: var(--radius); }
.collection-pick option { color: #2A2620; }
main#view { padding: 28px var(--gutter) 64px; min-height: calc(100vh - 120px); }
.footer { padding: 20px var(--gutter); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 12px; }

/* Controls */
button, .btn {
  font: 500 14px/1 var(--sans);
  padding: 10px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px;
  transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}
button:hover, .btn:hover { border-color: var(--ink-40); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary, button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover, button.primary:hover { opacity: 0.92; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--accent-soft); }
button.danger { color: var(--danger); border-color: var(--danger-soft); }
button.big { padding: 16px 22px; font-size: 16px; width: 100%; justify-content: center; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; }

input, select, textarea {
  font: 400 15px/1.4 var(--sans); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent-line); outline: none; }
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.spacer { flex: 1; }

/* Chips and badges */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; line-height: 1; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--bg);
}
.chip.suggested { border-style: dashed; border-color: var(--accent-line); background: var(--accent-soft); }
.chip.accepted { border-color: var(--accent-line); }
.chip button { padding: 0 2px; border: 0; background: none; font-size: 13px; color: var(--muted); }
.badge { font: 500 11px/1 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; padding: 4px 6px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-60); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.accent { background: var(--accent-soft); color: var(--ink); }

/* Surfaces */
.card { border: 1px solid var(--line); background: var(--bg); border-radius: var(--radius); padding: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }

/* Toasts and modal */
.toasts { position: fixed; bottom: calc(16px + var(--tabbar-h, 0px)); left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); }
.toast { background: var(--encre); color: var(--white); padding: 12px 16px; border-radius: var(--radius); font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,0.18); }
.toast.error { background: var(--danger); }
.modal-back { position: fixed; inset: 0; background: rgba(20, 24, 43, 0.55); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--bg); color: var(--ink); max-width: 640px; width: 100%; max-height: 90vh; overflow: auto; border-radius: var(--radius); padding: 24px; }

.spinner { width: 16px; height: 16px; border: 2px solid var(--line); border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) and (min-width: 721px) {
  .topbar .topsearch input { width: 150px; }
  .topbar .door-project:not(.is-switch) { display: none; }
}
@media (max-width: 720px) {
  /* The band scrolls away on the phone; the tab bar stays. Doors become a two-way switch under the wordmark. */
  .topbar { position: static; height: auto; flex-wrap: wrap; gap: 10px 12px; padding: 10px 16px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
  .topbar .wordmark { flex: 1; }
  .topbar .who { order: 2; }
  .topbar .doors { order: 3; flex: 1 1 100%; border-left: 0; padding-left: 0; height: auto; }
  .door-tabs { flex: 1; height: auto; border: 1px solid color-mix(in srgb, currentColor 30%, transparent); border-radius: var(--radius); }
  .door-tab, .door-tab.is-second { flex: 1; justify-content: center; padding: 7px 4px; font-size: 13px; border: 0; }
  .door-tab[aria-current] { background: color-mix(in srgb, currentColor 14%, transparent); }
  main#view { padding: 20px 16px calc(32px + var(--tabbar-h, 0px)); }
}
