/* Shared shell for the plain-HTML pages (app page, FAQ, bug pages, 404). Needs the design-system styles.css first.
   The home page is a design-tool export and carries its own copy of the header rules. Keep the two looking the same. */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text-body); margin: 0; font-family: var(--font-sans); line-height: 1.55; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.uc { background: #fff3cd; color: #3b2f00; text-align: center; padding: 10px 16px; font-size: 14px; line-height: 1.4; border-bottom: 1px solid #e0c36a; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; margin: 0 auto; padding: 0 24px 72px; }

/* Header */
header.site { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--border-subtle); }
header.site .bar { display: flex; align-items: center; gap: 18px; padding: 12px 24px; max-width: 1120px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand .word { font-family: var(--font-logo); font-weight: 700; font-size: 20px; letter-spacing: -0.02em; color: var(--ink-0); }
.brand .word .muted { color: var(--ink-3); }
nav.top { margin-left: auto; display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
nav.top > a, nav.top .nav-apps > a { font-size: 14px; font-weight: 500; color: var(--text-secondary); padding: 8px 12px; border-radius: var(--r-md); text-decoration: none; transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out); }
nav.top > a:hover, nav.top .nav-apps > a:hover, nav.top a[aria-current="page"] { background: var(--surface-raised); color: var(--ink-0); text-decoration: none; }
.nav-apps { position: relative; display: inline-flex; align-items: center; }
.nav-apps-menu { display: none; position: absolute; top: 100%; left: 0; z-index: 60; min-width: 220px; margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-3); padding: 6px; }
.nav-apps-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 8px; } /* hover bridge over the gap */
.nav-apps:hover > .nav-apps-menu, .nav-apps:focus-within > .nav-apps-menu { display: block; }
.nav-apps-menu a { display: block; font-size: 14px; color: var(--text-secondary); padding: 8px 10px; border-radius: var(--r-sm); text-decoration: none; }
.nav-apps-menu a:hover { background: var(--surface-raised); color: var(--ink-0); text-decoration: none; }
.toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--border); background: var(--surface); color: var(--text-body); border-radius: var(--r-md); cursor: pointer; flex-shrink: 0; }
.toggle:hover { background: var(--surface-raised); }
.toggle .moon { display: none; } .toggle .sun { display: block; }
[data-theme="dark"] .toggle .moon { display: block; } [data-theme="dark"] .toggle .sun { display: none; }

/* Second row: pages of one app */
.subnav { border-bottom: 1px solid var(--border-subtle); background: var(--surface-raised); }
.subnav .in { max-width: 1120px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.subnav .app { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-right: 10px; padding: 10px 0; }
.subnav a { font-size: 14px; font-weight: 500; color: var(--text-secondary); padding: 10px 12px; text-decoration: none; border-bottom: 2px solid transparent; }
.subnav a:hover { color: var(--ink-0); }
.subnav a[aria-current="page"] { color: var(--ink-0); border-bottom-color: var(--accent); }

/* Page heading */
.kicker { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin: 48px 0 14px; }
h1.page { font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 4.6vw, 46px); line-height: 1.06; letter-spacing: -0.02em; color: var(--ink-0); margin: 0; }
.lead { font-size: 17px; line-height: 1.6; color: var(--text-secondary); margin: 16px 0 28px; max-width: 60ch; }

/* Cards, notices, buttons */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px; box-shadow: var(--shadow-1); }
.notice { display: flex; gap: 11px; background: var(--paper-1); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-md); padding: 14px 16px; margin: 0 0 20px; font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.notice strong { color: var(--ink-0); }
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 12px 22px; border-radius: var(--r-md); border: 0; background: var(--accent); color: #fff; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; filter: brightness(1.06); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent-text); border: 1px solid var(--border); }
.btn.ghost:hover { background: var(--surface-raised); color: var(--ink-0); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* Form */
.field { display: flex; flex-direction: column; gap: 8px; margin: 0 0 20px; border: 0; padding: 0; min-width: 0; }
.field > .lab, .field > legend.lab { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-secondary); padding: 0; }
.hint { color: var(--text-secondary); font-size: 14px; margin: 0; }
.msg { font-size: 14px; margin: 0; min-height: 1.4em; }
.sel { position: relative; display: block; }
.sel select, .field input[type=text] { width: 100%; font: inherit; font-size: 15px; color: var(--text-strong, var(--text-body)); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 40px 11px 14px; }
.sel select { appearance: none; -webkit-appearance: none; cursor: pointer; }
.field input[type=text] { padding-right: 14px; font-family: var(--font-mono); letter-spacing: 0.06em; }
.sel::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); pointer-events: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }

/* Multi-select dropdown: a details element holding checkboxes. Works without JavaScript. */
details.dd { position: relative; }
details.dd > summary { list-style: none; cursor: pointer; font-size: 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 40px 11px 14px; color: var(--text-body); position: relative; min-height: 44px; }
details.dd > summary::-webkit-details-marker { display: none; }
details.dd > summary::after { content: ""; position: absolute; right: 16px; top: 50%; width: 8px; height: 8px; margin-top: -6px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted); transform: rotate(45deg); }
details.dd[open] > summary::after { margin-top: -2px; transform: rotate(-135deg); }
details.dd .none { color: var(--text-muted); }
details.dd .dd-list { margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 6px; max-height: 320px; overflow: auto; }
details.dd .dd-list label { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer; font-size: 15px; }
details.dd .dd-list label:hover { background: var(--surface-raised); }
details.dd input[type=checkbox] { width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.multi-hint { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Email preview */
.preview { margin: 28px 0 0; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--paper-1); overflow: hidden; }
.preview .bar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.preview .meta { padding: 12px 18px; border-bottom: 1px solid var(--border-subtle); font-size: 14px; line-height: 1.7; }
.preview .meta span { color: var(--text-muted); display: inline-block; min-width: 4.5em; }
.preview pre { margin: 0; padding: 16px 18px; font-family: var(--font-mono); font-size: 13px; line-height: 1.8; color: var(--ink-1); white-space: pre-wrap; overflow-wrap: anywhere; }

/* FAQ */
details.qa { border: 1px solid var(--border-subtle); border-radius: 12px; margin: 0 0 12px; padding: 4px 16px; background: var(--surface); }
details.qa summary { font-weight: 600; color: var(--ink-0); cursor: pointer; padding: 10px 0; min-height: 24px; }
details.qa p { margin: 0 0 12px; }

/* Footer */
footer.site { background: var(--surface-raised); border-top: 1px solid var(--border-subtle); margin-top: clamp(48px, 7vw, 80px); }
footer.site .inner { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; justify-content: space-between; padding: clamp(32px, 5vw, 48px) 24px; max-width: 1120px; margin: 0 auto; }
footer.site .note { font-size: 14px; color: var(--text-muted); max-width: 52ch; line-height: 1.6; margin: 14px 0 0; }
footer.site nav { display: flex; gap: 20px; flex-wrap: wrap; }
footer.site nav a { font-size: 14px; color: var(--text-secondary); }
