/* Keith Miller Law prototype stylesheet.
   Editorial family per Site Templater rules, de-fingerprinted:
   cool paper (not cream), Source Serif 4 (not Fraunces), steel-blue accent
   from the existing brand (not brass). One accent, squared buttons. */

:root {
  --canvas: #F2F2EF;
  --panel: #E9EAE5;
  --text: #1C1D1F;
  --ink: #0F2440;
  --ink-soft: rgba(15, 36, 64, 0.85);
  --accent: #005F97;
  --accent-deep: #094D77;
  --rule: #D8D9D2;
  --on-ink: #EDEEEA;
  --on-ink-muted: #A9B4C2;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;
  --measure: 62ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}

/* footer sits at the viewport bottom even on short pages */
main { flex: 1 0 auto; display: flex; flex-direction: column; }
main > * { flex: 0 0 auto; }

::selection { background: rgba(0, 95, 151, 0.18); }

img { max-width: 100%; display: block; }

a { color: var(--accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 0;
}

/* on dark bands the accent ring is invisible; use the light ink */
.contact-band :focus-visible,
.site-footer :focus-visible,
.skip-link:focus-visible { outline-color: var(--on-ink); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--on-ink);
  padding: 10px 18px;
  z-index: 20;
}
.skip-link:focus { left: 12px; top: 12px; }

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(20px, 4vw, 48px);
}

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

.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--canvas);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-top: 22px;
  padding-bottom: 22px;
  flex-wrap: wrap;
}

.wordmark { text-decoration: none; color: var(--ink); }
.wordmark .name {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: block;
  line-height: 1.15;
}
.wordmark .descriptor {
  font-size: 0.78rem;
  color: var(--text);
  opacity: 0.72;
  display: block;
  margin-top: 2px;
}
.wordmark:hover .name { color: var(--accent-deep); }

.site-nav { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 30px); flex-wrap: wrap; }

.site-nav > a,
.nav-drop summary {
  font-size: 0.95rem;
  font-weight: 500;
  padding: 10px 0;
  border-bottom: 2px solid transparent;
}
.site-nav > a {
  text-decoration: none;
  color: var(--text);
}
.site-nav > a:hover { border-bottom-color: var(--accent); }
.site-nav > a[aria-current="page"] { border-bottom-color: var(--ink); }

/* practice-areas dropdown, no JS */
.nav-drop { position: relative; }
.nav-drop summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-drop summary::-webkit-details-marker { display: none; }
.nav-drop summary:hover { border-bottom-color: var(--accent); }
.nav-drop[data-active] summary { border-bottom-color: var(--ink); }
.nav-drop svg { width: 10px; height: 10px; }
.nav-drop[open] svg { transform: rotate(180deg); }

.nav-drop .drop-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
  background: var(--canvas);
  border: 1px solid var(--rule);
  box-shadow: 0 10px 28px rgba(15, 36, 64, 0.10);
  padding: 8px 0;
  z-index: 10;
}
.nav-drop .drop-panel a {
  display: block;
  padding: 10px 20px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.95rem;
}
.nav-drop .drop-panel a:hover { background: var(--panel); color: var(--ink); }
.nav-drop .drop-panel a[aria-current="page"] { color: var(--accent-deep); font-weight: 600; }

/* ---------- shared type ---------- */

.eyebrow {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  margin: 0 0 14px;
}

h1, h2, h3 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 600;
  line-height: 1.12;
  margin: 0;
}

h1 { font-size: clamp(2.3rem, 5.5vw, 3.6rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.22rem; }

.lead {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 2vw, 1.35rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: var(--measure);
}

p { max-width: var(--measure); }

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--on-ink);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 14px 26px;
  border: 1px solid var(--ink);
}
.btn:hover { background: var(--ink-soft); color: var(--on-ink); }

.on-dark .btn {
  background: var(--on-ink);
  color: var(--ink);
  border-color: var(--on-ink);
}
.on-dark .btn:hover { background: transparent; color: var(--on-ink); }

.arrow-link {
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 2px;
}
.arrow-link svg { width: 12px; height: 12px; transition: transform 220ms ease; }
.arrow-link:hover svg { transform: translateX(3px); }
.arrow-link:hover { color: var(--accent-deep); border-bottom-color: var(--accent-deep); }

/* ---------- motion system (templater animation playbook) ----------
   Resting state stays visible: scroll fade-up only inside the
   scroll-timeline @supports block; load entrances are plain CSS
   animations with a both-fill, so no JS is ever required to reveal. */

@keyframes fx-rise {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fx-rise-blur {
  from { opacity: 0; transform: translateY(18px); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fx-media {
  from { opacity: 0; transform: scale(1.055); }
  to   { opacity: 1; transform: none; }
}
@keyframes fx-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* on-load entrance, staggered (text gets the blur-in, per playbook) */
.fx { animation: fx-rise-blur 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; }
.fx-d1 { animation-delay: 0.08s; }
.fx-d2 { animation-delay: 0.2s; }
.fx-d3 { animation-delay: 0.34s; }
.fx-d4 { animation-delay: 0.48s; }
.fx-media { animation: fx-media 1.5s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* scroll-driven section reveal; unsupported browsers just see content */
@supports (animation-timeline: view()) {
  .reveal {
    animation: fx-rise 1s cubic-bezier(0.16, 1, 0.3, 1) both;
    animation-timeline: view();
    animation-range: entry 0% entry 60%;
  }
}

/* selective reduced motion: keep the gentle fades, drop movement and blur */
@media (prefers-reduced-motion: reduce) {
  .fx, .fx-media { animation-name: fx-fade; }
  @supports (animation-timeline: view()) {
    .reveal { animation-name: fx-fade; }
  }
}

/* ---------- hero ---------- */

.hero { padding: clamp(56px, 9vw, 110px) 0 clamp(40px, 6vw, 72px); }

/* dark full-bleed hero (home): duotone montage under ink */
.hero-dark {
  position: relative;
  background: var(--ink);
  color: var(--on-ink);
  overflow: hidden;
  padding: clamp(72px, 11vw, 150px) 0 clamp(56px, 8vw, 104px);
}
.hero-media {
  position: absolute;
  inset: 0;
}
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1);
  opacity: 0.32;
}
.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, rgba(15, 36, 64, 0.95) 20%, rgba(15, 36, 64, 0.62) 62%, rgba(15, 36, 64, 0.85) 100%);
}
.hero-dark .wrap { position: relative; }
.hero-dark h1 { color: var(--on-ink); }
.hero-dark .eyebrow { color: #8FB6D4; }
.hero-dark .lead { color: rgba(237, 238, 234, 0.86); }
.hero-dark .hero-aside { border-left-color: rgba(237, 238, 234, 0.25); color: var(--on-ink); }
.hero-dark .hero-aside .hero-fact { color: var(--on-ink); border-bottom-color: rgba(237, 238, 234, 0.22); }
.hero-dark .hero-aside .hero-fact:last-child { border-bottom: none; }
.hero-dark .arrow-link { color: var(--on-ink); border-bottom-color: var(--on-ink); }
.hero-dark .arrow-link:hover { color: #8FB6D4; border-bottom-color: #8FB6D4; }
.hero-dark :focus-visible { outline-color: var(--on-ink); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: end;
}

.hero .lead { margin: 26px 0 0; }
.hero .hero-actions { margin-top: 34px; display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }

.hero-aside {
  border-left: 1px solid var(--rule);
  padding-left: clamp(20px, 2.5vw, 36px);
  font-size: 0.95rem;
  color: var(--text);
}
.hero-aside ul { list-style: none; margin: 0; padding: 0; }
.hero-aside .hero-fact {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
  font-weight: 600;
  color: var(--ink);
}
.hero-aside .hero-fact:last-child { border-bottom: none; }

/* ---------- wide figure band ---------- */

.figure-band { padding: clamp(24px, 4vw, 56px) 0; }
.figure-band figure { margin: 0; }
.figure-band .duotone {
  position: relative;
  overflow: hidden;
}
.figure-band .duotone img {
  width: 100%;
  height: auto;
  filter: grayscale(1);
}
.figure-band .duotone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  mix-blend-mode: color;
  pointer-events: none;
}
/* ---------- prose section ---------- */

.section { padding: clamp(48px, 7vw, 96px) 0; }
.section + .section { border-top: 1px solid var(--rule); }

.prose-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(28px, 5vw, 80px);
}
.prose-grid h2 { max-width: 14ch; }
.prose-body p { margin: 0 0 1.35em; }
.prose-body p:last-child { margin-bottom: 0; }

/* ---------- numbered practice rows ---------- */

.practice-rows { margin-top: clamp(32px, 4vw, 56px); }

.practice-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 5fr) minmax(0, 6fr) auto;
  gap: clamp(16px, 3vw, 40px);
  align-items: baseline;
  padding: clamp(24px, 3vw, 36px) 0;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: var(--text);
}
.practice-row:last-child { border-bottom: 1px solid var(--rule); }

.practice-row .num {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--accent-deep);
}
.practice-row h3 {
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  transition: color 160ms ease;
}
.practice-row:hover h3 { color: var(--accent-deep); }
.practice-row .row-meta {
  font-size: 0.92rem;
  color: var(--text);
  opacity: 0.75;
  margin: 0;
}
.practice-row .row-go { justify-self: end; }
.practice-row .row-go svg { width: 12px; height: 12px; color: var(--ink); transition: transform 220ms ease; }
.practice-row:hover .row-go svg { transform: translateX(4px); color: var(--accent-deep); }

/* ---------- dark contact band ---------- */

.contact-band {
  background: var(--ink);
  color: var(--on-ink);
  padding: clamp(56px, 8vw, 100px) 0;
}
.contact-band .eyebrow { color: var(--on-ink-muted); }
.contact-band h2 { color: var(--on-ink); }
.contact-band p { color: var(--on-ink-muted); margin: 18px 0 0; }
.contact-band .band-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
.contact-band .band-action { justify-self: start; }
@media (min-width: 761px) {
  .contact-band .band-action { justify-self: end; }
}

/* ---------- page-title header block ---------- */

.page-title { padding: clamp(48px, 7vw, 88px) 0 clamp(28px, 4vw, 48px); }
.page-title .lead { margin-top: 24px; }

.title-grid {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 3fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}
.title-grid .portrait {
  filter: grayscale(1);
  border: 1px solid var(--rule);
  width: min(300px, 100%);
  height: auto;
  justify-self: end;
}

/* ---------- credentials block (dl grid) ---------- */

.credentials { border-top: 1px solid var(--rule); }
.cred-row {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(20px, 4vw, 64px);
  padding: clamp(26px, 3.5vw, 40px) 0;
  border-bottom: 1px solid var(--rule);
}
.cred-row h2 { font-size: 1.05rem; letter-spacing: 0.01em; }
.cred-row ul { margin: 0; padding: 0; list-style: none; }
.cred-row li { padding: 7px 0; }
.cred-row li + li { border-top: 1px solid var(--rule); }
.cred-row .cred-note { margin: 0 0 10px; font-size: 0.97rem; }

/* ---------- matters ledger (practice pages) ---------- */

.ledger-section { padding: clamp(40px, 5vw, 64px) 0; }
.ledger-section + .ledger-section,
.page-title + .ledger-section { border-top: 1px solid var(--rule); }
.ledger-grid > div > p:first-child { margin-top: 0; }

.ledger-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(20px, 4vw, 64px);
}
.ledger-grid h2 { font-size: clamp(1.3rem, 2.4vw, 1.65rem); max-width: 16ch; position: sticky; top: 24px; }

.matters { margin: 0; padding: 0; list-style: none; }
.matters li { padding: 14px 0; max-width: 70ch; }
.matters li + li { border-top: 1px solid var(--rule); }

.topics {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: clamp(24px, 4vw, 56px);
  max-width: none;
}
.topics li {
  break-inside: avoid;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
}
.ledger-grid h3 { margin: 26px 0 8px; font-size: 1rem; }
.ledger-grid h3:first-child { margin-top: 0; }

/* ---------- sibling practice links ---------- */

.siblings { padding: clamp(40px, 5vw, 64px) 0; border-top: 1px solid var(--rule); }
.siblings-row { display: flex; gap: clamp(20px, 4vw, 48px); flex-wrap: wrap; margin-top: 22px; }

/* ---------- light closing CTA ---------- */

.cta-light {
  background: var(--panel);
  padding: clamp(48px, 6vw, 80px) 0;
}
.cta-light .cta-grid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  flex-wrap: wrap;
}
.cta-light p { margin: 10px 0 0; }

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

.contact-main {
  padding: clamp(48px, 7vw, 96px) 0;
  flex: 1 0 auto;
  display: flex;
  align-items: center;
}
.contact-main .wrap { width: 100%; }
.contact-email-big {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 3rem);
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 4px;
  display: inline-block;
  margin-top: 30px;
  overflow-wrap: anywhere;
}
.contact-email-big:hover { color: var(--accent-deep); }

.contact-facts { margin: clamp(36px, 5vw, 56px) 0 0; border-top: 1px solid var(--rule); max-width: 640px; }
.contact-facts > div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--rule);
}
.contact-facts dt {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  align-self: baseline;
}
.contact-facts dd { margin: 0; }

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

.site-footer {
  background: var(--ink);
  color: var(--on-ink-muted);
  padding: clamp(40px, 5vw, 64px) 0;
  font-size: 0.9rem;
}
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 28px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(237, 238, 234, 0.15);
}
.site-footer .fm-name {
  font-family: var(--serif);
  font-size: 1.15rem;
  color: var(--on-ink);
}
.site-footer nav { display: flex; gap: 22px; flex-wrap: wrap; }
.site-footer a { color: var(--on-ink-muted); text-decoration: none; display: inline-block; padding: 8px 0; }
.site-footer a:hover { color: var(--on-ink); text-decoration: underline; }
.footer-bottom { padding-top: 24px; }
.footer-bottom p { margin: 0; max-width: none; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .hero-grid,
  .prose-grid,
  .title-grid,
  .ledger-grid,
  .contact-band .band-grid,
  .cred-row { grid-template-columns: 1fr; }

  .hero-aside { border-left: none; border-top: 1px solid var(--rule); padding-left: 0; padding-top: 20px; }
  .hero-dark .hero-aside { border-top-color: rgba(237, 238, 234, 0.25); }
  .title-grid .portrait { justify-self: start; }
  .ledger-grid h2 { position: static; }

  .practice-row { grid-template-columns: 44px 1fr; }
  .practice-row .row-meta { grid-column: 2; }
  .practice-row .row-go { display: none; }

  .topics { columns: 1; }
  .contact-facts > div { grid-template-columns: 1fr; gap: 4px; }
}

/* selective reduced motion: keep colour transitions, stop movement */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .arrow-link svg,
  .practice-row .row-go svg { transition: none; }
  .arrow-link:hover svg,
  .practice-row:hover .row-go svg { transform: none; }
}
