/* The theme every Daring page shares: the Daring ivory, cyan and red on a dark ground,
   set in Monaspace Krypton (SIL Open Font License, served as a Latin subset).
   Each surface adds its own stylesheet after this one. */
@font-face {
  font-family: 'Monaspace Krypton';
  src: url('fonts/monaspace-krypton.woff2') format('woff2');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #0B0C0B;
  --fg: #FAF6EB;
  --muted: #A3A29B;
  --placeholder: #8D8C85;
  --border: rgba(91, 90, 85, 0.55);
  --input: #6F6E68;
  --accent: #C6F2F5;
  --accent-soft: rgba(198, 242, 245, 0.12);
  --accent-hover: rgba(198, 242, 245, 0.28);
  --card: rgba(250, 246, 235, 0.03);
  --hover: rgba(250, 246, 235, 0.08);
  --dot: #E42C15;
  --field: #1A1B19;
  --label: #D6D2C6;
  --radius: 4px;
  --row: 36px;
  --page: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Monaspace Krypton', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  overflow-x: hidden;
}

h1, h2 { font-family: inherit; font-size: inherit; font-weight: 400; line-height: 1.4; margin: 0; }
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent); text-decoration: underline dotted rgba(198, 242, 245, 0.45); text-underline-offset: 4px; }
a:hover { text-decoration-style: solid; text-decoration-color: var(--accent); }
code { font-size: 0.9em; background: var(--accent-soft); color: var(--accent); padding: 0.05em 0.35em; border-radius: var(--radius); overflow-wrap: anywhere; }
strong { font-weight: 400; color: var(--fg); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Headings take focus only so screen readers land on each new step; they are not controls. */
h1:focus, h2:focus { outline: none; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted, .hint, .optional, .fine { color: var(--muted); }
.hint, .fine { font-size: 0.8125rem; line-height: 1.6; }
.hint { margin: 0 0 8px; }
.fine { margin-top: 24px; }
.eyebrow { font-size: 0.75rem; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.lede { font-size: 0.9375rem; line-height: 1.6; color: var(--muted); }

.demo-banner, .announcement-banner { background: var(--accent); color: var(--bg); padding: 0.625rem 16px; font-size: 0.8125rem; text-align: center; }
.demo-banner strong, .announcement-banner strong { color: var(--bg); }

/* header and footer */
.gbar { min-height: 72px; padding: 0 max(32px, calc((100% - var(--page)) / 2)); display: flex; align-items: center; gap: 16px; }
.gbar-mark { display: block; width: 72px; height: auto; flex: none; }
.gbar-rule, .gfoot-rule { width: 1px; height: 20px; background: var(--input); flex: none; }
.gbar-who { flex: 1 1 auto; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.gbar-who h1 { font-size: 0.8125rem; text-transform: lowercase; }
.gbar-meta { font-size: 0.8125rem; color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.gbar-topic { color: var(--fg); }
.gbar-meta .btn-text { min-height: 0; padding: 0; margin-left: 8px; font-size: inherit; }
.gbar-controls { flex: none; }
.gbar-controls:empty { display: none; }

.gfoot { min-height: 72px; padding: 8px max(32px, calc((100% - var(--page)) / 2)); display: flex; align-items: center; flex-wrap: wrap; gap: 0 16px; }
.gfoot-tag { display: flex; align-items: center; gap: 8px; font-size: 0.8125rem; }
.gdot { width: 6px; height: 6px; background: var(--dot); flex: none; }
.glink {
  min-height: 44px; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 0.8125rem; color: var(--accent); cursor: pointer; white-space: nowrap;
}
.glink span { text-decoration: underline dotted rgba(198, 242, 245, 0.45); text-underline-offset: 5px; }
.glink:hover span { text-decoration-style: solid; text-decoration-color: var(--accent); }

/* page frames */
main { padding: clamp(1.5rem, 5vw, 4rem) 16px 4rem; margin: 0 auto; width: 100%; flex: 1 0 auto; }
.narrow { max-width: 34rem; }
.center-page { display: flex; flex-direction: column; padding-top: clamp(2rem, 10vh, 6rem); }
.center-page .panel > p:not(.eyebrow, .actions, .fine) { color: var(--muted); font-size: 0.9375rem; line-height: 1.6; }
.settings { max-width: 44rem; }
.page-head { margin-bottom: 24px; }
.page-head h1, .panel h1 { font-size: 1.5rem; line-height: 1.2; margin-bottom: 12px; }

.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(1.25rem, 4vw, 2rem); }
.panel > * + * { margin-top: 16px; }
.panel > h1 + *, .panel > h2 + * { margin-top: 0; }
.panel h2 { font-size: 1rem; margin-bottom: 12px; }
.panel > .copy-status:empty { min-height: 0; margin-top: 0; }
.panel + .panel, .notice + .panel { margin-top: 24px; }
.stack > * + * { margin-top: 16px; }
.stack-lg > * + * { margin-top: 32px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 24px; }
.actions.split { justify-content: space-between; flex-direction: row-reverse; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--radius);
  font: inherit; font-size: 0.8125rem; font-weight: 600; line-height: 1.2; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.btn-primary { background: var(--fg); color: var(--bg); }
.btn-primary:hover { background: #FFFFFF; }
.btn-secondary { background: transparent; color: var(--fg); border-color: rgba(250, 246, 235, 0.3); font-weight: 400; }
.btn-secondary:hover { background: var(--hover); border-color: rgba(250, 246, 235, 0.5); }
.btn-accent { background: var(--accent-soft); color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); }
.btn[disabled] { opacity: 0.7; cursor: progress; }
.btn-text {
  background: none; border: 0; min-height: 44px; padding: 0 4px; font: inherit; font-size: 0.8125rem; color: var(--accent); cursor: pointer;
  text-decoration: underline dotted rgba(198, 242, 245, 0.45); text-underline-offset: 4px;
}
.btn-text:hover { text-decoration-style: solid; text-decoration-color: var(--accent); }
.btn-text[disabled] { cursor: progress; }
.btn-danger { color: var(--fg); text-decoration-color: var(--dot); }
.btn-danger:hover { text-decoration-color: var(--dot); }
.gicon {
  width: 44px; height: 44px; border: 0; border-radius: var(--radius); background: transparent;
  color: var(--fg); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.gicon:hover:not([disabled]) { background: var(--hover); }
.gicon[disabled] { color: var(--input); cursor: default; }
.spinner {
  width: 1em; height: 1em; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

/* notices */
.notice { margin: 0; padding: 12px 16px; border: 1px solid var(--input); border-radius: var(--radius); background: var(--card); color: var(--fg); font-size: 0.8125rem; line-height: 1.6; }
.notice p + p { margin-top: 8px; }
.notice:focus { outline: none; }
.notice:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notice-error { border-color: var(--fg); }
.notice-success, .notice-attention { border-color: var(--accent); }
.settings > .notice { margin: 0 0 24px; }

/* forms */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-size: 0.9375rem; font-weight: 600; padding: 0; margin-bottom: 16px; }
.field + .field { margin-top: 16px; }
label { display: block; font-size: 0.8125rem; line-height: 1.4; margin: 0 0 8px; }
input[type='text'], input[type='email'], input[type='url'], input[type='number'], input[type='time'], select, textarea {
  width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 1rem; color: var(--fg);
  background-color: var(--card); border: 1px solid var(--input); border-radius: var(--radius);
}
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input[readonly], textarea[readonly] { background: var(--hover); color: var(--muted); }
textarea { resize: vertical; min-height: 5.5rem; }
select { appearance: none; padding-right: 2.5rem; background-image: url('chevron-light.svg'); background-repeat: no-repeat; background-position: right 0.875rem center; background-size: 12px; }
select option { background: var(--bg); color: var(--fg); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); }
:is(input, select, textarea)[aria-invalid='true'] { border-color: var(--dot); border-width: 2px; }
.field-error { color: var(--fg); font-size: 0.8125rem; margin-top: 6px; display: flex; gap: 8px; align-items: baseline; }
.field-error::before { content: ''; width: 6px; height: 6px; background: var(--dot); flex: none; }
input.short { max-width: 8rem; }
/* Checkboxes grow with enlarged text and never drop below 22px. */
input[type='checkbox'] { font-size: inherit; width: max(22px, 1.375em); height: max(22px, 1.375em); margin: 0; accent-color: var(--accent); flex: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 999px) {
  .gbar { padding: 10px 16px; gap: 12px; min-height: 56px; border-bottom: 1px solid var(--border); }
  .gbar-mark { width: 64px; }
  .gfoot { padding: 8px 16px; border-top: 1px solid var(--border); flex-direction: column; align-items: flex-start; }
  .gfoot-rule { display: none; }
}

@media (max-width: 600px) {
  .actions.split { flex-direction: column-reverse; align-items: stretch; }
  .actions .btn { width: 100%; }
}

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
}
