/* ── Nav height token ──────────────────────────────────────────────────── */

:root {
  --nav-h: 72px;
}

/* ── Base reset ────────────────────────────────────────────────────────── */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Body ──────────────────────────────────────────────────────────────── */

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.25s ease, color 0.25s ease;
}

/* ── Typography ────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.25;
  font-weight: 700;
}

h1 { font-size: clamp(2.2rem, 4.5vw, 3.4rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.8rem); }
h3 { font-size: 1.1rem; }

p { max-width: 64ch; }

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

em { font-style: italic; }
strong { font-weight: 600; }

/* ── Layout ────────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: 2rem;
}

/* ── Nav ───────────────────────────────────────────────────────────────── */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  transition: background 0.25s ease, border-color 0.25s ease;
  /* allows .name-panel-handle-wrapper to position below the bottom border */
  overflow: visible;
}

.site-nav__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--nav-h);
}

.nav-left {
  display: flex;
  align-items: center;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.site-nav__logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.site-nav__links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg);
  letter-spacing: 0.02em;
  opacity: 0.7;
  transition: opacity 0.15s;
  text-decoration: none;
}

.site-nav__links a:hover {
  opacity: 1;
  text-decoration: none;
}

.site-nav__links a.active {
  opacity: 1;
  color: var(--accent);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.theme-btn:hover {
  background: var(--rule);
  border-color: var(--accent);
}

.nav-connect-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1.125rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.nav-connect-btn:hover,
.nav-connect-btn.active {
  background: var(--btn-hover-bg);
  text-decoration: none;
}

/* ── Page header (inner pages) ─────────────────────────────────────────── */

.page-header {
  padding-block: clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
}

.page-header.compact {
  padding-block: clamp(1rem, 2vw, 1.5rem);
}

/* ── Hero (home page) ──────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(2rem, 5vw, 4rem);
  border-bottom: 1px solid var(--rule);
}

.hero-corner-grid {
  position: absolute;
  top: -24px;
  right: -24px;
  width: 340px;
  height: 340px;
  color: var(--accent);
  opacity: 0.07;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 80% at 90% 10%, rgba(0,0,0,0.9) 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 80% at 90% 10%, rgba(0,0,0,0.9) 0%, transparent 70%);
}

[data-theme="ww-dark"] .hero-corner-grid,
[data-theme="ww-high-contrast"] .hero-corner-grid,
[data-theme="celtic-dark"] .hero-corner-grid,
[data-theme="modern-dark"] .hero-corner-grid,
[data-theme="tiger-dark"] .hero-corner-grid,
[data-theme="oriole-dark"] .hero-corner-grid,
[data-theme="raven-dark"] .hero-corner-grid {
  opacity: 0.1;
}

.hero-tag {
  position: relative;
  z-index: 1;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 1.5rem;
}

.hero-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 4vw, 4rem);
  align-items: start;
}

.hero-body h1 {
  max-width: 18ch;
}

.hero-right {
  padding-top: 0.5rem;
}

/* ── Lead paragraph ────────────────────────────────────────────────────── */

.lead {
  font-size: 1.05rem;
  color: var(--fg-muted);
  line-height: 1.75;
  max-width: 52ch;
  margin-bottom: 2rem;
}

/* ── Section label ─────────────────────────────────────────────────────── */

.section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--rule);
}

.section-label-row {
  margin-bottom: 2rem;
}

/* ── Philosophy 2-col ──────────────────────────────────────────────────── */

.philosophy {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  padding-block: clamp(1.75rem, 4vw, 3rem);
  border-bottom: 1px solid var(--rule);
}

.philosophy h2 {
  font-size: 1.2rem;
  margin-bottom: 0.875rem;
}

.philosophy p {
  color: var(--fg-muted);
  line-height: 1.75;
  max-width: 38ch;
}

.philosophy p + p {
  margin-top: 0.75rem;
}

/* ── Services section ──────────────────────────────────────────────────── */

.services-section {
  padding-block: clamp(1.5rem, 3vw, 2.75rem);
  border-bottom: 1px solid var(--rule);
}

.services-section:last-of-type {
  border-bottom: none;
}

/* ── Service block (accordion) ─────────────────────────────────────────── */

.service-block {
  border-bottom: 1px solid var(--rule);
}

.service-block:last-of-type {
  border-bottom: none;
}

.service-block-head {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding-block: 1.5rem;
}

.service-block-num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  flex-shrink: 0;
  line-height: 1;
  margin-top: 0.2rem;
  min-width: 2rem;
}

.service-block h3 {
  margin-bottom: 0.4rem;
}

.service-block-lead {
  color: var(--fg-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 56ch;
}

.service-block-summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding-right: 2.5rem;
}

.service-block-summary::-webkit-details-marker {
  display: none;
}

.service-block-summary::after {
  content: '+';
  position: absolute;
  right: 0;
  top: 1.5rem;
  font-size: 1.5rem;
  font-weight: 300;
  color: var(--fg-muted);
  transition: transform 0.2s ease;
  line-height: 1;
}

details[open] .service-block-summary::after {
  transform: rotate(45deg);
}

.service-block-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-left: calc(2rem + 1.5rem);
  padding-bottom: 1.75rem;
}

.service-block-list li {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 0.875rem 1.125rem;
  background: var(--bg-card);
  font-size: 0.925rem;
  color: var(--fg-muted);
  line-height: 1.6;
}

.service-block-list li strong {
  display: block;
  color: var(--fg);
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.25rem;
}

/* ── SVC grid (home page 3-col) ────────────────────────────────────────── */

.svc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.svc-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  padding: 1.75rem 1.5rem;
}

.svc-card .num {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-style: italic;
  font-weight: 400;
  color: var(--accent);
  display: block;
  margin-bottom: 0.75rem;
}

.svc-card h3 {
  margin-bottom: 0.625rem;
}

.svc-card p {
  color: var(--fg-muted);
  font-size: 0.925rem;
  line-height: 1.65;
  max-width: none;
}

/* ── Offering card ─────────────────────────────────────────────────────── */

.offerings-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.offering-card {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  padding: 1.5rem 1.75rem;
}

.offering-card > h3 {
  margin-bottom: 0.625rem;
  font-size: 1.05rem;
}

.offering-lead {
  color: var(--fg-muted);
  font-size: 0.925rem;
  line-height: 1.7;
  margin-bottom: 0.875rem;
  max-width: 64ch;
}

.offering-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.offering-bullets li {
  font-size: 0.875rem;
  color: var(--fg-muted);
  padding-left: 1.25rem;
  position: relative;
  line-height: 1.55;
}

.offering-bullets li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.8rem;
}

/* ── Tech services sub-grid ────────────────────────────────────────────── */

.tech-services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.875rem;
  margin-top: 0.625rem;
}

.tech-sub-card {
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 1rem 1.125rem;
}

.tech-sub-card h3 {
  font-size: 0.75rem;
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.tech-sub-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.tech-sub-card ul li {
  font-size: 0.825rem;
  color: var(--fg-muted);
  padding-left: 1rem;
  position: relative;
  line-height: 1.5;
}

.tech-sub-card ul li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.7rem;
}

/* ── Section CTA link ──────────────────────────────────────────────────── */

.section-cta {
  text-align: center;
  padding-top: 1.5rem;
}

.cta {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.cta:hover { text-decoration: underline; }

/* ── Page CTA ──────────────────────────────────────────────────────────── */

.page-cta {
  text-align: center;
  padding-block: clamp(2rem, 5vw, 4rem);
}

.page-cta h2 {
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  max-width: 26ch;
  margin: 0 auto 1rem;
}

.page-cta p {
  color: var(--fg-muted);
  margin: 0 auto 2rem;
  max-width: 44ch;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn, .cta-btn {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: 0.75rem 1.875rem;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn:hover, .cta-btn:hover {
  background: var(--btn-hover-bg);
  text-decoration: none;
}

/* ── About page ────────────────────────────────────────────────────────── */

.about-block {
  margin-bottom: 2.5rem;
}

.about-block h3 {
  color: var(--fg);
  margin-bottom: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.04em;
}

.about-block p + p {
  margin-top: 0.875rem;
}

.about-block p {
  color: var(--fg-muted);
  line-height: 1.75;
}

.service-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.service-list li { color: var(--fg-muted); line-height: 1.65; }
.service-list em { color: var(--fg); font-style: italic; font-weight: 600; }

/* ── Rule / divider ────────────────────────────────────────────────────── */

hr.rule {
  border: none;
  border-top: 1px solid var(--rule);
  margin-block: 2.5rem;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.site-footer {
  padding-block: 2.5rem;
  border-top: 1px solid var(--rule);
}

.site-footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-footer__copy {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.site-footer__links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer__links a {
  font-size: 0.8rem;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.site-footer__links a:hover {
  color: var(--fg);
}

/* ── Dev theme switcher ────────────────────────────────────────────────── */

.theme-switcher {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  transition: background 0.25s ease, border-color 0.25s ease;
  cursor: default;
  user-select: none;
}

.theme-switcher__label { opacity: 0.6; }

.theme-switcher__select {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.2rem 0.4rem;
  font: inherit;
  font-size: 0.7rem;
  color: var(--fg);
  cursor: pointer;
  appearance: auto;
  transition: border-color 0.15s;
}

.theme-switcher__select:focus {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

.theme-switcher__mode-btn {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.2rem 0.5rem;
  font: inherit;
  font-size: 0.7rem;
  color: var(--fg);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.theme-switcher__mode-btn:hover {
  border-color: var(--accent);
}

.theme-switcher__mode-btn:focus {
  outline: 1px solid var(--accent);
  outline-offset: 1px;
}

/* ── Reveal animation ──────────────────────────────────────────────────── */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.d1 { transition-delay: 0.1s; }
.reveal.d2 { transition-delay: 0.2s; }
.reveal.d3 { transition-delay: 0.3s; }

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 960px) {
  .site-nav__links {
    gap: 1.5rem;
  }

  .site-nav__links a {
    font-size: 0.8rem;
  }

  .nav-connect-btn {
    padding: 0.4rem 0.875rem;
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  .hero-body {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .philosophy {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .svc-grid {
    grid-template-columns: 1fr;
  }

  .tech-services-grid {
    grid-template-columns: 1fr 1fr;
  }

  .service-block-list {
    margin-left: 0;
  }

  .site-nav__links {
    gap: 1.25rem;
  }
}

@media (max-width: 640px) {
  /* Single-row nav: logo left, buttons right; hide nav links */
  .site-nav__inner {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto;
    height: var(--nav-h);
    padding-block: 0;
  }

  .nav-left {
    display: none;
  }

  .nav-center {
    grid-column: 1;
    grid-row: 1;
    justify-content: flex-start;
    padding: 0;
  }

  .nav-right {
    grid-column: 2;
    grid-row: 1;
    position: static;
    transform: none;
  }

  /* Scale SVG wordmark to fit mobile viewport alongside nav buttons.
     aspect-ratio ensures height:auto resolves correctly in flex/grid context
     instead of collapsing to zero. */
  .site-nav__logo svg {
    width: min(calc(100vw - 160px), 280px) !important;
    height: auto !important;
    aspect-ratio: 530 / 72;
  }

  .hero-corner-grid {
    display: none;
  }
}

@media (max-width: 480px) {
  .container { padding-inline: 1.25rem; }

  .tech-services-grid {
    grid-template-columns: 1fr;
  }

  .page-cta { padding-block: 2rem; }
}

/* Tablet-only SVG logo constraint (641–768px).
   Uses width (not max-width) so aspect-ratio can resolve height.
   Narrowed to min-width: 641px to avoid conflicting with the ≤640px mobile
   rule which already sets an explicit width — at 375px, calc(100vw-380px)
   would be negative, collapsing the SVG to 0. */
@media (min-width: 641px) and (max-width: 768px) {
  .site-nav__logo svg {
    width: calc(100vw - 380px) !important;
    height: auto !important;
    aspect-ratio: 530 / 72;
  }
}

@media (max-width: 768px) {
  /* At tablet and below, nav-right is too narrow to stack mode picker without
     causing horizontal overflow. Revert to single row; move picker to fixed
     bottom pill so the nav grid stays within viewport width. */
  .nav-right.has-mode-picker {
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
  }

  /* display:contents unwraps the row so theme btn + connect btn are
     direct flex children of nav-right again */
  .mode-picker-row {
    display: contents;
  }

  .nav-right.has-mode-picker .mode-picker {
    position: fixed;
    bottom: 10px;
    top: auto;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    border-radius: 20px;
  }
}

/* ── A11y FAB + panel ──────────────────────────────────────────────────── */

.a11y-fab {
  position: fixed;
  bottom: 58px;
  right: 28px;
  z-index: 900;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transition: background 0.15s, transform 0.15s;
}

.a11y-fab:hover {
  background: var(--btn-hover-bg);
  transform: translateY(-1px);
}

.a11y-fab:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

.a11y-fab:active {
  transform: scale(0.94);
}

.a11y-panel {
  position: fixed;
  bottom: calc(58px + 48px + 14px);
  right: 28px;
  z-index: 901;
  width: min(320px, calc(100vw - 56px));
  background: var(--bg-card);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 20px 22px 22px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

/* Panel is locked to absolute px so large/readable toggles don't reflow it.
   contrast and still DO apply (intentional per spec §7). */
html.theme-a11y--large .a11y-panel,
html.theme-a11y--readable .a11y-panel {
  font-size: 16px !important;
  line-height: 1.5 !important;
}

html.theme-a11y--large .a11y-panel *,
html.theme-a11y--readable .a11y-panel * {
  font-family: 'Inter', system-ui, sans-serif !important;
}

.a11y-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.a11y-panel__title {
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}

.a11y-panel__close {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 1.35em;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
}

.a11y-panel__close:hover {
  color: var(--accent);
}

.a11y-panel__options {
  display: flex;
  flex-direction: column;
}

.a11y-panel__row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  cursor: pointer;
  padding: 5px 0;
  text-decoration: none !important;
  user-select: none;
}

.a11y-panel__row input[type="checkbox"] {
  width: 1em;
  height: 1em;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.a11y-panel__reset {
  display: inline-flex;
  align-items: center;
  margin-top: 16px;
  padding: 8px 14px;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none !important;
}

.a11y-panel__reset:hover {
  background: var(--accent);
  color: var(--btn-fg);
}

/* ── A11y mode effects ─────────────────────────────────────────────────── */

/* High contrast: override CSS tokens on html so all components that use
   these vars receive the contrast palette automatically. Panel inherits too —
   this is intentional (the panel uses var(--bg-card), var(--fg), etc.). */
html.theme-a11y--contrast {
  /* Mirror ww-high-contrast tokens so this class never overrides data-theme="ww-high-contrast" */
  --bg:           #0D0D0D;
  --bg-secondary: #1C1C1C;
  --bg-card:      #1C1C1C;
  --fg:           #FFFFFF;
  --fg-muted:     #CCCCCC;
  --accent:       #DF4601;
  --rule:         #2A2A2A;
  --nav-bg:       #0D0D0D;
  --nav-border:   #2A2A2A;
  --btn-bg:       #DF4601;
  --btn-fg:       #FFFFFF;
  --btn-hover-bg: #E85A10;
}

/* Large: scale root 16px → ~19px; reset body so scale doesn't compound;
   pin display headings that are already legible and don't need to grow. */
html.theme-a11y--large {
  font-size: 118.75%;
}

html.theme-a11y--large body {
  font-size: 1rem;
}

html.theme-a11y--large .hero h1 {
  font-size: min(10vw, 57.6px);
}

html.theme-a11y--large .page-header h1 {
  font-size: clamp(38.4px, 5vw, 60.8px);
}

/* Readable: Atkinson Hyperlegible — designed for low-vision/dyslexic readers.
   Increases line-height and strips decorative italic on display headers. */
html.theme-a11y--readable body {
  font-size: 1.06rem;
  line-height: 1.75;
}

html.theme-a11y--readable p,
html.theme-a11y--readable li,
html.theme-a11y--readable blockquote {
  font-family: 'Atkinson Hyperlegible', Georgia, serif;
}

html.theme-a11y--readable .hero h1 em {
  font-family: 'Atkinson Hyperlegible', Georgia, serif;
  font-style: normal;
}

/* Underlines: body links only — skip FAB, skip-link, nav logo, and all CTA/btn elements. */
html.theme-a11y--underlines a:not(.a11y-fab):not(.skip-link):not(.site-nav__logo):not(.nav-connect-btn):not(.download-btn):not([class*="btn"]) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Still: collapse all motion (including delays). Panel inherits — intentional. */
html.theme-a11y--still *,
html.theme-a11y--still *::before,
html.theme-a11y--still *::after {
  animation-duration:  0.001s !important;
  animation-delay:     0s     !important;
  transition-duration: 0.001s !important;
}

@media (max-width: 540px) {
  .a11y-fab   { right: 19px; }
  .a11y-panel { right: 19px; width: min(320px, calc(100vw - 38px)); }
}

@media print {
  .a11y-fab, .a11y-panel { display: none !important; }
}

/* ── Contact page ──────────────────────────────────────────────────────── */

.contact-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: clamp(2rem, 4vw, 4rem);
  padding-block: clamp(1.5rem, 3vw, 2.5rem) clamp(2rem, 4vw, 3.5rem);
  align-items: stretch;
}

.contact-section--card {
  display: flex;
  flex-direction: column;
}

.contact-section__heading {
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0 0 1.75rem;
}

/* Email row above the form */
.contact-email-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.contact-email-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.contact-email-link {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
}

.contact-email-link:hover {
  text-decoration: underline;
}

/* Form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-family: 'Inter', sans-serif;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
}

.form-input {
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--fg);
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  padding: 0.625rem 0.75rem;
  width: 100%;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: var(--fg-muted);
  opacity: 0.6;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

.form-textarea {
  resize: vertical;
  min-height: 130px;
  line-height: 1.6;
}

.contact-submit {
  align-self: flex-start;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}

/* Contact card sidebar */
.contact-card-details {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
}

.contact-card-name {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--fg);
  margin: 0;
}

.contact-card-row {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--fg-muted);
  text-decoration: none;
}

a.contact-card-row:hover {
  color: var(--accent);
}

.contact-vcf-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

/* Actions wrapper: QR fills column, button pinned to bottom */
.contact-card-actions {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: stretch;
}

.contact-card-actions .contact-vcf-btn {
  justify-content: center;
  margin-bottom: 0;
  margin-top: auto;
}

.contact-card-actions .contact-qr {
  display: flex;
  flex-direction: column;
}

.contact-card-actions .qr-frame {
  display: block;
  width: 100%;
  max-width: 312px;
  box-sizing: border-box;
  margin: 0 auto;
}

.contact-card-actions .qr-frame img {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  margin: 0 auto;
}

.contact-qr {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
}

/* Shared QR frame — used by contact.html and contactcard.html */
.qr-frame {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 4px;
  display: inline-block;
}

.qr-frame img {
  display: block;
}

.qr-caption {
  color: var(--fg-muted);
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  max-width: 26ch;
  margin: 0;
}

/* Responsive — stack on narrow viewports */
@media (max-width: 768px) {
  .contact-layout {
    grid-template-columns: 1fr;
  }

  /* Card column stacked on mobile: add separator, center heading text */
  .contact-section--card {
    padding-top: 2.5rem;
    border-top: 1px solid var(--rule);
  }

  /* Light centering on the form section heading and email row */
  .contact-section--form .contact-section__heading,
  .contact-section--form h2 {
    text-align: center;
  }

  .contact-email-row {
    justify-content: center;
  }
}

/* ── "What's in a name?" pull-out panel ────────────────────────────────── */

/* Handle — tab hanging below the nav bar, scrolls with page content */
.name-panel-handle-wrapper {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  transform: translateY(100%);
  display: flex;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.name-panel-handle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 1rem 0.375rem;
  background: var(--nav-bg);
  border: 1px solid var(--nav-border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-style: italic;
  letter-spacing: 0.02em;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  pointer-events: auto;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.name-panel-handle:hover {
  color: var(--fg);
}

.name-panel-handle-arrow {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.name-panel-handle[aria-expanded="true"] .name-panel-handle-arrow {
  transform: rotate(180deg);
}

/* Dim overlay — z-index 98, nav (100) floats above it, revealing wordmark */
.name-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  z-index: 98;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.name-panel-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Panel — slides down from below the nav via clip-path reveal */
.name-panel {
  position: fixed;
  top: var(--nav-h);
  left: 0;
  right: 0;
  z-index: 99;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  max-height: calc(100vh - var(--nav-h));
  overflow-y: auto;
  /* Closed: clipped from the bottom (nothing visible) */
  clip-path: inset(0 0 100% 0);
  transition: clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.name-panel.is-open {
  clip-path: inset(0);
}

.name-panel-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.15s;
}

.name-panel-close:hover {
  color: var(--fg);
}

/* Inner layout — two columns split at center */
.name-panel-inner {
  display: flex;
  align-items: stretch;
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem 2.5rem;
}

.name-panel-col {
  flex: 1;
  padding: 0 3rem;
}

.name-panel-col--weft {
  text-align: right;
}

.name-panel-col--whetstone {
  text-align: left;
}

.name-panel-divider {
  flex-shrink: 0;
  width: 2px;
  background: var(--accent);
  align-self: stretch;
}

/* Dictionary entry styles */
.dict-headword {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  line-height: 1;
  margin: 0 0 0.625rem;
  color: var(--fg);
}

.dict-meta {
  margin: 0 0 1.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.name-panel-col--weft .dict-meta {
  justify-content: flex-end;
}

.dict-pron {
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.dict-pos {
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.dict-defs {
  margin: 0;
  padding-left: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  list-style: decimal;
}

.name-panel-col--weft .dict-defs {
  padding-left: 0;
  padding-right: 1.25rem;
  direction: ltr; /* keep numbers readable on right-aligned col */
}

.dict-defs li {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--fg);
}

.dict-label {
  font-style: italic;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* Full-width section below the two definition columns */
.name-panel-wide-section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.75rem 2rem 2rem;
  border-top: 1px solid var(--rule);
}

.name-panel-wide-section p {
  font-family: 'Inter', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--fg);
  width: 95%;
  max-width: 95%;
  margin-left: auto;
  margin-right: auto;
  text-align: left;
}

.name-panel-wide-section p + p {
  margin-top: 1rem;
}

.name-panel-wide-section .accent-em {
  font-style: italic;
  font-weight: 700;
  color: var(--accent);
}

@media (max-width: 640px) {
  .name-panel-wide-section {
    padding: 1.5rem 1.5rem 1.75rem;
  }
}

/* Bottom close handle */
.name-panel-bottom {
  display: flex;
  justify-content: center;
  padding: 0.25rem 0 1.75rem;
}

.name-panel-close-bottom {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3rem 1.25rem 0.375rem;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  color: var(--fg-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}

.name-panel-close-bottom:hover {
  color: var(--fg);
  border-color: var(--fg-muted);
}

/* Mobile-only headwords (hidden on desktop; desktop uses column position for context) */
.dict-headword--mobile {
  display: none;
}

/* Body scroll lock when panel is open */
.name-panel-body-lock {
  overflow: hidden;
}

/* Responsive — stack vertically on narrow viewports */
@media (max-width: 640px) {
  .name-panel-inner {
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    gap: 2rem;
  }

  .name-panel-col {
    padding: 0;
  }

  .name-panel-col--weft {
    text-align: left;
  }

  .name-panel-col--weft .dict-meta {
    justify-content: flex-start;
  }

  .name-panel-col--weft .dict-defs {
    padding-left: 1.25rem;
    padding-right: 0;
  }

  .name-panel-divider {
    width: 100%;
    height: 1px;
    align-self: auto;
  }

  /* Show headword label so each stacked entry is self-identifying */
  .dict-headword--mobile {
    display: block;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.4rem, 4vw, 1.75rem);
    font-weight: 700;
    font-variant: small-caps;
    letter-spacing: 0.06em;
    color: var(--fg);
    margin: 0 0 0.375rem;
    line-height: 1.1;
  }

  /* Ensure pron + pos line is always visible in stacked layout */
  .dict-meta {
    display: flex;
  }
}

@media print {
  .name-panel-handle, .name-panel-overlay, .name-panel { display: none !important; }
}

/* ── Site mode: maintenance ────────────────────────────────────────────── */

/* Hide all nav links except the first (Home) */
html.site-mode--maintenance .site-nav__links li + li {
  display: none;
}

/* Hide full-page content and footer; show coming-soon block.
   Contact page is always accessible — exempt from main/footer hide. */
html.site-mode--maintenance body:not(.contact-page) main,
html.site-mode--maintenance body:not(.contact-page) .site-footer {
  display: none;
}

.coming-soon-page {
  display: none;
}

html.site-mode--maintenance .coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: clamp(2.5rem, 8vh, 5rem) 1.5rem clamp(2rem, 6vh, 4rem);
  min-height: calc(100vh - var(--nav-h));
}

.coming-soon-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 660px;
  padding-inline: 1.5rem;
}

.coming-soon-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: clamp(1.375rem, 6.5vw, 3rem);
  margin-bottom: 1.5rem;
}

.coming-soon-heading span {
  display: block;
  white-space: nowrap;
}

.coming-soon-em {
  font-style: italic;
  color: var(--accent);
}

.coming-soon-em-plain {
  font-style: italic;
}

.coming-soon-lead {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--fg-muted);
  font-family: 'Inter', sans-serif;
  font-size: clamp(0.875rem, 4.5vw, 1.375rem);
  line-height: 1.7;
  margin-bottom: 2.5rem;
}

.coming-soon-lead span {
  display: block;
  white-space: nowrap;
}

.coming-soon-cta {
  display: inline-flex;
  align-items: center;
  padding: 0.875rem 2rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 2px;
  transition: background 0.15s;
}

.coming-soon-cta:hover {
  background: var(--btn-hover-bg);
}

/* ── Dev mode picker ───────────────────────────────────────────────────── */

/* mode-picker lives inside .nav-right on desktop; fixed bottom pill on mobile */
.mode-picker {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #fff;
  padding: 3px 8px 4px;
  border-radius: 4px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  white-space: nowrap;
  user-select: none;
}

.nav-right.has-mode-picker {
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
}

.mode-picker-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mode-picker__label {
  color: rgba(255, 255, 255, 0.5);
  margin-right: 2px;
}

.mode-picker__btn {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  padding: 3px 9px;
  border-radius: 3px;
  cursor: pointer;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}

.mode-picker__btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.mode-picker__btn--active {
  background: #fff;
  color: #000;
  border-color: #fff;
  font-weight: 600;
}
