@layer page-base, page-components, page-responsive;

@layer page-base {
  .inner-page { background: var(--sand-50); }
  .inner-page .site-header { color: var(--graphite); background: rgb(255 255 255 / .98); box-shadow: 0 8px 30px rgb(4 31 48 / .08); }
  .inner-page .site-header .button-light { color: var(--ocean-900); border-color: var(--line); background: var(--white); }
  .page-main { padding-top: 72px; }
  .page-shell { width: min(100%, var(--max-width)); margin-inline: auto; }
  .page-hero { position: relative; min-height: 400px; padding: clamp(72px, 9vw, 120px) var(--gutter); overflow: hidden; color: var(--white); background: var(--ocean-900); isolation: isolate; }
  .page-hero::after { position: absolute; z-index: -1; right: -8%; bottom: -60%; width: 58%; aspect-ratio: 1; content: ""; border: 1px solid rgb(143 226 220 / .24); border-radius: 50%; }
  .page-hero-fish { background: linear-gradient(90deg, rgb(4 31 48 / .92), rgb(4 31 48 / .62)), url("../images/fish-sorting.jpg") center 44% / cover; }
  .page-hero-spice { background: linear-gradient(90deg, rgb(4 31 48 / .92), rgb(4 31 48 / .58)), url("../images/spice-sorting.jpg") center 48% / cover; }
  .page-hero-split { background: linear-gradient(90deg, rgb(4 31 48 / .9), rgb(4 31 48 / .72)), url("../images/commercial-spices.jpg") center / cover; }
  .page-hero-content { width: min(100%, 840px); }
  .page-hero h1 { max-width: 820px; font-size: clamp(2.7rem, 6vw, 5.6rem); }
  .page-hero p:not(.eyebrow) { max-width: 710px; margin-top: 24px; color: #d3e1e6; font-size: clamp(1rem, 1.8vw, 1.22rem); }
  .page-section { padding: clamp(64px, 8vw, 110px) var(--gutter); }
  .page-section-white { background: var(--white); }
  .page-section-sand { background: var(--sand-100); }
  .prose { max-width: 820px; }
  .prose h2 { margin-bottom: 24px; }
  .prose h3 { margin: 34px 0 12px; font-size: 1.45rem; }
  .prose p + p { margin-top: 18px; }
  .prose ul, .prose ol { margin: 22px 0 0 22px; }
  .prose li + li { margin-top: 10px; }
}

@layer page-components {
  .choice-intro { display: grid; grid-template-columns: 1fr .75fr; gap: clamp(30px, 7vw, 90px); align-items: end; margin-bottom: 42px; }
  .choice-intro > p { color: var(--muted); }
  .journey-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .journey-choice { min-width: 0; min-height: 180px; padding: 28px; border: 2px solid var(--line); color: var(--graphite); background: var(--white); overflow-wrap: anywhere; text-align: left; cursor: pointer; }
  .journey-choice:hover, .journey-choice[aria-pressed="true"] { border-color: var(--teal-500); box-shadow: 0 16px 36px rgb(7 50 74 / .1); }
  .journey-choice[aria-pressed="true"] { background: #eef9f7; }
  .journey-choice span { display: block; margin-bottom: 14px; color: var(--teal-700); font-size: .73rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
  .journey-choice strong { display: block; font-family: var(--font-display); font-size: clamp(1.45rem, 3vw, 2.2rem); line-height: 1.1; }
  .journey-choice small { display: block; margin-top: 12px; color: var(--muted); font-size: .9rem; }

  .lead-workspace[hidden], .conditional-group[hidden], .review-panel[hidden] { display: none; }
  .progress-bar { display: grid; grid-template-columns: repeat(3, 1fr); margin: 50px 0 30px; list-style: none; counter-reset: step; }
  .progress-bar li { position: relative; padding-top: 20px; border-top: 3px solid var(--line); color: var(--muted); font-size: .78rem; font-weight: 720; }
  .progress-bar li::before { position: absolute; top: -11px; left: 0; display: grid; width: 20px; height: 20px; place-items: center; border-radius: 50%; content: counter(step); counter-increment: step; color: var(--white); background: var(--line); font-size: .66rem; }
  .progress-bar li.is-active { border-color: var(--teal-500); color: var(--ocean-900); }
  .progress-bar li.is-active::before { background: var(--teal-700); }

  .lead-form { padding: clamp(24px, 4vw, 54px); background: var(--white); box-shadow: 0 20px 52px rgb(4 31 48 / .08); }
  .form-section + .form-section { margin-top: 48px; padding-top: 42px; border-top: 1px solid var(--line); }
  .form-section-head { margin-bottom: 26px; }
  .form-section-head h2 { font-size: clamp(1.65rem, 3vw, 2.3rem); }
  .form-section-head p { max-width: 720px; margin-top: 10px; color: var(--muted); }
  .field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 20px; }
  .field { display: grid; align-content: start; gap: 7px; min-width: 0; }
  .field-wide { grid-column: 1 / -1; }
  .field label, .field legend { color: var(--ocean-950); font-size: .88rem; font-weight: 740; }
  .required-mark { color: var(--coral-600); }
  .field input:not([type="checkbox"]), .field select, .field textarea { width: 100%; min-height: 50px; padding: 11px 12px; border: 1px solid #aeb9bd; border-radius: 2px; color: var(--graphite); background: var(--white); }
  .field textarea { min-height: 116px; resize: vertical; }
  .field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal-700); outline: 3px solid rgb(24 166 160 / .2); }
  .field-hint { color: var(--muted); font-size: .76rem; }
  .check-field { grid-template-columns: 22px 1fr; gap: 10px; align-items: start; padding: 14px; background: var(--sand-50); }
  .check-field input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--teal-700); }
  .field-error { color: #a32924; font-size: .78rem; font-weight: 650; }
  .field [aria-invalid="true"] { border-color: #b5352e !important; }
  .error-summary { margin-bottom: 26px; padding: 18px 20px; border-left: 4px solid var(--coral-600); background: #fff0ed; }
  .error-summary:focus { outline: 3px solid var(--amber-300); }
  .error-summary h2 { font-size: 1.1rem; }
  .error-summary ul { margin: 8px 0 0 20px; }
  .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 38px; }
  .form-actions button { cursor: pointer; }
  .form-actions button:disabled { cursor: not-allowed; opacity: .55; transform: none; }
  .privacy-note { margin-top: 20px; color: var(--muted); font-size: .8rem; }
  .device-location-control { display: grid; grid-template-columns: 1fr auto; gap: 14px 20px; align-items: center; padding: 20px; border: 1px solid var(--line); background: #f3faf8; }
  .device-location-control strong { color: var(--ocean-950); }
  .device-location-control p { margin-top: 4px; color: var(--muted); font-size: .82rem; }
  .device-location-status, .device-location-confirm { grid-column: 1 / -1; }
  .device-location-confirm { display: grid; grid-template-columns: 20px 1fr; gap: 10px; color: var(--ocean-950); font-size: .86rem; font-weight: 700; }
  .device-location-confirm[hidden] { display: none; }
  .device-location-confirm input { width: 20px; height: 20px; accent-color: var(--teal-700); }
  .form-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

  .review-panel { margin-top: 32px; padding: clamp(24px, 4vw, 48px); color: var(--white); background: var(--ocean-950); }
  .review-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 18px; align-items: start; margin-bottom: 26px; }
  .review-head h2 { font-size: clamp(1.8rem, 3vw, 2.7rem); }
  .lead-reference { display: inline-flex; padding: 8px 11px; color: var(--ocean-950); background: var(--amber-300); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 800; }
  .review-summary { max-height: 540px; padding: 20px; overflow: auto; white-space: pre-wrap; color: #d7e4e9; background: var(--ocean-900); font: .86rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; }
  .review-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
  .review-actions .button { cursor: pointer; }
  .review-actions [hidden] { display: none; }
  .review-note { margin-top: 18px; color: #a9bec7; font-size: .8rem; }
  .turnstile-control { min-height: 68px; margin-top: 24px; }
  .submit-status { min-height: 24px; margin-top: 12px; color: #d7e4e9; font-weight: 650; }

  .content-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 42px; }
  .content-card { padding: 28px; border-top: 4px solid var(--teal-500); background: var(--white); }
  .content-card:nth-child(3n + 2) { border-top-color: var(--amber-500); }
  .content-card:nth-child(3n + 3) { border-top-color: var(--coral-500); }
  .content-card h3 { margin-bottom: 12px; font-size: 1.35rem; }
  .content-card p { color: var(--muted); font-size: .92rem; }
  .content-card .text-link { margin-top: 18px; }
  .step-list { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); list-style: none; }
  .step-list li { min-height: 210px; padding: 26px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--white); }
  .step-list span { display: block; margin-bottom: 30px; color: var(--coral-600); font-weight: 800; }
  .step-list strong { display: block; margin-bottom: 10px; font-family: var(--font-display); font-size: 1.2rem; }
  .step-list p { color: var(--muted); font-size: .88rem; }
  .warning-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; list-style: none; }
  .warning-list li { padding: 18px 20px; border-left: 4px solid var(--coral-500); background: var(--white); }
  .contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 36px; }
  .contact-card { padding: 32px; color: var(--white); background: var(--ocean-900); }
  .contact-card:nth-child(2) { background: var(--teal-700); }
  .contact-card h2 { font-size: 1.65rem; }
  .contact-card p { margin: 12px 0 20px; color: #d2e0e5; }
  .contact-card a { overflow-wrap: anywhere; }
  .status-panel { max-width: 760px; margin: 0 auto; padding: clamp(30px, 6vw, 70px); background: var(--white); text-align: center; box-shadow: 0 20px 50px rgb(4 31 48 / .09); }
  .status-panel h1 { margin-bottom: 20px; font-size: clamp(2.4rem, 6vw, 4.8rem); }
  .status-panel p + p { margin-top: 14px; }
  .status-panel .final-actions { margin-bottom: 0; }
}

@layer page-responsive {
  @media (max-width: 1100px) {
    .page-main { padding-top: 70px; }
    .inner-page .site-nav { color: var(--graphite); }
  }
  @media (max-width: 820px) {
    .choice-intro, .journey-picker, .content-grid, .contact-grid { grid-template-columns: 1fr; }
    .step-list { grid-template-columns: 1fr 1fr; }
  }
  @media (max-width: 640px) {
    .page-hero { min-height: 340px; }
    .field-grid, .warning-list, .step-list { grid-template-columns: 1fr; }
    .field-wide { grid-column: auto; }
    .lead-form { margin-inline: calc(var(--gutter) * -1); box-shadow: none; }
    .progress-bar li { font-size: .68rem; }
    .review-panel { margin-inline: calc(var(--gutter) * -1); }
    .device-location-control { grid-template-columns: 1fr; }
    .device-location-control .button { width: 100%; }
  }
}
