/* site.css for keywestphysician.com.
   The one stylesheet sitewide. Print rules live at the bottom under
   @media print (Chunk 5). Never a second CSS file.

   Design contract: hue 151 spruce family on a cool clinical light surface,
   2px maximum radius, 1px hairline frames, zero shadows anywhere,
   no font-size below 0.8125rem, no rendered text below 13px. */

/* ---------- Color tokens ---------- */

:root {
  --ink: #232A26;          /* body text on white, 13.7:1 */
  --ink-muted: #4F5B54;    /* secondary text, captions, mono labels on white */
  --spruce: #125434;       /* heading accents, rules, table top borders, icon strokes, wordmark */
  --spruce-band: #0E4229;  /* hero band and footer band backgrounds, light text only */
  --green-action: #157546; /* links, Refer a patient button fill, active nav underline, focus rings */
  --paper: #FFFFFF;        /* page background */
  --panel: #F3F6F4;        /* panels, form field background, chip background */
  --panel-deep: #E8EEEA;   /* table header rows, dl-card body */
  --hairline: #D3DCD6;     /* 1px frames, rules, dividers, decorative only */
  --band-text: #F4F8F5;    /* headings and body on spruce bands */
  --band-muted: #C2D5C9;   /* mono labels on spruce bands */
  --danger: #A33B2E;       /* emergency routing text and red-flag rule, status only, never decoration */

  /* Spacing scale. Vertical rhythm uses these only. The 20px mobile side
     gutter is spec-fixed and is the sole off-scale value. */
  --space-4: 4px;
  --space-8: 8px;
  --space-12: 12px;
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
  --space-48: 48px;
  --space-64: 64px;
  --space-96: 96px;
  /* Type tokens (final pass 6B). Every value equals the literal the site shipped with. */
  --font-display: 'STIX Two Text', serif;
  --font-body: 'Fira Sans', sans-serif;
  --font-mono: 'Fira Mono', monospace;
  --fs-label: 0.8125rem;   /* 13px mono labels, the floor */
  --fs-small: 0.875rem;    /* 14px footer and hints */
  --fs-nav: 0.9375rem;     /* 15px nav, buttons, form labels */
  --fs-base: 1rem;         /* 16px table cells and inputs */
  --fs-h4: 1.0625rem;      /* 17px */
  --fs-body: 1.09375rem;   /* 17.5px */
  --fs-lead: 1.1875rem;    /* 19px */
  --fs-h3: 1.25rem;        /* 20px */
  --fs-wordmark: 1.375rem; /* 22px */
  --fs-h2: 1.625rem;       /* 26px */
  --fs-h1: clamp(2rem, 4.5vw, 2.625rem);
  --lh-body: 1.66;
  --container: 920px;
  --measure: 680px;

}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

html {
  font-size: 100%; /* 16px base, never below */
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--fs-body); /* 17.5px rendered, floor is 17 to 19px */
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 0 0 var(--space-16);
}

h1 {
  font-size: var(--fs-h1);
  line-height: 1.18;
  text-wrap: balance;
}

h2 {
  font-size: var(--fs-h2); /* 26px */
  line-height: 1.25;
}

h3 {
  font-size: var(--fs-h3); /* 20px */
  line-height: 1.3;
}

h4 {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-h4); /* 17px */
  line-height: 1.4;
  margin: 0 0 var(--space-12);
}

p {
  margin: 0 0 var(--space-16);
}

a {
  color: var(--green-action);
}

a:visited {
  color: var(--green-action); /* no purple visited state, ever */
}

a:hover {
  color: var(--spruce);
}

a:active {
  color: var(--spruce-band);
}

.lead {
  font-size: var(--fs-lead); /* 19px */
  line-height: 1.6;
}

nav a {
  font-weight: 500;
  font-size: var(--fs-nav); /* 15px, the nav floor */
  line-height: 1.2;
}

.btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-nav); /* 15px */
  line-height: 1.2;
  letter-spacing: 0.01em;
  border-radius: 2px;
  text-decoration: none;
  white-space: nowrap; /* short button labels stay on one line */
}

.eyebrow,
.spec-label {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label); /* 13px, never smaller */
  line-height: 1.4;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}

#kw-chip {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: var(--fs-label); /* 13px, the quietest element on the site */
  line-height: 1.4;
  background: var(--panel);
  border-radius: 2px;
}

footer {
  font-size: var(--fs-small); /* 14px, floor is 13px */
  line-height: 1.6;
}

table {
  border-collapse: collapse;
}

th,
td {
  font-size: var(--fs-base); /* 16px; numeric cells may use Fira Mono 400 */
  line-height: 1.5;
  text-align: left;
}

/* ---------- Shell and rhythm ---------- */

.shell {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: 20px;  /* spec-fixed mobile gutter */
  padding-right: 20px;
}

.prose {
  max-width: var(--measure); /* prose measure; spec table and referral form may use the full 920px */
}

.section {
  padding-top: var(--space-48);
  padding-bottom: var(--space-48);
}

/* Stacked sections must not double their padding into a huge dead gap;
   the preceding section's bottom padding is the single gap between them. */
.section + .section {
  padding-top: 0;
}

.band-hero {
  background: var(--spruce-band);
  color: var(--band-text);
  padding-top: var(--space-64);
  padding-bottom: var(--space-64);
}

@media (max-width: 640px) {
  .section {
    padding-top: var(--space-32);
    padding-bottom: var(--space-32);
  }

  .band-hero {
    padding-top: var(--space-48);
    padding-bottom: var(--space-48);
  }
}

/* ---------- Layout utilities ----------
   Base scaffolding primitives completing the Chunk 2 base layer; added
   during Chunk 6 and logged in PROJECT_STATE.md. */

.btn-row {
  display: flex;
  gap: var(--space-16);
  flex-wrap: wrap;
  margin: var(--space-24) 0;
}

.mono-line {
  font-family: var(--font-mono);
  font-size: var(--fs-label); /* 13px */
  line-height: 1.4;
}

.band-hero .mono-line {
  color: var(--band-muted);
}

.band-hero a:not(.btn) {
  color: var(--band-text);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-24);
}

.cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-32);
}

.card-pad {
  padding: var(--space-24);
}

.card-glyph {
  color: var(--spruce);
  display: block;
  margin-bottom: var(--space-12);
}

.ruled-col {
  border-top: 1px solid var(--hairline);
  padding-top: var(--space-16);
}

@media (max-width: 640px) {
  .grid-3,
  .cols-2 {
    grid-template-columns: 1fr;
  }
}

/* ---------- Frames and rules ---------- */

.card {
  border: 1px solid var(--hairline);
  border-radius: 2px;
}

/* Double hairline section divider: border-top plus a second line 3px below. */
.rule-double {
  position: relative;
  border-top: 1px solid var(--hairline);
  margin-bottom: var(--space-24); /* keep the heading below off the double lines */
}

.rule-double::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 3px;
  border-top: 1px solid var(--hairline);
}

/* ---------- Skip link ---------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--green-action);
  color: #FFFFFF;
  padding: var(--space-8) var(--space-16);
}

.skip-link:focus {
  left: 0;
  z-index: 10;
}

/* ---------- Header: ruled two-deck document header, never sticky ---------- */

.site-header {
  background: var(--paper);
}

.header-deck-one {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
  border-bottom: 1px solid var(--hairline);
}

/* Top row: wordmark on the left, phone and CTA on the right. The sub-line
   sits on its own full-width line below, so it never has to compete with
   the utility cluster for space. */
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-24);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  text-decoration: none;
  color: var(--ink);
  min-width: 0; /* let the wordmark yield and wrap before the row overflows */
}

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

.brand-mark {
  color: var(--spruce);
  flex: none;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-wordmark);
  line-height: 1.1;
  color: var(--ink);
}

.brand-subline {
  margin: var(--space-4) 0 0;
  font-family: var(--font-mono);
  font-size: var(--fs-label); /* 13px */
  line-height: 1.4;
  color: var(--ink-muted);
}

.header-utility {
  display: flex;
  align-items: center;
  gap: var(--space-24);
  flex-shrink: 0; /* keep the phone and CTA at full width; the brand yields space */
}

.header-phone {
  font-weight: 500;
  font-size: var(--fs-nav); /* 15px */
  text-decoration: none;
  white-space: nowrap; /* a phone number never breaks across lines */
}

.header-phone:hover {
  text-decoration: underline;
}

/* Deck two: nav rail closed underneath by the double hairline rule. */
.header-deck-two {
  position: relative;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 4px;
}

.header-deck-two::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px; /* second line 3px below the first */
  border-bottom: 1px solid var(--hairline);
}

.nav-rail {
  display: flex;
  gap: var(--space-24);
  list-style: none;
  margin: 0;
  padding: var(--space-4) 0;
}

.nav-rail a,
.nav-stack a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  padding-bottom: var(--space-4);
}

.nav-rail a:hover,
.nav-stack a:hover,
.nav-rail a:active,
.nav-stack a:active {
  text-decoration: underline;
}

.nav-rail a[aria-current="page"],
.nav-stack a[aria-current="page"] {
  border-bottom: 2px solid var(--green-action);
}

/* Mobile disclosure: the only animated element sitewide. */
.nav-disclosure {
  display: none;
}

.nav-disclosure summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  font-weight: 500;
  font-size: var(--fs-nav); /* 15px */
  line-height: 1.2;
  color: var(--green-action);
  cursor: pointer;
  padding: var(--space-8) 0;
}

.nav-disclosure summary:hover {
  text-decoration: underline;
}

.nav-stack {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-16);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.nav-disclosure[open] .nav-stack {
  animation: kwp-menu-open 160ms ease-out;
}

@keyframes kwp-menu-open {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-disclosure[open] .nav-stack {
    animation: none; /* instant toggle; nothing else animates, ever */
  }
}

@media (max-width: 640px) {
  .nav-rail {
    display: none;
  }

  .nav-disclosure {
    display: block;
  }

  .header-phone {
    display: none; /* deck one keeps mark, wordmark, and the CTA */
  }

  /* On narrow screens the wordmark and CTA stack so neither is ever
     squeezed or clipped. */
  .header-top {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-12);
  }
}

/* ---------- Footer: the single spruce band ---------- */

.site-footer {
  background: var(--spruce-band);
  color: var(--band-text);
  padding-top: var(--space-32);
  padding-bottom: var(--space-32);
  /* The preceding section's bottom padding is the single gap above the
     footer; no extra top margin, to match the sitewide rhythm. */
  margin-top: 0;
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-24);
  flex-wrap: wrap;
}

.footer-identity {
  margin: 0;
}

.site-footer a {
  color: var(--band-text);
}

.site-footer a:visited {
  color: var(--band-text);
}

.footer-links {
  list-style: none;
  display: flex;
  gap: var(--space-16);
  margin: 0;
  padding: 0;
}

@media (max-width: 640px) {
  .footer-row {
    flex-direction: column;
  }
}

/* ---------- Interaction, focus, and state tokens ---------- */

/* Focus: 2px green outline, 2px offset, on every interactive element,
   never removed, never color alone. */
:focus-visible {
  outline: 2px solid var(--green-action);
  outline-offset: 2px;
}

/* On the two spruce bands the green ring reads 2:1; the band text color reads 14:1. */
.band-hero :focus-visible,
.site-footer :focus-visible {
  outline-color: var(--band-text);
}

/* Filled button: the Refer a patient CTA. */
.btn-fill {
  background: var(--green-action);
  color: #FFFFFF;
  border: 0;
  padding: var(--space-8) var(--space-16);
}

.btn-fill:visited {
  color: #FFFFFF;
}

.btn-fill:hover {
  background: var(--spruce);
}

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

.btn-fill:disabled,
.btn-fill[aria-disabled="true"] {
  background: var(--panel-deep);
  color: var(--ink-muted);
}

/* Outline button: hero secondary. */
.btn-outline {
  background: transparent;
  border: 1px solid var(--hairline);
  color: var(--ink);
  padding: var(--space-8) var(--space-16);
}

.btn-outline:visited {
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--green-action);
}

.btn-outline:active {
  background: var(--panel);
}

.band-hero .btn-outline {
  border-color: var(--band-muted);
  color: var(--band-text);
}

.band-hero .btn-outline:visited {
  color: var(--band-text);
}

.band-hero .btn-outline:hover {
  border-color: var(--green-action);
}

/* Form field states. Fields arrive in Chunk 9; the state layer is fixed here. */
input,
select,
textarea {
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--ink-muted); /* the hairline read 1.3:1 on the panel; ink-muted reads 6.5:1 */
  border-radius: 2px;
  padding: var(--space-8) var(--space-12);
  min-height: 44px;
}

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

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--green-action);
  outline-offset: 0;
  border-color: var(--green-action);
}

.input-error {
  border: 2px solid var(--danger);
}

.error-text {
  color: var(--danger);
  font-size: var(--fs-small); /* 14px */
  margin: var(--space-4) 0 0;
}

/* Chip frame. The chip ships with the hidden attribute; the guard below
   keeps hidden winning over the display rule. */
#kw-chip {
  border: 1px solid var(--hairline);
  padding: var(--space-4) var(--space-8);
  display: inline-block;
}

#kw-chip[hidden] {
  display: none;
}

/* Text selection. */
::selection {
  background: var(--spruce);
  color: #FFFFFF;
}

/* ---------- Content partials ---------- */

.kwco-cta,
.contact-block {
  background: var(--panel);
  padding: var(--space-24);
}

.kwco-cta p:last-child,
.contact-block p:last-child {
  margin-bottom: 0;
}

.reviewer-block {
  border-top: 1px solid var(--hairline);
  padding-top: var(--space-16);
  color: var(--ink-muted);
  font-size: var(--fs-nav);
}

.reviewer-block p {
  margin-bottom: 0;
}

.red-flag-box {
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--danger);
  border-radius: 2px;
  padding: var(--space-24);
}

.red-flag-box p:last-child {
  margin-bottom: 0;
}

/* Step list: boxed mono numerals on a semantic ol. */
.step-list {
  list-style: none;
  counter-reset: kwp-step;
  margin: 0 0 var(--space-24);
  padding: 0;
}

.step-list li {
  counter-increment: kwp-step;
  position: relative;
  padding-left: var(--space-48);
  margin-bottom: var(--space-24);
}

.step-list li::before {
  content: counter(kwp-step);
  position: absolute;
  left: 0;
  top: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--fs-label);
  color: var(--spruce);
  border: 1px solid var(--hairline);
  border-radius: 2px;
}

.step-list .step-title {
  display: block;
  margin-bottom: var(--space-4);
}

.step-list-compact li {
  margin-bottom: var(--space-12);
}

.step-list-compact .step-title {
  display: inline;
  margin-right: var(--space-8);
}

/* Download card: 3px spruce top border, panel-deep body. */
.dl-card {
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--spruce);
  border-radius: 2px;
  background: var(--panel-deep);
  padding: var(--space-24);
}

.dl-card-link {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  text-decoration: none;
}

.dl-card-link:hover .dl-card-title,
.dl-card-link:active .dl-card-title {
  text-decoration: underline;
}

.dl-glyph {
  color: var(--spruce);
  flex: none;
}

.dl-card-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.dl-card-title {
  font-weight: 600;
}

.dl-card-label {
  font-family: var(--font-mono);
  font-size: var(--fs-label); /* 13px */
  line-height: 1.4;
  color: var(--ink-muted);
}

.dl-card-note {
  margin: var(--space-12) 0 0;
  font-size: var(--fs-nav);
  color: var(--ink-muted);
}

/* ---------- Spec table ---------- */

.spec-table {
  width: 100%;
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--spruce);
  border-collapse: collapse;
}

.spec-table th,
.spec-table td {
  border: 1px solid var(--hairline);
  padding: var(--space-8) var(--space-12);
  font-size: var(--fs-base);
}

.spec-table thead th {
  background: var(--panel-deep);
  font-weight: 600;
}

/* Under 640px the table stacks into label-value pairs with no horizontal
   scroll. Body cells carry data-label attributes (Chunk 7 contract). */
@media (max-width: 640px) {
  .spec-table thead {
    display: none;
  }

  .spec-table tr {
    display: block;
    border-bottom: 1px solid var(--hairline);
    padding: var(--space-8) 0;
  }

  .spec-table td,
  .spec-table th {
    display: block;
    border: 0;
  }

  .spec-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: var(--font-mono);
    font-size: var(--fs-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    margin-bottom: var(--space-4);
  }
}

/* ---------- Referral form ---------- */

.referral-form {
  max-width: var(--measure);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0 0 var(--space-16);
}

.form-field label {
  font-weight: 500;
  font-size: var(--fs-nav); /* 15px labels */
}

.form-field input,
.form-field select,
.form-field textarea {
  font-size: var(--fs-base); /* 16px input text */
  width: 100%;
}

.field-hint {
  font-size: var(--fs-small);
  color: var(--ink-muted);
  margin: 0;
}

/* Honeypot: visually hidden, present in the DOM. */
.hp-field {
  position: absolute;
  left: -9999px;
  top: auto;
}

.referral-confirmation {
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--spruce);
  border-radius: 2px;
  background: var(--panel);
  padding: var(--space-24);
  margin-bottom: var(--space-32);
}

.form-notice {
  border: 1px solid var(--hairline);
  border-top: 3px solid var(--danger);
  border-radius: 2px;
  padding: var(--space-16) var(--space-24);
}

/* Print-only pointers stay hidden on screen. */
.print-only {
  display: none;
}

/* Marked blocks drop out of the printed page. */
@media print {
  .print-hide {
    display: none !important;
  }
}

/* ---------- Print base ---------- */
/* Print rules live here and only here: one stylesheet sitewide. */

@page {
  margin: 12mm;
}

@media print {
  .spec-table th,
  .spec-table td {
    font-size: 11pt;
    padding: 3pt 5pt;
  }

  /* Hidden in print: header deck two, the header CTA, the footer band,
     the chip, all buttons. */
  .header-deck-two,
  .header-utility .btn,
  .site-footer,
  #kw-chip,
  .btn,
  button {
    display: none !important;
  }

  body {
    background: #FFFFFF;
    color: #000000;
    font-size: 11pt; /* Fira Sans body, 11pt minimum */
    line-height: 1.5;
  }

  /* Letterhead: deck one (mark, wordmark, mono sub-line) closed by one
     3px spruce rule. Shared aesthetic with the referral sheet PDF. */
  .header-deck-one {
    border-bottom: 3px solid #125434;
    padding-left: 0;
    padding-right: 0;
  }

  /* No band or panel backgrounds on paper; hairline table rules stay. */
  .band-hero,
  .kwco-cta,
  .contact-block,
  .dl-card,
  .site-header {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  a,
  a:visited {
    color: #000000;
    text-decoration: none;
  }

  /* kwco-link anchors print their URL after the anchor text; internal
     links print as plain text with no URL. */
  .kwco-link::after {
    content: " (" attr(href) ")";
    font-size: var(--fs-label);
  }

  /* The form and its cards do not print; a print-only pointer names the
     PDF instead (decision logged in PROJECT_STATE.md). */
  .referral-form,
  .form-notice,
  .referral-confirmation,
  .dl-card,
  #kw-chip {
    display: none !important;
  }

  .print-only {
    display: block;
  }

  /* One-page compaction: tighter rhythm and a full-width measure on paper. */
  body {
    line-height: 1.3;
  }

  .shell {
    max-width: none;
    padding-left: 0;
    padding-right: 0;
  }

  .prose {
    max-width: none;
  }

  .section {
    padding-top: 0;
    padding-bottom: 4pt;
  }

  .band-hero {
    padding-top: 4pt;
    padding-bottom: 4pt;
  }

  .header-deck-one {
    padding-top: 2pt;
    padding-bottom: 4pt;
  }

  h1 {
    font-size: 16pt;
    margin: 4pt 0;
  }

  h2 {
    font-size: 12pt;
    margin: 6pt 0 3pt;
  }

  h3 {
    font-size: 11pt;
    margin: 4pt 0 2pt;
  }

  p,
  li,
  ul,
  ol {
    margin-top: 0;
    margin-bottom: 3pt;
  }

  .step-list li {
    margin-bottom: 4pt;
    padding-left: 24pt;
  }

  .step-list li::before {
    width: 12pt;
    height: 12pt;
  }

  .red-flag-box,
  .contact-block,
  .kwco-cta {
    padding: 5pt 8pt;
  }

  .site-footer {
    margin-top: 0;
  }

  /* Identity footer, 10pt Fira Mono, repeated per printed page. */
  body::after {
    content: "Key West Concierge Orthopedics · Suite 108, 1111 12th Street, Key West, FL 33040 · (305) 707-8484";
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    font-family: var(--font-mono);
    font-size: 10pt;
    color: #000000;
    text-align: center;
    padding-top: 6px;
    border-top: 1px solid #D3DCD6;
    background: #FFFFFF;
  }
}
