/* ---------------------------------------------------------------------------
   Peace Harbor Web — quote form
   Modern-web floor: variable font, fluid type, color-scheme light/dark,
   :focus-visible rings, prefers-reduced-motion honored.
--------------------------------------------------------------------------- */

@font-face {
  font-family: 'Inter';
  src: url('/fonts/inter-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}
/* Cormorant — display serif for headings + the wordmark (mirrors ../phstudios). */
@font-face {
  font-family: 'Cormorant';
  src: url('/fonts/cormorant-var.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
  font-style: normal;
}
@font-face {
  font-family: 'Cormorant';
  src: url('/fonts/cormorant-italic-var.woff2') format('woff2-variations');
  font-weight: 300 700;
  font-display: swap;
  font-style: italic;
}

:root {
  color-scheme: light dark;

  /* Peace Harbor family scheme — mirrors ../phstudios (black + gold). */
  --brand: #d79432;        /* gold — primary action / focus */
  --brand-deep: #b87a22;   /* darker gold — hover */
  --accent: #d79432;       /* gold — required marks, highlights */
  --error: #d97a6c;        /* warm coral — validation errors */

  --ink: #ffffff;
  --muted: #999999;
  --line: #1f1f1f;
  --surface: #0d0d0d;
  --surface-2: #0d0d0d;
  --bg: #000000;

  --ring: #d79432;
  --radius: 12px;
  --maxw: 760px;

  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-display: 'Cormorant', 'EB Garamond', Georgia, 'Times New Roman', serif;

  --step--1: clamp(0.85rem, 0.82rem + 0.15vw, 0.94rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.12rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.5rem);
  --step-3:  clamp(1.9rem, 1.5rem + 2vw, 3rem);
}

/* Light mode — auto, follows the OS. Warm cream/ink + the same gold accent. */
@media (prefers-color-scheme: light) {
  :root {
    --brand: #d79432;       /* keep the logo gold; buttons use black text on it */
    --brand-deep: #b87a22;
    --accent: #a86d15;      /* deeper gold for required marks (contrast on cream) */
    --error: #b3261e;
    --ink: #1c1b18;
    --muted: #6b675f;
    --line: #e4ded2;
    --surface: #ffffff;
    --surface-2: #f6f2ea;
    --bg: #faf7f2;
    --ring: #d79432;
  }
  /* On a light surface the ghost-hover (gold text on cream) is too faint, so
     fill with the deeper gold + white text instead. */
  .btn:hover { background: var(--brand-deep); color: #fff; border-color: var(--brand-deep); }
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* ---- header / footer ---- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: clamp(0.85rem, 0.5rem + 1.5vw, 1.4rem) 1.25rem;
}
/* Gold rectangular "Peace Harbor Companies" logo — the shared family mark
   (same as ../phstudios' hero logo). Logo-only header, no wordmark text. */
.brand { display: inline-flex; text-decoration: none; }
.brand-logo {
  display: block;
  height: clamp(40px, 2rem + 1.5vw, 54px);
  width: auto;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: var(--step--1);
  padding: 2.5rem 1.25rem 3rem;
}

/* ---- layout ---- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(1.5rem, 1rem + 3vw, 3rem) 1.25rem 1rem;
}

.intro { margin-bottom: 2rem; }
h1 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 600;
  line-height: 1.05;
  margin: 0 0 0.5rem;
  letter-spacing: 0;
  text-wrap: balance;
}
.lede { color: var(--muted); margin: 0 0 1rem; max-width: 60ch; }
.required-note { font-size: var(--step--1); color: var(--muted); margin: 0; }
.required-note span { color: var(--accent); }

/* ---- form ---- */
.quote-form { display: grid; gap: 1.25rem; }

fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 1.25rem clamp(1rem, 0.6rem + 1.5vw, 1.6rem) 1.5rem;
  margin: 0;
  display: flow-root;
}
/* Vertical rhythm between a fieldset's flow children (replaces grid `gap`). */
fieldset > *:not(legend) { clear: both; }
fieldset > *:not(legend) ~ *:not(legend) { margin-top: 1rem; }
legend {
  /* float + width:100% takes the legend out of the "rendered legend" border
     slot so it lays out as a normal heading inside the panel. */
  float: left;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: calc(var(--step-1) * 1.1);
  letter-spacing: 0;
}
legend .hint { font-family: var(--font-body); font-weight: 400; }

.hint { color: var(--muted); font-size: var(--step--1); font-weight: 400; text-transform: none; }
.hint a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.hint a:hover { color: var(--brand-deep); }

/* Title Case display on headings, fieldset legends, and labels. The value=""
   attributes (what gets serialized + emailed) keep their original casing. */
h1, legend, .label, .check span, .btn { text-transform: capitalize; }

.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.field { display: grid; gap: 0.4rem; }
.label { display: block; font-weight: 550; font-size: var(--step--1); }
.req { color: var(--accent); }

input, select, textarea {
  font: inherit;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 3rem; }

input:hover, select:hover, textarea:hover { border-color: var(--brand); }

input:focus-visible, select:focus-visible, textarea:focus-visible,
.check input:focus-visible, .btn:focus-visible {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 45%, transparent);
}

input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--error);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--error) 30%, transparent);
}

/* ---- checkbox groups ---- */
.checks {
  display: grid;
  gap: 0.5rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  cursor: pointer;
  font-size: var(--step--1);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.check:hover { border-color: var(--brand); }
.check input { width: auto; margin: 0.15rem 0 0; accent-color: var(--brand); flex: none; }
.check:has(input:checked) {
  border-color: var(--brand);
  background: color-mix(in oklab, var(--brand) 12%, var(--surface));
}

/* ---- conditional regions ---- */
.conditional[hidden] { display: none; }

/* ---- honeypot ---- */
.hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---- actions ---- */
.actions { display: grid; gap: 0.75rem; justify-items: start; }
.btn {
  font: inherit;
  font-weight: 600;
  color: #000;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 999px;
  padding: 0.75rem 1.6rem;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease, transform 0.05s ease;
}
.btn:hover { background: transparent; color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: progress; }

.status { margin: 0; font-size: var(--step--1); color: var(--error); min-height: 1.2em; }

/* ---- toast ---- */
.toast {
  position: fixed;
  inset-block-end: 1.25rem;
  inset-inline: 1.25rem;
  margin-inline: auto;
  max-width: 30rem;
  background: rgba(0, 0, 0, 0.96);
  color: var(--brand);
  border: 1px solid var(--brand);
  padding: 0.9rem 1.2rem;
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: toast-in 0.3s ease, toast-out 0.4s ease 3.6s forwards;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(12px); } }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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