/* ============================================================
   Wirefield — independent practice homepage
   Palette: deep navy field / ice text / blue moving wireframe grid
   The animated grid (script.js) paints the canvas background;
   --grid-* variables are the grid's single source of truth.
   ============================================================ */

:root {
  /* page */
  --bg: #0a1424;
  --text: #e9effa;
  --text-soft: #b3c2da;
  --text-faint: #7e92b4;
  --accent: #79a7ff;        /* routes, links */
  --accent-bright: #a5c4ff; /* hover */
  --hairline: rgba(122, 158, 225, 0.34);

  /* wirefield grid (read by script.js) — re-tint the whole
     background from these four values */
  --grid-bg-top: #050b16;
  --grid-bg-bottom: #0c1a33;
  --grid-line: #6e9ef0;
  --grid-node: #cfe1ff;

  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;

  --pad-x: clamp(24px, 5.2vw, 84px);
  --pad-y: clamp(18px, 3.2vh, 34px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-serif);
  font-optical-sizing: auto;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible,
.route:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 4px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 10px 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--accent-bright);
  transform: translateY(-160%);
}

.skip-link:focus { transform: translateY(0); }

::selection {
  background: rgba(121, 167, 255, 0.28);
}

/* ============================================================
   Background layer: wirefield web
   ============================================================ */

.grid-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  display: block;
  pointer-events: none;
}

.motion-toggle {
  display: none;
  position: fixed;
  right: var(--pad-x);
  bottom: 18px;
  z-index: 5;
  padding: 7px 11px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: rgba(10, 20, 36, 0.88);
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.motion-ready .motion-toggle { display: block; }
.motion-toggle:hover { color: var(--text); border-color: var(--accent); }
.motion-toggle:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }

/* ============================================================
   Hero
   ============================================================ */

.stage {
  position: relative;
  z-index: 3;
  min-height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  isolation: isolate;
}

/* ---------- header ---------- */

.top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: var(--pad-y) var(--pad-x);
}

.brand {
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

.mark {
  display: inline-flex;
  align-items: center;
}

/* the DRE badge logo (white on transparent, assets/logo-dre.png) */
.mark-logo {
  display: block;
  height: clamp(28px, 2.4vw, 36px);
  width: auto;
  transition: filter 200ms ease;
}

.mark:hover .mark-logo { filter: brightness(1.3); }

.nav {
  display: flex;
  gap: clamp(18px, 2.4vw, 34px);
  font-size: clamp(13.5px, 1.05vw, 16px);
  letter-spacing: 0.01em;
  color: var(--text-soft);
}

.nav a {
  position: relative;
  padding: 9px 0;
  transition: color 180ms ease;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1px;
  background: var(--accent);
  transition: right 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.nav a:hover { color: var(--text); }
.nav a:hover::after { right: 0; }

.study {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 5px 12px 5px 10px;
  background: rgba(10, 20, 36, 0.72);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: clamp(12.5px, 0.95vw, 14.5px);
  color: var(--accent);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.study-rule {
  display: inline-block;
  width: clamp(28px, 3vw, 48px);
  height: 1px;
  background: var(--hairline);
  opacity: 0.9;
}

/* ---------- hero content (left) ---------- */

.content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 var(--pad-x);
  max-width: min(900px, 64vw);
}

.headline {
  margin: 0 0 clamp(18px, 3.4vh, 30px);
  font-size: clamp(38px, 4.8vw, 72px);
  line-height: 1.04;
  font-weight: 480;
  letter-spacing: -0.015em;
  color: var(--text);
  text-shadow: 0 2px 28px rgba(4, 10, 22, 0.6);
}

.lede {
  margin: 0 0 clamp(24px, 4vh, 42px);
  max-width: 54ch;
  font-size: clamp(16px, 1.25vw, 19px);
  line-height: 1.45;
  font-weight: 380;
  color: #d2deef;
  text-shadow: 0 1px 12px rgba(2, 7, 16, 0.95), 0 0 28px rgba(2, 7, 16, 0.75);
}

/* ---------- routes ---------- */

.routes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 760px;
  background: rgba(5, 11, 22, 0.66);
  border-top: 1px solid var(--hairline);
  border-left: 1px solid var(--hairline);
}

.route {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: clamp(13px, 1.9vh, 18px) 16px;
  border-right: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  color: var(--accent);
  font-size: clamp(19px, 1.7vw, 25px);
  font-weight: 420;
  letter-spacing: -0.01em;
  transition: color 180ms ease;
}

.route span {
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.route .arrow {
  flex: none;
  width: clamp(19px, 1.7vw, 26px);
  height: auto;
  color: var(--accent-bright);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1), color 180ms ease;
}

.route:hover { color: var(--accent-bright); }
.route:hover .arrow { transform: translate(5px, -5px); }
.route:active .arrow { transform: translate(2px, -2px); }

/* ---------- invite ---------- */

.invite {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: clamp(24px, 4vh, 42px) 0 0;
  font-size: clamp(15.5px, 1.35vw, 19px);
  color: var(--text);
}

.invite a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(122, 158, 225, 0.6);
  text-underline-offset: 5px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.invite a:hover {
  color: var(--accent-bright);
  text-decoration-color: var(--accent-bright);
}

.invite .arrow {
  width: 16px;
  height: auto;
  color: var(--accent);
  transition: transform 240ms cubic-bezier(0.22, 1, 0.36, 1);
}

.invite a:hover + .arrow { transform: translate(3px, -3px); }

/* Let the desktop hero follow its content. */
@media (min-width: 861px) {
  .stage {
    min-height: 0;
    grid-template-rows: auto auto;
  }

  .content {
    justify-content: flex-start;
    padding: clamp(12px, 2vh, 28px) var(--pad-x) clamp(64px, 8vh, 92px);
  }

}

/* ============================================================
   Scrolling sections
   ============================================================ */

.page {
  position: relative;
  z-index: 2;
}

.block {
  position: relative;
  padding: clamp(100px, 15vh, 170px) var(--pad-x);
}

.block-inner {
  max-width: min(640px, 44vw);
}

/* One quiet surface per section keeps the grid legible around the content. */
@media (min-width: 861px) {
  .block-inner {
    max-width: min(760px, 58vw);
    padding: clamp(24px, 2.8vw, 38px);
    background: rgba(5, 11, 22, 0.78);
    border: 1px solid rgba(122, 158, 225, 0.18);
  }
}

.kicker {
  margin: 0 0 18px;
  font-size: clamp(12.5px, 0.95vw, 14.5px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
}

.kicker::after {
  content: "";
  flex: 0 0 clamp(28px, 3vw, 48px);
  height: 1px;
  background: var(--hairline);
}

.block-title {
  margin: 0 0 clamp(28px, 5vh, 48px);
  font-size: clamp(26px, 3.4vw, 46px);
  line-height: 1.08;
  font-weight: 460;
  letter-spacing: -0.012em;
  text-shadow: 0 2px 24px rgba(4, 10, 22, 0.55);
}

.block-lede {
  margin: 0 0 20px;
  max-width: 46ch;
  font-size: clamp(16px, 1.35vw, 19px);
  line-height: 1.5;
  color: var(--text-soft);
  text-shadow: 0 1px 16px rgba(4, 10, 22, 0.5);
}

.block-lede.fine {
  font-size: clamp(14px, 1.1vw, 16px);
  color: var(--text-faint);
}

/* ---------- work (approach) entries ---------- */

.work {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(16px, 2vw, 30px);
  padding: clamp(22px, 3.6vh, 36px) 2px;
  border-top: 1px solid var(--hairline);
  scroll-margin-top: 24px;
}

.work:last-of-type {
  border-bottom: 1px solid var(--hairline);
}

.work-no {
  font-size: clamp(13px, 1vw, 15px);
  letter-spacing: 0.12em;
  color: var(--text-faint);
  padding-top: 6px;
}

.work h3 {
  margin: 0 0 10px;
  font-size: clamp(21px, 2.1vw, 29px);
  font-weight: 460;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.work p {
  margin: 0;
  max-width: 48ch;
  font-size: clamp(15.5px, 1.3vw, 18px);
  line-height: 1.5;
  color: var(--text-soft);
  text-shadow: 0 1px 16px rgba(4, 10, 22, 0.5);
}

/* ---------- contact ---------- */

.mail {
  display: inline-block;
  margin: 8px 0 10px;
  font-size: clamp(22px, 2.6vw, 34px);
  font-weight: 440;
  letter-spacing: -0.01em;
  color: var(--accent-bright);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(122, 158, 225, 0.55);
  text-underline-offset: 6px;
  transition: color 180ms ease, text-decoration-color 180ms ease;
}

.mail:hover {
  color: var(--text);
  text-decoration-color: var(--accent-bright);
}

.fineprint {
  margin: 0;
  font-size: clamp(13px, 1vw, 15px);
  color: var(--text-faint);
}

.contact-pending {
  margin: 8px 0 10px;
  font-size: clamp(16px, 1.35vw, 19px);
  color: var(--text-soft);
}

.contact-panel { margin-top: 30px; max-width: 690px; }
.contact-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
  border-bottom: 1px solid var(--hairline);
  color: var(--accent-bright);
  font-size: clamp(21px, 2.5vw, 30px);
  cursor: pointer;
  list-style: none;
}
.contact-panel summary::marker { content: ""; }
.contact-panel summary::-webkit-details-marker { display: none; }
.disclosure-chevron {
  width: 20px;
  height: 20px;
  flex: none;
  transition: transform 180ms ease;
}
.contact-panel[open] .disclosure-chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) {
  .disclosure-chevron { transition: none; }
}
.contact-panel summary:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 4px; }
.contact-panel .contact-form { margin-top: 24px; }

.contact-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 22px;
  margin: 34px 0 22px;
  max-width: 690px;
}

.form-row { display: flex; flex-direction: column; gap: 8px; }
.form-row-wide, .form-privacy { grid-column: 1 / -1; }
.form-row label { color: var(--text-soft); font-size: 15px; }
.optional { color: var(--text-faint); font-size: 13px; }
.form-row input, .form-row textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  background: rgba(5, 11, 22, 0.84);
  color: var(--text);
  font: inherit;
  font-size: 17px;
}
.form-row textarea { resize: vertical; min-height: 150px; }
.form-row input:focus-visible, .form-row textarea:focus-visible, .form-submit:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 2px;
}
.form-privacy { margin: 2px 0 0; color: var(--text-soft); font-size: 14px; }
.form-privacy a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 3px; }
.form-submit {
  justify-self: start;
  padding: 12px 18px;
  border: 1px solid var(--accent);
  border-radius: 4px;
  background: rgba(79, 127, 213, 0.16);
  color: var(--text);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}
.form-submit { display: inline-flex; align-items: center; gap: 9px; }
.form-submit .arrow { width: 18px; height: 18px; flex: none; transition: transform .25s ease; }
.form-submit:hover { background: rgba(79, 127, 213, 0.29); }
.form-submit:hover .arrow { transform: translate(4px, -4px); }
.form-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 600px) {
  .contact-form { grid-template-columns: 1fr; gap: 17px; }
}

/* ---------- footer ---------- */

.foot {
  position: relative;
  padding: 0 var(--pad-x) clamp(40px, 6vh, 64px);
  max-width: min(700px, 44vw);
}

.foot p {
  margin: 0;
  font-size: clamp(12.5px, 1.05vw, 15px);
  letter-spacing: 0.015em;
  color: var(--text-faint);
  text-shadow: 0 1px 14px rgba(4, 10, 22, 0.5);
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  margin-top: 20px;
  font-size: 14px;
  color: var(--text-soft);
}

.legal-nav a { text-decoration: underline; text-underline-offset: 4px; }
.legal-nav a:hover { color: var(--text); }

.legal-page {
  min-height: 100vh;
  background: var(--bg);
}

.legal-header,
.legal-document {
  width: min(100% - 2 * var(--pad-x), 760px);
  margin-inline: auto;
}

.legal-header { padding-top: 28px; }
.legal-header a { color: var(--accent-bright); text-decoration: underline; text-underline-offset: 4px; }
.legal-document { padding-block: clamp(48px, 10vh, 96px); }
.legal-document h1 { margin: 0 0 48px; font-size: clamp(38px, 6vw, 68px); line-height: 1.1; }
.legal-document h2 { margin: 40px 0 12px; font-size: clamp(22px, 3vw, 30px); }
.legal-document p { max-width: 68ch; color: var(--text-soft); line-height: 1.65; overflow-wrap: anywhere; }
.legal-document a { color: var(--accent-bright); text-decoration: underline; }

/* ============================================================
   Entrance + reveal
   ============================================================ */

@media (prefers-reduced-motion: no-preference) {
  .content > * {
    animation: rise 700ms cubic-bezier(0.22, 1, 0.36, 1) backwards;
  }
  .content > *:nth-child(1) { animation-delay: 60ms; }
  .content > *:nth-child(2) { animation-delay: 140ms; }
  .content > *:nth-child(3) { animation-delay: 220ms; }
  .content > *:nth-child(4) { animation-delay: 300ms; }

  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* scroll reveal (toggled by script.js) */
  .motion-ready .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 650ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 650ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  .motion-ready .reveal.in {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Approximate the balance of 90% browser zoom on desktop while retaining
   normal browser zoom and the existing mobile layout. */
@media (min-width: 861px) {
  :root {
    --pad-x: clamp(22px, 4.7vw, 76px);
    --pad-y: clamp(16px, 2.9vh, 31px);
  }

  .mark-logo { height: clamp(26px, 2.16vw, 32px); }
  .brand { gap: clamp(22px, 3.6vw, 50px); }
  .nav { gap: clamp(16px, 2.16vw, 31px); font-size: clamp(14px, 1vw, 16px); }
  .study { font-size: clamp(13px, 0.92vw, 14px); padding: 4px 11px 4px 9px; }

  .content {
    max-width: min(810px, 58vw);
    padding-top: clamp(11px, 1.8vh, 25px);
    padding-bottom: clamp(58px, 7.2vh, 83px);
  }
  .headline { font-size: clamp(35px, 4.32vw, 65px); margin-bottom: clamp(16px, 3.1vh, 27px); }
  .lede { font-size: clamp(15.5px, 1.16vw, 18px); margin-bottom: clamp(22px, 3.6vh, 38px); }
  .routes { max-width: 684px; }
  .route { font-size: clamp(18px, 1.53vw, 22.5px); padding: clamp(12px, 1.7vh, 16px) 14px; }
  .invite { font-size: clamp(15px, 1.22vw, 17.5px); margin-top: clamp(22px, 3.6vh, 38px); }

  .block { padding: clamp(56px, 8vh, 88px) var(--pad-x); }
  .block-inner { max-width: min(684px, 52vw); padding: clamp(30px, 3vw, 46px); }
  .kicker { font-size: clamp(13px, 0.92vw, 14px); margin-bottom: 16px; }
  .block-title { font-size: clamp(25px, 3.06vw, 42px); margin-bottom: clamp(25px, 4.5vh, 43px); }
  .block-lede { font-size: clamp(15.5px, 1.22vw, 18px); }
  .work { padding: clamp(20px, 3.2vh, 32px) 2px; }
  .work h3 { font-size: clamp(20px, 1.89vw, 26px); }
  .work p { font-size: clamp(15px, 1.2vw, 17px); }
  .contact-panel summary { font-size: clamp(20px, 2.25vw, 27px); }
  .contact-form { gap: 16px 20px; }
  .form-row input, .form-row textarea { font-size: 16px; padding: 11px 13px; }
  .form-submit { font-size: 16px; padding: 11px 16px; }
}

/* ============================================================
   Small screens
   ============================================================ */

@media (max-width: 860px) {
  .stage {
    min-height: 0;
  }

  /* Keep the fixed wirefield steady as mobile browser chrome expands or retracts. */
  .grid-canvas { height: 100vh; }
  @supports (height: 100lvh) {
    .grid-canvas { height: 100lvh; }
  }

  .stage::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(
      to bottom,
      rgba(6, 13, 24, 0.78) 0%,
      rgba(6, 13, 24, 0.66) 55%,
      rgba(6, 13, 24, 0.58) 100%
    );
  }

  .top { flex-wrap: wrap; row-gap: 14px; }
  .study {
    order: 3;
    width: 100%;
    justify-content: center;
    font-size: 12.5px;
  }

  .content {
    max-width: none;
    justify-content: flex-start;
    padding: clamp(28px, 4vh, 42px) var(--pad-x) 28px;
  }

  .lede { margin-bottom: 22px; }
  .invite { margin-top: 24px; }
  .motion-toggle {
    position: static;
    align-self: flex-end;
    margin-top: 16px;
    font-size: 12px;
  }

  .block {
    padding: clamp(38px, 6vh, 64px) var(--pad-x);
  }

  .stage + .page > .block:first-child { padding-top: clamp(44px, 6vh, 64px); }

  .block-inner {
    max-width: none;
    background: linear-gradient(rgba(8, 16, 30, 0.91), rgba(8, 16, 30, 0.88));
    padding: clamp(24px, 3.5vh, 32px) clamp(18px, 5vw, 22px);
  }

  .foot {
    max-width: none;
  }

  .foot p {
    background: rgba(8, 16, 30, 0.88);
    padding: 16px clamp(18px, 5vw, 22px);
  }
}

@media (max-width: 480px) {
  .brand { gap: 12px; }
  .nav { gap: 10px; }
  .nav a { font-size: 12px; }
  .headline { font-size: clamp(36px, 9vw, 48px); }
  .lede { font-size: 16px; }
  .routes { grid-template-columns: 1fr; }
  .route { font-size: 20px; padding: 11px 18px; }
  .study { display: none; }
}
