@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url("../assets/fonts/fraunces-latin.woff2") format("woff2");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--paper);
  background-image: radial-gradient(1100px 520px at 12% -8%, var(--brand-soft) 0%, transparent 62%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.012em;
}

p, ul, ol, dl, dd, figure {
  margin: 0;
}

ul, ol {
  padding: 0;
}

img, svg {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--brand);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--brand-dark);
}

button {
  font: inherit;
  color: inherit;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.05em 0.35em;
}

::selection {
  background: var(--brand);
  color: var(--brand-ink);
}

.shell {
  width: min(var(--shell), calc(100% - 48px));
  margin-inline: auto;
}

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 0 0 10px 10px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 650;
  text-decoration: none;
  transition: top 160ms var(--ease);
}

.skip-link:focus {
  top: 0;
  color: var(--paper);
}

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

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

@supports (backdrop-filter: blur(12px)) {
  .site-header {
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: blur(12px);
  }
}

.header-inner {
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  flex: none;
}

.brand:hover {
  color: var(--ink);
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand-tile {
  fill: var(--brand);
}

.brand-lines {
  stroke: var(--brand-ink);
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.24rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 8px 10px;
  border-radius: var(--radius-xs);
  color: var(--ink-2);
  font-size: 0.85rem;
  font-weight: 550;
  text-decoration: none;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.save-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: 4px;
  color: var(--ink-3);
  font-size: 0.74rem;
  white-space: nowrap;
}

.save-state .icon {
  width: 13px;
  height: 13px;
  color: var(--brand);
}

.save-state.is-error {
  color: var(--danger);
}

.save-state.is-error .icon {
  color: var(--danger);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 0.865rem;
  font-weight: 620;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 140ms var(--ease), border-color 140ms var(--ease),
    color 140ms var(--ease), transform 100ms var(--ease);
}

.btn .icon {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.btn-primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: var(--brand-ink);
}

.btn-secondary {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--surface-2);
}

.btn-quiet {
  background: transparent;
  color: var(--ink-2);
}

.btn-quiet:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.btn-danger-solid:hover {
  filter: brightness(0.94);
}

.btn-small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.79rem;
  border-radius: var(--radius-xs);
}

.btn-small .icon {
  width: 14px;
  height: 14px;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.icon-btn-sm {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-xs);
}

.icon-btn-sm .icon {
  width: 15px;
  height: 15px;
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 0.79rem;
  font-weight: 630;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: transparent;
}

.link-btn:hover {
  color: var(--brand-dark);
  text-decoration-color: currentColor;
}

.link-btn .icon {
  width: 14px;
  height: 14px;
}

.text-link {
  color: var(--brand);
  font-size: 0.8rem;
  font-weight: 620;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover {
  text-decoration: underline;
}

/* ---------- Forms ---------- */

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.field > span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.755rem;
  font-weight: 680;
  letter-spacing: 0.015em;
}

.field .optional {
  color: var(--ink-3);
  font-size: 0.69rem;
  font-weight: 450;
}

.field .dot {
  width: 8px;
  height: 8px;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 0.86rem;
  line-height: 1.3;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}

input:hover,
select:hover {
  border-color: var(--ink-3);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

input::placeholder {
  color: var(--ink-3);
  opacity: 0.8;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6557' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 30px;
}

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a89b89' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.field small {
  color: var(--ink-3);
  font-size: 0.7rem;
  line-height: 1.45;
}

.field-help {
  margin-top: 6px;
  color: var(--ink-3);
  font-size: 0.72rem;
  line-height: 1.5;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.field-group {
  margin: 12px 0 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.field-group .field-row:first-child {
  margin-top: 8px;
}

.inline-fields {
  display: flex;
  gap: 6px;
}

.inline-fields select {
  flex: 1;
}

.inline-fields input {
  width: 62px;
  flex: none;
}

.field-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-inline > span {
  white-space: nowrap;
}

.field-inline input {
  width: 64px;
}

.check,
.choice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  cursor: pointer;
}

.check {
  padding: 5px 0;
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.45;
}

.check input {
  margin-top: 2px;
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  flex: none;
}

.choice-group {
  display: grid;
  gap: 4px;
  margin: 0 0 14px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.choice-group legend {
  padding: 0 4px;
  color: var(--ink-2);
  font-size: 0.74rem;
  font-weight: 680;
}

.choice {
  align-items: center;
  padding: 9px 8px;
  border-radius: var(--radius-xs);
  font-size: 0.84rem;
}

.choice:hover {
  background: var(--surface-2);
}

.choice:has(input:checked) {
  background: var(--brand-soft);
}

.choice input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  flex: none;
}

.choice span {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 7px;
}

.choice small {
  display: block;
  flex-basis: 100%;
  color: var(--ink-3);
  font-size: 0.7rem;
  line-height: 1.35;
}

.form-error {
  margin-top: 12px;
  padding: 9px 11px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 550;
}

/* ---------- Shared bits ---------- */

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.dot-a {
  background: var(--a);
}

.dot-b {
  background: var(--b);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--brand);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow .icon {
  width: 14px;
  height: 14px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.7rem;
  font-weight: 620;
  white-space: nowrap;
}

.pill-muted {
  background: transparent;
  color: var(--ink-3);
}

.fineprint {
  color: var(--ink-3);
  font-size: 0.695rem;
  line-height: 1.55;
}

.hide-sm {
  display: inline;
}

.show-sm {
  display: none;
}

/* ---------- Dialogs ---------- */

.dialog {
  width: min(560px, calc(100% - 28px));
  max-height: min(88vh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
  overflow: auto;
}

.dialog-sm {
  width: min(440px, calc(100% - 28px));
}

.dialog::backdrop {
  background: rgba(18, 24, 19, 0.48);
  backdrop-filter: blur(3px);
}

.dialog[open] {
  animation: dialog-in 180ms var(--ease);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dialog-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}

.dialog-head .eyebrow {
  margin-bottom: 5px;
}

.dialog-head h2 {
  font-size: 1.42rem;
}

.dialog-body {
  padding: 16px 22px 8px;
}

.dialog-body > .field + .field,
.dialog-body > .field + .field-row {
  margin-top: 12px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line);
  margin-top: 12px;
}

.dialog-actions-wrap {
  row-gap: 6px;
}

.spacer {
  flex: 1;
}

.dialog-lede {
  margin-bottom: 12px;
  color: var(--ink-2);
  font-size: 0.86rem;
  line-height: 1.55;
}

.dialog-status {
  margin-bottom: 12px;
  padding: 9px 11px;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 0.79rem;
}

.copy-row {
  display: flex;
  gap: 7px;
  align-items: stretch;
}

.copy-row input {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  min-width: 0;
}

.copy-row .btn {
  flex: none;
}

.callout {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 14px;
  padding: 9px 11px;
  border-radius: var(--radius-xs);
  background: var(--brand-soft);
  color: var(--ink-2);
  font-size: 0.75rem;
  line-height: 1.5;
}

.callout .icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--brand);
}

/* ---------- Toast ---------- */

.toast-region {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(460px, calc(100% - 32px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  line-height: 1.4;
  pointer-events: auto;
  animation: toast-in 180ms var(--ease);
}

.toast .toast-action {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--gold-soft);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  white-space: nowrap;
}

[data-theme="dark"] .toast .toast-action {
  color: #f0c67c;
}

.toast-leave {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 180ms var(--ease), transform 180ms var(--ease);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 20px;
  background: var(--footer-bg);
  color: var(--footer-ink);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr;
  gap: 36px;
  padding-block: 40px 30px;
}

.footer-grid h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--footer-ink);
}

.footer-grid p {
  color: var(--footer-muted);
  font-size: 0.79rem;
  line-height: 1.6;
}

.footer-grid p + p {
  margin-top: 8px;
}

.footer-small {
  font-size: 0.71rem !important;
  opacity: 0.8;
}

.footer-brand .brand {
  color: var(--footer-ink);
  margin-bottom: 10px;
}

.footer-brand .brand-text {
  font-size: 1.35rem;
}

.footer-brand .brand-lines {
  stroke: var(--brand-ink);
}

.footer-grid .privacy-details {
  margin-top: 8px;
}

.footer-grid details summary {
  color: var(--footer-ink);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-underline-offset: 3px;
}

.footer-grid details p {
  margin-top: 8px;
}

.footer-grid a {
  color: var(--footer-ink);
}

.link-on-dark {
  color: var(--footer-ink);
  font-size: 0.75rem;
  text-decoration: underline;
  text-decoration-color: var(--footer-line);
}

.link-on-dark:hover {
  color: #fff;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 14px 22px;
  border-top: 1px solid var(--footer-line);
  color: var(--footer-muted);
  font-size: 0.72rem;
}

.footer-bottom p {
  margin: 0;
}

.footer-bottom a {
  color: var(--footer-muted);
  text-decoration: none;
}

.footer-bottom a:hover {
  color: var(--footer-ink);
  text-decoration: underline;
}

.noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 200;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  border: 1px solid var(--danger);
  color: var(--danger);
  font-size: 0.85rem;
}

@media (max-width: 1080px) {
  .save-state {
    display: none;
  }
}

@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 28px;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .shell {
    width: calc(100% - 32px);
  }

  .header-inner {
    min-height: 60px;
    gap: 8px;
  }

  .brand-text {
    font-size: 1.12rem;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .hide-sm {
    display: none !important;
  }

  .show-sm {
    display: inline;
  }

  .btn {
    min-height: 38px;
    padding: 0 12px;
  }

  .btn-icon-mobile {
    gap: 6px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-block: 30px 22px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 6px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .dialog {
    width: 100%;
    max-height: 92vh;
    margin: auto 0 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .dialog[open] {
    animation: dialog-up 220ms var(--ease);
  }

  @keyframes dialog-up {
    from {
      transform: translateY(24px);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

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