/* style.css — True North Book Evaluation Form */

:root,
[data-theme='light'] {
  /* Type Scale */
  --text-xs: clamp(0.75rem, 0.7rem + 0.25vw, 0.875rem);
  --text-sm: clamp(0.875rem, 0.8rem + 0.35vw, 1rem);
  --text-base: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --text-lg: clamp(1.125rem, 1rem + 0.75vw, 1.5rem);
  --text-xl: clamp(1.5rem, 1.2rem + 1.25vw, 2.25rem);
  --text-2xl: clamp(2rem, 1.2rem + 2.5vw, 3.25rem);

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Color — warm parchment + deep navy + brass accent */
  --color-bg: #f6f1e7;
  --color-surface: #faf6ee;
  --color-surface-2: #fdfaf3;
  --color-surface-offset: #efe8da;
  --color-surface-dynamic: #e3dac8;
  --color-divider: #ddd3c0;
  --color-border: #cfc4ad;
  --color-text: #2b2620;
  --color-text-muted: #6b6253;
  --color-text-faint: #a89e89;
  --color-text-inverse: #f9f4ea;
  --color-primary: #142846;
  --color-primary-hover: #16213a;
  --color-primary-active: #0f1729;
  --color-accent: #aa8237;
  --color-accent-hover: #7e5515;
  --color-success: #437a22;
  --color-error: #a12c4a;

  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-full: 9999px;

  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-sm: 0 1px 2px oklch(0.2 0.01 80 / 0.06);
  --shadow-md: 0 4px 12px oklch(0.2 0.01 80 / 0.08);
  --shadow-lg: 0 12px 32px oklch(0.2 0.01 80 / 0.14);

  --content-narrow: 640px;
  --content-default: 760px;

  --font-display: 'Instrument Serif', Georgia, serif;
  --font-body: 'Work Sans', 'Helvetica Neue', sans-serif;
}

[data-theme='dark'] {
  --color-bg: #161821;
  --color-surface: #1c1f2b;
  --color-surface-2: #21253a;
  --color-surface-offset: #1e212e;
  --color-surface-dynamic: #2d3142;
  --color-divider: #2a2e3d;
  --color-border: #3a3f52;
  --color-text: #d8d4cc;
  --color-text-muted: #8a8678;
  --color-text-faint: #5a5957;
  --color-text-inverse: #2b2620;
  --color-primary: #c8d0e0;
  --color-primary-hover: #aeb8d0;
  --color-primary-active: #94a0c0;
  --color-accent: #d9a441;
  --color-accent-hover: #e8b858;
  --color-success: #6daa45;
  --color-error: #d16380;

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.2);
  --shadow-md: 0 4px 12px oklch(0 0 0 / 0.3);
  --shadow-lg: 0 12px 32px oklch(0 0 0 / 0.4);
}

/* ===== Base reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  scroll-padding-top: var(--space-16);
}
body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
}
img,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}
h1,
h2,
h3 {
  text-wrap: balance;
  line-height: 1.15;
}
p,
li {
  text-wrap: pretty;
  max-width: 72ch;
}
::selection {
  background: oklch(from var(--color-accent) l c h / 0.25);
  color: var(--color-text);
}
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}
button {
  cursor: pointer;
  background: none;
  border: none;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--content-default);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in oklab, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-divider);
}
.header__inner {
  display: flex;
  flex-direction: row-reverse; /* logo at top right of the page */
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-4);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-primary);
  text-decoration: none;
}
.logo__mark {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}
.logo__text {
  font-family: var(--font-display);
  font-size: calc(var(--text-lg) * 1.5);
  line-height: 1.05;
  color: var(--color-primary);
}
.logo__text small {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.theme-toggle:hover {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ===== Hero ===== */
.hero {
  padding-block: clamp(var(--space-12), 8vw, var(--space-20));
  text-align: center;
  border-bottom: 1px solid var(--color-divider);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in oklab, var(--color-accent) 12%, transparent), transparent 60%);
}
.eyebrow {
  display: inline-block;
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: var(--space-4);
}
.hero h1 {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 400;
  color: var(--color-primary);
  max-width: 18ch;
  margin-inline: auto;
}
.hero__lede {
  margin-top: var(--space-5);
  color: var(--color-text-muted);
  max-width: 52ch;
  margin-inline: auto;
}

/* ===== Form ===== */
.eval {
  padding-block: clamp(var(--space-10), 5vw, var(--space-16));
}
.eval__intro {
  background: var(--color-surface);
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-6) var(--space-6);
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-10);
}
.eval__intro p {
  color: var(--color-text-muted);
}

fieldset {
  border: none;
  padding: 0;
}
.fieldset {
  margin-bottom: var(--space-12);
}
.fieldset__legend {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400;
  color: var(--color-primary);
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}
.fieldset__step {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.question {
  margin-bottom: var(--space-8);
}
.question__label {
  display: block;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}
.question__hint {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}
.question__required {
  color: var(--color-accent);
  margin-left: 0.2em;
}

/* text inputs */
.input,
.textarea {
  width: 100%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  color: var(--color-text);
  transition:
    border-color var(--transition-interactive),
    box-shadow var(--transition-interactive);
}
.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--color-accent) 22%, transparent);
}
.textarea {
  min-height: 6rem;
  resize: vertical;
  line-height: 1.55;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--color-text-faint);
}
.row-3 {
  display: grid;
  gap: var(--space-3);
}

/* choice chips (radio + checkbox) */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.choice {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  cursor: pointer;
  user-select: none;
  transition:
    border-color var(--transition-interactive),
    background var(--transition-interactive),
    color var(--transition-interactive);
}
.choice input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.choice:hover {
  border-color: var(--color-accent);
}
.choice input:focus-visible + .choice__text {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.choice input:checked ~ .choice__text {
  color: var(--color-primary);
  font-weight: 600;
}
.choice:has(input:checked) {
  background: color-mix(in oklab, var(--color-accent) 14%, var(--color-surface-2));
  border-color: var(--color-accent);
}
.choice input:disabled ~ .choice__text {
  opacity: 0.5;
}

/* stacked radio variant */
.choices--stack {
  flex-direction: column;
  gap: var(--space-2);
}
.choices--stack .choice {
  width: 100%;
  border-radius: var(--radius-md);
  justify-content: flex-start;
}

/* optional follow-up */
.followup {
  margin-top: var(--space-4);
}
.followup__label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
  display: block;
}

.note-callout {
  background: color-mix(in oklab, var(--color-accent) 10%, var(--color-surface-2));
  border-left: 3px solid var(--color-accent);
  border-radius: var(--radius-sm);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
}

/* submit */
.form-actions {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.btn-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    background var(--transition-interactive),
    transform var(--transition-interactive);
  align-self: flex-start;
}
.btn-submit:hover {
  background: var(--color-primary-hover);
}
.btn-submit:active {
  background: var(--color-primary-active);
  transform: translateY(1px);
}
.btn-submit:disabled {
  opacity: 0.6;
  cursor: wait;
}
.form-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* messages */
.message {
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid;
}
.message--success {
  background: color-mix(in oklab, var(--color-success) 12%, var(--color-surface));
  border-color: color-mix(in oklab, var(--color-success) 40%, transparent);
}
.message--success h2 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}
.message--success p {
  color: var(--color-text-muted);
}
.message--error {
  background: color-mix(in oklab, var(--color-error) 12%, var(--color-surface));
  border-color: color-mix(in oklab, var(--color-error) 40%, transparent);
  color: var(--color-text);
}

/* footer */
.footer {
  border-top: 1px solid var(--color-divider);
  padding-block: var(--space-10);
  text-align: center;
}
.footer p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.footer a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* hidden honeypot */
.honeypot {
  position: absolute;
  left: -9999px;
}

/* mobile */
@media (max-width: 540px) {
  .row-3 {
    grid-template-columns: 1fr;
  }
  .btn-submit {
    align-self: stretch;
  }
}

/* print */
@media print {
  body {
    background: #fff;
    color: #1a1a1a;
  }
  .header {
    position: static;
    background: #fff;
    backdrop-filter: none;
    border-bottom: 1px solid #ccc;
  }
  .theme-toggle {
    display: none;
  }
  .hero {
    background: none;
    padding-block: 0.5rem;
  }
  .hero h1 {
    color: #142846;
  }
  .eyebrow {
    color: #aa8237;
  }
  .eval {
    padding-block: 0.5rem;
  }
  .eval__intro {
    box-shadow: none;
    background: #fff;
  }
  .choices,
  .choice,
  .followup,
  .row-3,
  .note-callout {
    break-inside: avoid;
  }
  .question__label {
    break-after: avoid;
  }
  .fieldset__legend {
    break-after: avoid;
  }
  .question__hint {
    break-after: avoid;
  }
  .choice {
    background: #fff;
    border: 1px solid #999;
    color: #1a1a1a;
  }
  .note-callout {
    background: #fff;
    border: 1px solid #cfc4ad;
    border-left: 3px solid #aa8237;
  }
  .input,
  .textarea {
    background: #fff;
    border: 1px solid #999;
  }
  .footer {
    display: none;
  }
  .form-actions {
    break-before: avoid;
  }
  .btn-submit {
    background: #fff;
    color: #142846;
    border: 1px solid #142846;
  }

  /* Condense to fewer pages */
  .container { padding-inline: 0.4rem; }
  .header__inner { padding-block: 0.3rem; }
  .logo__mark { width: 33px; height: 33px; }
  .logo__text { font-size: 1.5rem; }
  .logo__text small { font-size: 0.9rem; }
  .hero { padding-block: 0.2rem 0.35rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero__lede { margin-top: 0.25rem; font-size: 0.82rem; }
  .eyebrow { margin-bottom: 0.2rem; }
  .eval__intro { padding: 0.4rem 0.6rem; margin-bottom: 0.4rem; }
  .eval__intro p { font-size: 0.8rem; }
  .eval { padding-block: 0.2rem; }
  .fieldset { margin-bottom: 0.4rem; }
  .fieldset__legend { font-size: 1.05rem; margin-bottom: 0.3rem; padding-bottom: 0.2rem; }
  .question { margin-bottom: 0.35rem; }
  .question__label { font-size: 0.84rem; margin-bottom: 0.1rem; }
  .question__hint { font-size: 0.74rem; margin-bottom: 0.15rem; }
  .followup { margin-top: 0.2rem; }
  .followup__label { font-size: 0.74rem; margin-bottom: 0.1rem; }
  .note-callout { padding: 0.3rem 0.5rem; font-size: 0.74rem; margin-bottom: 0.25rem; }

  .choices { gap: 3px; }
  .choice { padding: 0.18rem 0.45rem; font-size: 0.76rem; }
  /* stack choice groups as a 2-column grid to halve height */
  .choices--stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
  }
  .choices--stack .choice {
    width: auto;
    border-radius: 6px;
    padding: 0.18rem 0.45rem;
    font-size: 0.76rem;
    justify-content: flex-start;
  }

  /* three main points on one line */
  .row-3 { grid-template-columns: 1fr 1fr 1fr; gap: 4px; }

  /* shorter response boxes */
  .textarea { min-height: 2.2rem; }

  .form-actions { margin-top: 0.4rem; padding-top: 0.3rem; }

  /* extra condensation to reach 2 pages */
  html { font-size: 14px; }
  body { line-height: 1.18; }
  .hero { padding-block: 0.05rem 0.15rem; }
  .hero h1 { font-size: 1.15rem; }
  .hero__lede { font-size: 0.78rem; }
  .eyebrow { margin-bottom: 0.15rem; }
  .eval__intro { padding: 0.2rem 0.4rem; margin-bottom: 0.2rem; }
  .eval__intro p { font-size: 0.76rem; }
  .fieldset { margin-bottom: 0.22rem; }
  .fieldset__legend { font-size: 0.98rem; margin-bottom: 0.22rem; padding-bottom: 0.15rem; }
  .question { margin-bottom: 0.18rem; }
  .question__label { font-size: 0.8rem; margin-bottom: 0.08rem; }
  .question__hint { font-size: 0.7rem; margin-bottom: 0.1rem; }
  .note-callout { padding: 0.15rem 0.35rem; font-size: 0.66rem; margin-bottom: 0.1rem; }
  .choice { padding: 0.12rem 0.4rem; font-size: 0.72rem; }
  .choices--stack .choice { padding: 0.12rem 0.4rem; font-size: 0.72rem; }
  .textarea { min-height: 1.1rem; }
  .followup { margin-top: 0.15rem; }
  .form-actions { margin-top: 0.3rem; padding-top: 0.2rem; }
}
