.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Source locks html/body to the viewport for this page only; released below
   900px so the sheet scrolls instead of clipping content. */
html:has(.contact-page) {
  height: 100%;
  overflow: hidden;
}

html:has(.contact-page) body {
  height: 100%;
  overflow: hidden;
}

#main:has(.contact-page) {
  height: 100%;
  padding-top: 0;
}

.contact-page {
  /* Mirrors base.css's #main padding-top (72px, 96px under 480px where the
     nav wraps to two rows) so the fixed nav never overlaps or gaps the sheet. */
  --nav-h: 72px;
  position: relative;
  height: 100%;
  overflow: hidden;
  background-image: repeating-linear-gradient(0deg, var(--color-divider) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(90deg, var(--color-divider) 0 1px, transparent 1px 32px);
}

.corner-mark {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 0 solid var(--color-accent-900);
  pointer-events: none;
}

.corner-mark.tl {
  top: calc(var(--nav-h) - 2px);
  left: 16px;
  border-left-width: 1px;
  border-top-width: 1px;
}

.corner-mark.tr {
  top: calc(var(--nav-h) - 2px);
  right: 16px;
  border-right-width: 1px;
  border-top-width: 1px;
}

.corner-mark.bl {
  bottom: 16px;
  left: 16px;
  border-left-width: 1px;
  border-bottom-width: 1px;
}

.corner-mark.br {
  bottom: 16px;
  right: 16px;
  border-right-width: 1px;
  border-bottom-width: 1px;
}

.side-label {
  position: absolute;
  left: 24px;
  top: 55%;
  transform: translateY(-50%);
  margin: 0;
  writing-mode: vertical-rl;
  rotate: 180deg;
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.4em;
  /* neutral-500 fails AA at this size (~2.6:1) — neutral-700 clears it
     (~5.9:1) without touching the shared token. */
  color: var(--color-neutral-700);
  text-transform: uppercase;
  animation: fadeIn 1.2s ease both;
  animation-delay: 0.7s;
  z-index: 6;
}

/* Mouse-only readout, not part of the tab or touch experience; JS toggles
   the `hidden` attribute, native browser default (display: none) does the
   rest — no visible state until JS confirms a fine pointer is present. */
.crosshair-v,
.crosshair-h,
.crosshair-readout {
  position: fixed;
  opacity: 0;
  z-index: 4;
  pointer-events: none;
}

.crosshair-v {
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: var(--color-accent-400);
}

.crosshair-h {
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: var(--color-accent-400);
}

.crosshair-readout {
  top: 0;
  left: 0;
  font-family: var(--font-heading);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--color-accent-800);
  white-space: pre;
}

.contact-frame {
  position: relative;
  z-index: 6;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: calc(var(--nav-h) + 20px) 56px 26px 76px;
}

.contact-header {
  animation: rise 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.1s;
}

.kicker {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0.3em;
  color: var(--color-accent-700);
  text-transform: uppercase;
}

.contact-title {
  margin: 8px 0 0;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(56px, 9vw, 124px);
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: var(--color-text);
  text-transform: uppercase;
}

.rows {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-top: 18px;
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 38px);
  padding: clamp(14px, 2.8vh, 28px) 10px;
  text-decoration: none;
  border-top: 1px solid var(--color-neutral-300);
  background: transparent;
  transition: background 0.35s ease;
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.row:nth-of-type(1) {
  animation-delay: 0.25s;
}

.row:nth-of-type(2) {
  animation-delay: 0.37s;
}

.row:nth-of-type(3) {
  animation-delay: 0.49s;
}

.row:hover,
.row:focus-visible {
  background: color-mix(in oklch, var(--color-accent) 7%, transparent);
}

.row-idx {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border: 1px solid var(--color-accent-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 15px;
  letter-spacing: 0.12em;
  background: transparent;
  color: var(--color-accent-800);
  transition: background 0.3s ease, color 0.3s ease;
}

.row:hover .row-idx,
.row:focus-visible .row-idx {
  background: var(--color-accent);
  color: var(--color-bg);
}

.row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  transform: translateX(0);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.row:hover .row-text,
.row:focus-visible .row-text {
  transform: translateX(14px);
}

.row-kicker {
  font-family: var(--font-heading);
  font-size: 12px;
  letter-spacing: 0.28em;
  /* neutral-500 fails AA at this size — neutral-700 clears it (~5.9:1). */
  color: var(--color-neutral-700);
  text-transform: uppercase;
}

.row-name {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: clamp(36px, 5.6vw, 76px);
  line-height: 0.95;
  letter-spacing: 0.01em;
  color: var(--color-text);
  text-transform: uppercase;
}

.row-spacer {
  flex: 1;
}

.row-handle {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  /* neutral-500 fails AA at this size — neutral-700 clears it (~5.9:1). */
  color: var(--color-neutral-700);
  transition: color 0.3s ease;
}

.row:hover .row-handle,
.row:focus-visible .row-handle {
  color: var(--color-accent-700);
}

.row-handle-text {
  font-size: clamp(14px, 1.4vw, 18px);
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.row-arrow {
  flex: 0 0 auto;
}

.row-underline {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 9px;
  pointer-events: none;
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.row:hover .row-underline,
.row:focus-visible .row-underline {
  opacity: 1;
  transform: scaleX(1);
}

.row-underline-side {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--color-accent-600);
}

.row-underline-side.left {
  left: 0;
}

.row-underline-side.right {
  right: 0;
}

.row-underline-mid {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--color-accent-600);
}

.rows-close {
  border-top: 1px solid var(--color-neutral-300);
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.6s;
}

.sheet-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-top: 24px;
  animation: fadeIn 0.9s ease both;
  animation-delay: 0.85s;
}

.scale-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.scale-ticks {
  position: relative;
  width: 180px;
  height: 9px;
}

.scale-tick {
  position: absolute;
  background: var(--color-accent-800);
}

.scale-tick.left {
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
}

.scale-tick.mid {
  left: 50%;
  top: 3px;
  bottom: 0;
  width: 1px;
}

.scale-tick.right {
  right: 0;
  top: 0;
  bottom: 0;
  width: 1px;
}

.scale-tick.base {
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  width: auto;
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  width: 180px;
  font-family: var(--font-heading);
  font-size: 11px;
  letter-spacing: 0.15em;
  /* neutral-600 clears large-text AA (~3.82:1) but not small-text — bump to
     neutral-700 (~5.9:1) since these numerals are real text content. */
  color: var(--color-neutral-700);
}

.sheet-table {
  position: relative;
  margin: 0;
  border: 1px solid var(--color-accent-800);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  min-width: 240px;
}

.sheet-row {
  display: flex;
  padding: 7px 14px;
  border-top: 1px solid var(--color-neutral-300);
}

.sheet-row:first-child {
  border-top: none;
}

.sheet-table dt {
  width: 76px;
  font-family: var(--font-heading);
  font-size: 10px;
  letter-spacing: 0.22em;
  /* neutral-500 fails AA at this size — neutral-700 clears it (~5.9:1). */
  color: var(--color-neutral-700);
  text-transform: uppercase;
}

.sheet-table dd {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 13px;
  letter-spacing: 0.1em;
  color: var(--color-accent-900);
  text-transform: uppercase;
}

.sheet-status {
  color: var(--color-accent-700);
}

@keyframes rise {
  0% {
    clip-path: inset(100% 0 0 0);
    opacity: 0;
    transform: translateY(24px);
  }
  60% {
    opacity: 1;
  }
  100% {
    clip-path: inset(0 0 0 0);
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .contact-header,
  .row,
  .rows-close,
  .side-label,
  .sheet-footer {
    animation: none;
    opacity: 1;
    clip-path: none;
    transform: none;
  }

  .crosshair {
    display: none !important;
  }
}

@media (max-width: 480px) {
  .contact-page {
    --nav-h: 96px;
  }
}

/* Below ~900px wide the fixed one-screen sheet has nowhere to put three rows
   plus header, footer and side label — release the viewport lock and let the
   page scroll like every other surface instead of clipping content.
   Row/heading type is clamp()'d against vw, not vh, so a short-but-wide
   viewport (split-screen window, docked devtools, ~1280x400) keeps rendering
   near max size regardless of height: header + 3 rows + footer add up to
   ~700-730px there. Gate on height too so that case scrolls instead of
   clipping — reuses this same unlock block rather than a third variant. */
@media (max-width: 900px), (max-height: 760px) {
  html:has(.contact-page),
  html:has(.contact-page) body {
    height: auto;
    overflow: visible;
  }

  #main:has(.contact-page) {
    height: auto;
    padding-top: var(--nav-h, 72px);
  }

  .contact-page {
    height: auto;
    overflow: visible;
  }

  .contact-frame {
    padding: 32px 24px 32px;
  }

  .corner-mark {
    display: none;
  }

  .side-label {
    display: none;
  }

  .crosshair {
    display: none !important;
  }

  .row {
    flex-wrap: wrap;
    row-gap: 10px;
  }

  .row-handle {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .row-handle-text {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .sheet-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 20px;
  }
}

@media (max-width: 480px) {
  .contact-frame {
    padding: 24px 16px 28px;
  }

  .row {
    gap: 14px;
  }
}
