/* Fonts (Source Serif 4, Manrope, Courier Prime, Caveat) are loaded once,
   non-blocking, in cast-templates/layout.php — do not re-@import here (it
   double-fetches Manrope + Courier Prime and serializes behind this sheet). */

/* Contact template — the home study's design language, rearranged for a
   contact page: same palette, type, and torn-paper edges, new composition.
   Everything is scoped under .contact-study so partials and utilities stay
   untouched. The form plugin's markup is restyled only inside .form-card. */

.contact-study {
  --paper: #f5f5f1;
  --paper-2: #ffffff;
  --ink: #282825;
  --ink-soft: #55565e;
  --gray: #8f8f89;
  --line: #d6d6cf;
  --dark: #292a2e;
  --darker: #1d1e20;
  --brand-red-soft: #980f0f;
  --teal: #0c7a5c;
  --mint: #73e2bd;
  --acid: #d8ff59;
  --brand-red: #980f0f;

  --display: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --mono: "Courier Prime", "Courier New", monospace;
  --hand: "Caveat", "Segoe Script", cursive;
  --copy-size: 1.3125rem;
  --eyebrow-size: .875rem;

  --nav-h: 4.5rem;
  --pad-x: max(6vw, calc((100vw - 1180px) / 2));
  --squiggle: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='7' viewBox='0 0 48 7'><path d='M1 4 Q7 1 13 3.6 T25 3.6 T37 3.6 T49 3.6' fill='none' stroke='%23980f0f' stroke-width='2' stroke-linecap='round'/></svg>");
  --squiggle-soft: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='7' viewBox='0 0 48 7'><path d='M1 4 Q7 1 13 3.6 T25 3.6 T37 3.6 T49 3.6' fill='none' stroke='%23980f0f' stroke-width='2' stroke-linecap='round'/></svg>");

  /* Scoped utility-token bridge (AI_GUIDE.md “Scoped token bridges”): the
     semantic utility tokens are re-pointed at this section's palette so
     bg-/text-/border- utilities inside .contact-study speak the study's
     design instead of the global one. Declared here, never on :root, so the
     shell and other sections keep the root palette; --color-primary-text is
     the verified pairing for bg-primary against this section's --brand-red.
     Note: root-derived tokens (e.g. --color-accent-soft) are NOT recomputed
     by these overrides — see the guide before relying on a derived token. */
  --color-bg: var(--paper);
  --color-surface: var(--paper);
  --color-surface-2: var(--paper-2);
  --color-text: var(--ink);
  --color-muted: var(--ink-soft);
  --color-primary: var(--brand-red);
  --color-primary-text: #fff;
  --color-border: var(--line);
}

.contact-study * { box-sizing: border-box; }
/* Background and ink now arrive as the bg-background/text-text utilities in
   template.php; they resolve through the --color-bg/--color-text bridge above
   — identical to the previous var(--paper)/var(--ink) declarations. */
.contact-study {
  margin: 0;
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
  overflow-x: clip;
}
.contact-study a { color: inherit; text-decoration: none; }
.contact-study ::selection { background: var(--brand-red); color: #fff; }
.contact-study :focus-visible { outline: 2px solid var(--brand-red); outline-offset: 3px; }
.contact-study b, .contact-study i, .contact-study em, .contact-study u, .contact-study span { margin: 0; }
.contact-study h1, .contact-study h2 { font-optical-sizing: auto; }

/* Shared shapes (mirroring the home study's component vocabulary). */
.contact-study .eyebrow {
  margin: 0 0 .5rem;
  font: 700 var(--eyebrow-size)/1.5 var(--mono);
  letter-spacing: .22em; text-transform: uppercase;
}
.contact-study .eyebrow.ink { color: var(--teal); }
.contact-study .mono-label { margin: 0; font: 700 var(--eyebrow-size)/1.5 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.contact-study .edge { height: 120px; }
.contact-study .wave-top { top: 1px; transform: translateY(-99%); height: 96px; }
.contact-study .wave-top path { fill: var(--paper); }

.contact-study .button {
  border: 1.5px solid currentColor;
  padding: .95rem 1.6rem;
  font: 700 .85rem var(--sans);
  transition: transform .25s ease, background .25s ease, color .25s ease;
}
.contact-study .button:hover { transform: translateY(-2px); }
.contact-study .button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.contact-study .button.primary:hover { background: var(--brand-red); border-color: var(--brand-red); }

/* Hero — paper intro, set like the home page's statement section. */
.contact-study .contact-hero {
  padding: clamp(5rem, 8vw, 8rem) var(--pad-x) clamp(4rem, 7vw, 6.5rem);
  background: var(--paper);
}
.contact-study .hero-inner {
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 400px);
  gap: var(--space-12);
  align-items: center;
}
.contact-study .contact-hero h1 {
  margin: var(--space-6) 0 var(--space-8);
  font: 340 clamp(2.8rem, 4.7vw, 4.6rem)/1.06 var(--display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.contact-study .hero-accent { font-style: italic; color: var(--brand-red); }
.contact-study .hero-copy {
  max-width: 52ch;
  /* Muted ink arrives as the text-muted utility in template.php, resolving
     through the bridge to --ink-soft — identical to the previous declaration. */
  font: 400 var(--copy-size)/1.55 var(--sans);
}
.contact-study .hero-copy p { margin: 0 0 var(--space-6); }
.contact-study .hero-copy p:last-child { margin-bottom: 0; }
.contact-study .hero-copy em { font-style: italic; color: var(--brand-red); }
.contact-study .hero-copy strong {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(transparent 65%, color-mix(in srgb, var(--brand-red-soft) 25%, transparent) 65% 92%, transparent 92%);
}
/* Handwritten aside — the shell's Caveat, used the way the home page's
   sticky-note sketches speak. Rotation uses the `rotate` property so the
   reveal transform never flattens it. */
.contact-study .hand-note {
  margin: var(--space-12) 0 0;
  font: 600 1.45rem/1.25 var(--hand);
  color: color-mix(in srgb, var(--ink) 62%, var(--paper));
  rotate: -1.75deg;
  transform-origin: left center;
}
/* Hero doodle — hand-drawn spot illustration. An empty hero_image slot keeps
   the built-in pencil doodle; uploading an illustration replaces it. Slightly
   rotated like a scrapbook find. Rotation uses the `rotate` property so the
   reveal transform never flattens it. */
.contact-study .hero-doodle {
  position: relative;
  justify-self: center;
  width: min(100%, 380px);
  rotate: -2deg;
}
.contact-study .hero-doodle .doodle-art { display: block; width: 100%; height: auto; }
/* Single-weight, round-capped hand strokes — the doodle's whole vocabulary. */
.contact-study .hero-doodle svg path {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.contact-study .hero-doodle .d-ink  { stroke: var(--ink); }
.contact-study .hero-doodle .d-soft { stroke: color-mix(in srgb, var(--ink) 55%, var(--paper)); }
.contact-study .hero-doodle .d-red  { stroke: var(--brand-red-soft); }
.contact-study .hero-doodle .d-stamp {
  fill: color-mix(in srgb, var(--acid) 55%, var(--paper-2));
  stroke: var(--ink);
}
.contact-study .hero-doodle .d-seal {
  fill: color-mix(in srgb, var(--brand-red-soft) 78%, var(--paper-2));
  stroke: var(--ink);
}

/* Desk — the dark band: direct details on the left, the working form on a
   pinned note on the right. Same layering as the home counter section. */
.contact-study .contact-desk {
  padding: clamp(5rem, 8vw, 8rem) var(--pad-x) clamp(7rem, 11vw, 10rem);
  background: var(--dark);
  color: var(--paper);
  box-shadow: 0 -24px 42px rgba(40, 40, 35, .12);
}
.contact-study .desk-layout {
  max-width: 1100px;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: var(--space-8) clamp(3rem, 7vw, 7rem);
}
.contact-study .desk-direct .mono-label { color: var(--brand-red-soft); }
.contact-study .desk-headline-wrap {
  margin: var(--space-4) 0 var(--space-8);
  font: italic 300 clamp(2rem, 3.6vw, 3.2rem)/1.08 var(--display);
  letter-spacing: -.02em;
  color: var(--paper);
  text-wrap: balance;
}
.contact-study .desk-details { display: grid; }
.contact-study .detail-row {
  padding: var(--space-4) 0;
  border-top: 1px solid rgba(255, 255, 255, .14);
}
.contact-study .detail-row:last-child { border-bottom: 1px solid rgba(255, 255, 255, .14); }
.contact-study .detail-label {
  margin: 0 0 .35rem;
  font: 700 var(--eyebrow-size)/1.5 var(--mono);
  letter-spacing: .18em; text-transform: uppercase;
  color: color-mix(in srgb, var(--paper) 55%, var(--dark));
}
.contact-study .detail-value { color: var(--paper); font-size: var(--copy-size); }

/* The form as a note pinned to the dark wall: slight rotation, drop shadow,
   a strip of tape — the sketch-table's framing, restated. */
.contact-study .form-card {
  position: relative;
  padding: clamp(1.75rem, 4vw, 3rem);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  transform: rotate(-.75deg);
  box-shadow: 0 42px 90px rgba(0, 0, 0, .46);
}
.contact-study .form-card::before {
  content: "";
  position: absolute;
  top: -14px; left: 50%;
  width: 124px; height: 34px;
  transform: translateX(-50%) rotate(-2deg);
  background: color-mix(in srgb, var(--acid) 42%, transparent);
  border-left: 1px solid rgba(255, 255, 255, .35);
  border-right: 1px solid rgba(40, 40, 35, .06);
  box-shadow: 0 3px 6px rgba(0, 0, 0, .12);
}
.contact-study .form-card h2 {
  margin: 1rem 0 1.6rem;
  font: 400 clamp(2rem, 3.2vw, 2.7rem)/1.05 var(--display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.contact-study .form-note {
  margin: var(--space-6) 0 0;
  font-size: .8125rem;
  line-height: 1.6;
  color: var(--gray);
}

/* Restyle the Form Builder WC markup inside the note only. Selectors keep
   #fb-pluginform to out-specify the plugin's dated frontend defaults; the
   submit rules need !important where the plugin used it. */
.contact-study .form-card #fb-pluginform {
  max-width: none;
  margin: 0;
  font-family: var(--sans);
}
/* Match the full-width fields instead of the plugin's default 94% row. */
.contact-study .form-card #fb-pluginform .fb-row {
  width: 100%;
}
.contact-study .form-card #fb-pluginform .formbuilder-field-area {
  width: 100%;
  margin: 0 0 var(--space-6);
  padding: 0;
}
.contact-study .form-card #fb-pluginform .formbuilder-field-area label {
  display: block;
  margin: 0 0 .45rem;
  padding: 0;
  font: 700 var(--eyebrow-size)/1.5 var(--mono);
  letter-spacing: .16em; text-transform: uppercase;
  color: var(--teal);
}
.contact-study .form-card #fb-pluginform input[type="text"],
.contact-study .form-card #fb-pluginform input[type="email"],
.contact-study .form-card #fb-pluginform input[type="tel"],
.contact-study .form-card #fb-pluginform select,
.contact-study .form-card #fb-pluginform textarea {
  width: 100%;
  font: 500 1rem/1.4 var(--sans);
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .8rem 1rem;
  transition: border-color .2s ease, background-color .2s ease, box-shadow .2s ease;
}
.contact-study .form-card #fb-pluginform input:hover,
.contact-study .form-card #fb-pluginform select:hover,
.contact-study .form-card #fb-pluginform textarea:hover { border-color: var(--ink-soft); }
.contact-study .form-card #fb-pluginform input:focus,
.contact-study .form-card #fb-pluginform select:focus,
.contact-study .form-card #fb-pluginform textarea:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-red-soft) 22%, transparent);
}
.contact-study .form-card #fb-pluginform textarea { height: 150px; resize: vertical; }
.contact-study .form-card #fb-pluginform input[type="submit"] {
  display: inline-block;
  width: auto !important;
  min-width: 0;
  margin: var(--space-4) 0 0;
  padding: .95rem 1.6rem;
  background: var(--ink) !important;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: #fff;
  font: 700 .85rem var(--sans);
  letter-spacing: .02em;
  cursor: pointer;
  transition: transform .25s ease, background-color .25s ease, border-color .25s ease;
}
.contact-study .form-card #fb-pluginform input[type="submit"]:hover,
.contact-study .form-card #fb-pluginform input[type="submit"]:focus-visible {
  transform: translateY(-2px);
  background: var(--brand-red) !important;
  border-color: var(--brand-red);
}
.contact-study .form-card #fb-pluginform input[type="submit"]:focus-visible { outline: 2px solid var(--brand-red); outline-offset: 3px; }
.contact-study .form-card #fb-pluginform .error { color: var(--brand-red); font: 600 .8125rem/1.5 var(--sans); }
.contact-study .form-card #fb-pluginform .php-errors,
.contact-study .form-card #fb-pluginform .success-notification {
  max-width: none;
  margin: 0 0 var(--space-6);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  font: 500 .875rem/1.6 var(--sans);
  text-align: left;
}
.contact-study .form-card #fb-pluginform .php-errors { border-color: color-mix(in srgb, var(--brand-red) 35%, var(--line)); }
.contact-study .form-card #fb-pluginform .success-notification { border-color: color-mix(in srgb, var(--teal) 40%, var(--line)); }

/* Close — paper section swept in over the desk by the torn-paper wave. */
.contact-study .contact-close {
  padding: clamp(7rem, 11vw, 10rem) var(--pad-x) clamp(7rem, 10vw, 9rem);
  background: var(--paper);
}
.contact-study .close-inner { max-width: 1180px; }
.contact-study .contact-close h2 {
  margin: var(--space-6) 0 var(--space-8);
  font: 400 clamp(2.8rem, 4.7vw, 4.6rem)/1.06 var(--display);
  letter-spacing: -.03em;
  text-wrap: balance;
}
.contact-study .close-copy {
  max-width: 52ch;
  /* Same text-muted bridge as .hero-copy. */
  font: 400 var(--copy-size)/1.55 var(--sans);
}
.contact-study .close-copy p { margin: 0 0 var(--space-6); }
.contact-study .close-copy p:last-child { margin-bottom: 0; }
.contact-study .close-copy em { font-style: italic; color: var(--brand-red); }

/* Reveal-on-scroll — motion.js adds .contact-js and the observer; without
   it (canvas, no-JS, reduced motion) everything stays visible. */
.contact-js .contact-study .reveal { opacity: 0; transform: translateY(30px); transition: opacity .8s cubic-bezier(.2, .6, .2, 1), transform .8s cubic-bezier(.2, .6, .2, 1); transition-delay: var(--d, 0s); }
.contact-js .contact-study .reveal.is-visible { opacity: 1; transform: none; }

@media (max-width: 900px) {
  .contact-study .desk-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-12); }
  .contact-study .hero-inner { grid-template-columns: minmax(0, 1fr); gap: var(--space-8); }
  .contact-study .hero-doodle { justify-self: start; width: min(78%, 300px); }
}
@media (max-width: 760px) {
  .contact-study { --nav-h: 58px; }
  .contact-study .edge { height: 70px; }
  .contact-study .form-card { transform: none; }
  .contact-study .hero-doodle { width: min(84%, 270px); }
}

@media (prefers-reduced-motion: reduce) {
  .contact-study { scroll-behavior: auto; }
  .contact-js .contact-study .reveal { opacity: 1; transform: none; transition: none; }
}