/* ==========================================================================
   DENTON SECURITY / SITE LAYOUT + PAGE COMPONENTS
   Depends on: tokens.css, components.css (both locked — do not restyle here)
   Zero radius. 1px steel borders. Linear or sharp easing only.
   ========================================================================== */

/* --------------------------------------------------------------------------
   LAYOUT PRIMITIVES
   -------------------------------------------------------------------------- */

html { color-scheme: dark; }

/* Kill the mobile double-tap zoom delay on interactive elements */
a, button, input, select, textarea { touch-action: manipulation; }

:root {
  /* .site-header__inner's 72px + its 1px bottom border. No viewport-fit=
     cover is set, so the page never extends behind the iOS notch/dynamic
     island in the first place — Safari reserves that strip as OS chrome,
     not page canvas, so there's nothing for content to show through. */
  --header-h: 73px;
}

/* Header is fixed (not sticky) — see .site-header below for why — so page
   content needs to be pushed down by hand. Fixed elements ignore ancestor
   padding, so this shifts main/footer without moving the header itself. */
body { padding-top: var(--header-h); }

/* Anchored jumps + skip-link target clear the fixed header */
main { scroll-margin-top: calc(var(--header-h) + 8px); }

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

.section {
  padding-block: var(--space-24);
  border-bottom: var(--border-w) solid var(--color-border);
}

.section--flush { padding-block: var(--space-16); }

.section__head {
  margin-bottom: var(--space-12);
}

.section__head .heading-2 {
  margin-top: var(--space-3);
}

.section__lead {
  margin-top: var(--space-4);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   SKIP LINK
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  z-index: calc(var(--z-toast) + 1);
  padding: var(--space-3) var(--space-6);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  transform: translateY(-100%);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  color: var(--color-on-accent);
}

/* --------------------------------------------------------------------------
   iOS OVERSCROLL FILL (Safari only)
   Safari's elastic "rubber-band" bounce at the top of the page can briefly
   render past y=0 — most visible right around the dynamic island — a strip
   that normally has nothing drawn in it at all. This extends a solid block
   matching the page background up past that zone, so the bounce reveals
   more of the same color instead of a gap. Fixed and always present, no
   JS needed; automatically matches the active dark/dim/light theme since
   it reads --color-bg. z-index is set above every value in the tokens.css
   scale (highest is --z-texture at 500) so nothing can render above it.
   -------------------------------------------------------------------------- */
body::before {
  content: "";
  position: fixed;
  top: -200px;
  left: 0;
  right: 0;
  height: 200px;
  background-color: var(--color-bg);
  z-index: 600;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   HEADER / NAV
   -------------------------------------------------------------------------- */

.site-header {
  /* Fixed, not sticky: on mobile, a sticky header can visibly detach from
     the top for a frame while the browser's address bar collapses or
     expands during scroll, letting page content flash above it. Fixed
     stays pinned to the viewport regardless — see the body padding-top
     and --header-h above, which compensate for removing it from flow. */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background-color: var(--color-bg);
  border-bottom: var(--border-w) solid var(--color-border);
  /* Forces its own GPU compositing layer, pinned in place. Without this,
     iOS Safari can paint an actively-animating [data-reveal] section (each
     one gets promoted to its own layer while GSAP tweens its clip-path) in
     front of this fixed header mid-scroll, regardless of z-index — because
     the two ended up on separate layers that Safari's compositor ordered
     wrong. Giving the header a permanent layer of its own keeps it pinned
     above every section's layer, every time, not just most of the time. */
  transform: translateZ(0);
  will-change: transform;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
}

.brand:focus-visible { outline-offset: 4px; }

@media (hover: hover) and (pointer: fine) {
  .brand:hover { color: var(--color-text); }
}

/* Black-on-white JPG rendered white-on-dark: invert, then screen-blend the
   black background away. Keeps the logo strictly black/white — no cyan. */
.brand__mark {
  display: block;
  width: 44px;
  height: auto;
  filter: invert(1);
  mix-blend-mode: screen;
}

/* Light theme: the source JPG is already black-on-white, so drop the
   invert and use multiply instead of screen to drop the white field
   (multiply keeps the logo crisp on any light surface, not just pure
   white — the mobile nav panel sits on --color-surface, not --color-bg). */
[data-theme="light"] .brand__mark {
  filter: none;
  mix-blend-mode: multiply;
}

.brand__name {
  font-family: var(--font-heading);
  font-size: var(--text-base);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-8);
}

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: inline-block;
  padding: var(--space-3) 0; /* keeps the target ≥44px on tablet widths */
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  border-bottom: var(--border-w) solid transparent;
}

@media (hover: hover) and (pointer: fine) {
  .site-nav__link:hover { color: var(--color-accent); }
}

.site-nav__link[aria-current="page"] {
  color: var(--color-text);
  border-bottom-color: var(--color-accent);
}

/* Mobile nav toggle: three 1px bars, no animation frills */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: var(--space-3);
  background: transparent;
  border: var(--border-w) solid var(--color-border);
  cursor: pointer;
}

.nav-toggle__bar {
  display: block;
  width: 100%;
  height: 1px;
  background-color: var(--color-text);
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .nav-toggle { display: inline-flex; }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background-color: var(--color-surface);
    border-bottom: var(--border-w) solid var(--color-border);
  }

  .site-nav.is-open { display: flex; }

  .site-nav__list {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .site-nav__link {
    display: block;
    padding: var(--space-4) var(--space-6);
    border-bottom: var(--border-w) solid var(--color-border);
  }

  .site-nav__link[aria-current="page"] {
    border-bottom-color: var(--color-border);
    border-left: 2px solid var(--color-accent);
    padding-left: calc(var(--space-6) - 2px);
  }

  .site-nav__cta {
    margin: var(--space-4) var(--space-6) var(--space-6);
  }
}

/* --------------------------------------------------------------------------
   THEME TOGGLE
   Experimental dark/light comparison switch (not part of the locked
   "dark only" style guide — added at Ben's request to compare treatments).
   Styled like the panel's status indicators: sharp segmented control,
   hard color swap on the active segment, no easing beyond the sanctioned
   120ms hover band.
   -------------------------------------------------------------------------- */

.theme-toggle {
  display: inline-flex;
  border: var(--border-w) solid var(--color-border);
}

.theme-toggle__btn {
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  background-color: transparent;
  border: 0;
  border-left: var(--border-w) solid var(--color-border);
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease-sharp),
    color            var(--dur-fast) var(--ease-sharp);
}

.theme-toggle__btn:first-child { border-left: 0; }

.theme-toggle__btn[aria-pressed="true"] {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
}

@media (hover: hover) and (pointer: fine) {
  .theme-toggle__btn:not([aria-pressed="true"]):hover {
    color: var(--color-text);
  }
}

.theme-toggle__btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .theme-toggle {
    margin: var(--space-2) var(--space-6) var(--space-4);
    align-self: flex-start;
  }
}

/* --------------------------------------------------------------------------
   HERO (home)
   -------------------------------------------------------------------------- */

.hero {
  border-bottom: var(--border-w) solid var(--color-border);
}

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-16);
  align-items: center;
  padding-block: var(--space-24);
}

.hero__lead {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-md);
  line-height: var(--leading-body);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin-top: var(--space-8);
}

.hero__title { margin-top: var(--space-4); }

.hero__media {
  border: var(--border-w) solid var(--color-border);
}

.hero__media img {
  display: block;
  width: 100%;
  height: auto;
}

/* Data strip: mono facts under the hero */
.data-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: var(--border-w) solid var(--color-border);
}

.data-strip__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-6);
  border-right: var(--border-w) solid var(--color-border);
}

.data-strip__item:first-child {
  border-left: var(--border-w) solid var(--color-border);
}

.data-strip__label {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-muted);
}

.data-strip__value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

@media (max-width: 1023px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: var(--space-12);
    padding-block: var(--space-16);
  }
}

@media (max-width: 767px) {
  .data-strip { grid-template-columns: 1fr; }

  .data-strip__item {
    border-right: 0;
    border-left: 0;
    border-bottom: var(--border-w) solid var(--color-border);
  }

  .data-strip__item:first-child { border-left: 0; }
  .data-strip__item:last-child { border-bottom: 0; }
}

/* --------------------------------------------------------------------------
   PANEL GRIDS (services overview, process, etc.)
   -------------------------------------------------------------------------- */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.panel-grid--3 { grid-template-columns: repeat(3, 1fr); }
.panel-grid--2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 1023px) {
  .panel-grid,
  .panel-grid--3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .panel-grid,
  .panel-grid--3,
  .panel-grid--2 { grid-template-columns: 1fr; }
}

/* Service card: a panel that is a link */
.service-card {
  display: flex;
  flex-direction: column;
  color: var(--color-text);
}

.service-card:focus-visible { outline-offset: -2px; }

@media (hover: hover) and (pointer: fine) {
  .service-card:hover {
    color: var(--color-text);
    border-color: var(--color-accent);
  }
  .service-card:hover .service-card__cue { color: var(--color-accent); }
}

.service-card__num {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-accent);
}

.service-card__title {
  margin-top: var(--space-4);
  font-size: var(--text-md);
  line-height: var(--leading-snug);
}

.service-card__body {
  margin-top: var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--text-base);
  flex-grow: 1;
}

.service-card__cue {
  margin-top: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
  transition: color var(--dur-fast) var(--ease-sharp);
}

/* --------------------------------------------------------------------------
   STAT / TRUST PANELS
   -------------------------------------------------------------------------- */

.stat {
  padding: var(--space-6);
  border: var(--border-w) solid var(--color-border);
  background-color: var(--color-surface);
}

.stat__value {
  font-family: var(--font-heading);
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.stat__label {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   TESTIMONIALS
   -------------------------------------------------------------------------- */

.quote-panel {
  display: flex;
  flex-direction: column;
  padding: var(--space-8);
  background-color: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
  border-top: 2px solid var(--color-accent);
}

.quote-panel blockquote {
  margin: 0;
  flex-grow: 1;
}

.quote-panel blockquote p {
  color: var(--color-text);
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

.quote-panel blockquote p + p { margin-top: var(--space-4); }

.quote-panel figcaption {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: var(--border-w) solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   WORK / MEDIA FIGURES
   -------------------------------------------------------------------------- */

.work-figure {
  margin: 0;
  border: var(--border-w) solid var(--color-border);
  background-color: var(--color-surface);
}

.work-figure img {
  display: block;
  width: 100%;
  height: auto;
}

/* Wide strip variant: crops a portrait photo into a landscape band */
.work-figure--strip img {
  aspect-ratio: 21 / 9;
  object-fit: cover;
  object-position: center 60%;
}

@media (max-width: 767px) {
  .work-figure--strip img { aspect-ratio: 4 / 3; }
}

.stack-top { margin-top: var(--space-4); }

.work-figure figcaption {
  padding: var(--space-4) var(--space-6);
  border-top: var(--border-w) solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   CTA BAND
   -------------------------------------------------------------------------- */

.cta-band {
  padding: var(--space-16) var(--space-8);
  background-color: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
}

.cta-band__copy { max-width: 32rem; }

.cta-band__copy p {
  margin-top: var(--space-3);
  color: var(--color-text-muted);
}

.cta-band__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
}

@media (max-width: 767px) {
  .cta-band { padding: var(--space-8) var(--space-6); }
}

/* --------------------------------------------------------------------------
   SUBPAGE HERO
   -------------------------------------------------------------------------- */

.page-hero {
  padding-block: var(--space-16);
  border-bottom: var(--border-w) solid var(--color-border);
}

.page-hero__title { margin-top: var(--space-4); }

.page-hero__lead {
  margin-top: var(--space-6);
  color: var(--color-text-muted);
  font-size: var(--text-md);
}

/* --------------------------------------------------------------------------
   SERVICE DETAIL SECTIONS (services.html)
   -------------------------------------------------------------------------- */

.service-detail {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: var(--space-12);
  padding-block: var(--space-16);
  border-bottom: var(--border-w) solid var(--color-border);
  scroll-margin-top: calc(var(--header-h) + 24px); /* clear the fixed header on anchor jumps */
}

.service-detail:last-of-type { border-bottom: 0; }

.service-detail__body p {
  color: var(--color-text-muted);
}

.service-detail__body p + p { margin-top: var(--space-4); }

.service-detail__link {
  display: inline-block;
  margin-top: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

@media (max-width: 767px) {
  .service-detail {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
}

/* --------------------------------------------------------------------------
   CONTACT
   -------------------------------------------------------------------------- */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: var(--space-16);
  align-items: start;
}

@media (max-width: 1023px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-12);
  }
}

.info-panel {
  margin: 0;
  background-color: var(--color-surface);
  border: var(--border-w) solid var(--color-border);
}

.info-panel dt,
.info-panel dd { margin: 0; }

/* Screen-reader-only text */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Inline list with visual-only separators (hidden from AT via markup) */
.inline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.inline-list li {
  display: inline;
}

.inline-list li + li::before {
  content: "\00B7\00A0";
  color: var(--color-text-muted);
  speak: never;
}

.info-panel__row {
  padding: var(--space-6);
  border-bottom: var(--border-w) solid var(--color-border);
}

.info-panel__row:last-child { border-bottom: 0; }

.info-panel__label {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-muted);
}

.info-panel__value {
  display: block;
  margin-top: var(--space-2);
  font-size: var(--text-base);
}

.info-panel__value a { font-family: var(--font-mono); }

/* --------------------------------------------------------------------------
   FORMS
   -------------------------------------------------------------------------- */

.form-field { margin-bottom: var(--space-6); }

.form-field label {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-muted);
}

.form-field input,
.form-field select,
.form-field textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-surface);
  /* Muted-gray border: the locked palette's only 3:1+ boundary color
     (WCAG 1.4.11 non-text contrast for form control boundaries) */
  border: var(--border-w) solid var(--color-text-muted);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  transition: border-color var(--dur-fast) var(--ease-sharp);
}

.form-field textarea {
  min-height: 160px;
  resize: vertical;
}

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%239A9A9E' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  padding-right: var(--space-12);
}

.form-field input:focus-visible,
.form-field select:focus-visible,
.form-field textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 0;
  border-color: var(--color-accent);
}

.form-field input[aria-invalid="true"],
.form-field select[aria-invalid="true"],
.form-field textarea[aria-invalid="true"] {
  border-color: var(--color-alert);
}

.form-field__error {
  display: none;
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-alert);
}

.form-field__error.is-visible { display: block; }

.form-status {
  display: none;
  margin-top: var(--space-6);
  padding: var(--space-6);
  background-color: var(--color-surface);
  border: var(--border-w) solid var(--color-accent);
}

.form-status.is-visible { display: block; }

.form-status__title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-accent);
}

.form-status p {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   FOOTER
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: var(--border-w) solid var(--color-border);
  background-color: var(--color-bg);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 3fr) minmax(0, 4fr);
  gap: var(--space-12);
  padding-block: var(--space-16);
}

.site-footer__brand p {
  margin-top: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.site-footer__heading {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-muted);
}

.site-footer__list {
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.site-footer__list li + li { margin-top: var(--space-3); }

.site-footer__list a {
  color: var(--color-text);
  font-size: var(--text-sm);
}

@media (hover: hover) and (pointer: fine) {
  .site-footer__list a:hover { color: var(--color-accent); }
}

.site-footer__list .data { color: var(--color-text-muted); }

.site-footer__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block: var(--space-6);
  border-top: var(--border-w) solid var(--color-border);
  color: var(--color-text-muted);
}

@media (max-width: 767px) {
  .site-footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    padding-block: var(--space-12);
  }
}
