/* ═══════════════════════════════════════════════
   SA-HR Polish Layer
   — Canonical motion, focus states, and typography system.
   — Loaded on every page. Small, but touches everything.
   ═══════════════════════════════════════════════ */

/* ─── CANONICAL MOTION TOKENS ─── */
:root {
  /* Three speeds. That's it. */
  --sahr-fast:   180ms;
  --sahr-med:    280ms;
  --sahr-slow:   520ms;
  /* One easing, used everywhere. */
  --sahr-ease:   cubic-bezier(.2, .7, .3, 1);
  /* Accent system — aligns with site palette */
  --sahr-focus:  rgba(0, 229, 255, 0.75);
}

/* ─── TYPOGRAPHY — OpenType features on the whole site ─── */
html {
  font-feature-settings:
    "kern" 1,   /* kerning */
    "liga" 1,   /* standard ligatures */
    "calt" 1,   /* contextual alternates */
    "ss01" 1,   /* stylistic set 1 (where available) */
    "onum" 0;   /* old-style figures default off */
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Use old-style numerals in body copy, but lining figures in mono/data contexts */
body, p, li {
  font-variant-numeric: oldstyle-nums proportional-nums;
}
[class*="mono"], code, pre, kbd,
.gnav, .gnav-link, .gnav-cta, .gnav-login,
[class*="-badge"], [class*="-meta"], [class*="-eyebrow"],
[class*="-code"], [class*="-coord"], [class*="-year"],
[class*="-hint"], [class*="-label"], [class*="-value"],
[class*="-num"] {
  font-variant-numeric: tabular-nums lining-nums;
}

/* Fraunces display headings get discretionary ligatures */
h1, h2, h3, [class*="-title"], [class*="-name"] {
  font-feature-settings:
    "kern" 1, "liga" 1, "calt" 1, "dlig" 1, "ss01" 1;
  text-rendering: optimizeLegibility;
}

/* ─── FOCUS RING — keyboard users only ─── */
/* Remove the ugly default focus outline */
:focus:not(:focus-visible) { outline: none; }

/* Apply a single consistent focus ring everywhere */
:focus-visible {
  outline: 2px solid var(--sahr-focus);
  outline-offset: 3px;
  border-radius: 6px;
  transition: outline-offset var(--sahr-fast) var(--sahr-ease);
}

/* Tighter focus ring for buttons and links that already have border-radius */
button:focus-visible,
a:focus-visible,
.btn:focus-visible,
.gnav-cta:focus-visible,
.gnav-login:focus-visible,
.gnav-link:focus-visible,
[class*="-btn"]:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline-offset: 2px;
}

/* Studio / project cards — offset more for visual breathing room */
.atelier-studio:focus-visible,
.project:focus-visible,
.studio-card:focus-visible,
.industry-card:focus-visible,
.hub-card:focus-visible {
  outline-offset: 4px;
}

/* Skip-link for screen readers */
.sahr-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 10px 18px;
  background: #00E5FF;
  color: #061018;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  border-radius: 0 0 8px 0;
  z-index: 10000;
}
.sahr-skip-link:focus {
  left: 0;
  top: 0;
}

/* ─── PREFERS-REDUCED-MOTION — true disable, not weaken ─── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── TINY UNIVERSAL FIXES ─── */

/* Stop selected text looking like default browser blue */
::selection {
  background: rgba(0, 229, 255, 0.22);
  color: #fff;
}

/* Image lazy-load hint for browsers */
img:not([loading]) { loading: lazy; }

/* Smooth scroll only if user hasn't opted out */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* Ensure anchor navigation doesn't hide content under the fixed nav */
:target { scroll-margin-top: 90px; }

/* Make sure the body bg color never flashes during route transitions */
html, body { background-color: #06080d; }

/* Hide visually but keep for screen readers */
.sahr-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;
}

/* Print polish — shipped even though nobody prints, because the one who does remembers */
@media print {
  body {
    background: white !important;
    color: #111 !important;
  }
  .gnav, .gnav-mobile, .sahr-loader, .chat-fab, .sahr-cursor-trail,
  .sahr-hours-pill, .sahr-imprint, #sahr-cmdk, .sahr-tod-tint,
  #sahr-tod-tint {
    display: none !important;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }
  h1, h2, h3 { page-break-after: avoid; }
  .atelier-studio, .project, .cs-card {
    page-break-inside: avoid;
    border: 1px solid #ddd;
    box-shadow: none !important;
    break-inside: avoid;
  }
}

/* ═══════════════════════════════════════════════
   PASS 2 ADDITIONS — Mobile polish & meta
   ═══════════════════════════════════════════════ */

/* ─── Skip-to-content link for screen readers ─── */
.skip-link {
  position: absolute;
  top: -40px; left: 8px;
  z-index: 99999;
  padding: 8px 14px;
  background: #06080d;
  color: #00E5FF;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  border: 1px solid rgba(0, 229, 255, 0.5);
  border-radius: 6px;
  text-decoration: none;
  transition: top 220ms cubic-bezier(.2,.7,.3,1);
}
.skip-link:focus {
  top: 8px;
}

/* ─── Mobile polish ─── */
@media (max-width: 720px) {
  /* Working-hours pill — smaller, above mobile bottom safe area */
  .sahr-hours-pill {
    bottom: 76px !important;
    left: 12px !important;
    padding: 5px 10px 5px 9px !important;
    font-size: 9px !important;
  }

  /* Atlas file-reference card — collapse to 2 cols and hide last 2 specs */
  .atelier-studio-atlas-hint {
    grid-template-columns: 1fr 1fr !important;
    gap: 12px 18px !important;
  }
  .atelier-studio-atlas-hint-line:nth-child(n+5) {
    display: none;
  }

  /* Chat FAB on mobile — smaller */
  .chat-fab {
    width: 48px !important;
    height: 48px !important;
    bottom: 14px !important;
    right: 14px !important;
  }

  /* Studio-page "Built by SA-HR" imprint — small on mobile */
  .sahr-imprint {
    bottom: 12px !important;
    right: 12px !important;
    font-size: 8.5px !important;
    padding: 4px 8px !important;
  }

  /* Status controls stack vertically on mobile */
  .st-controls {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .st-subscribe-btn,
  .st-refresh {
    width: 100% !important;
    justify-content: center !important;
  }

  /* ⌘K palette full-width on mobile */
  #sahr-cmdk .cmdk-panel {
    max-width: 100% !important;
    margin: 0 8px !important;
  }
}

/* ─── Tablet polish ─── */
@media (max-width: 1000px) and (min-width: 721px) {
  .atelier-studios { gap: 16px !important; }
}

/* ─── Selection + scrollbar + touch ─── */
::selection { background: rgba(0, 229, 255, 0.3); color: #fff; }
::-moz-selection { background: rgba(0, 229, 255, 0.3); color: #fff; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #06080d; }
::-webkit-scrollbar-thumb {
  background: rgba(46, 157, 255, 0.22);
  border: 3px solid #06080d;
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(46, 157, 255, 0.45); }

/* WCAG 2.5.5 — Touch targets at least 44px on touch devices */
@media (hover: none) {
  .gnav-link, .gnav-cta, .gnav-login,
  .btn, .cs-btn, .atelier-btn, .faro-btn,
  button:not(.chat-fab):not(.gnav-brand-mark):not(.atelier-studio-atlas-arrow-char) {
    min-height: 44px;
  }
}

/* ─── Print styles — make printed pages legible & brand-forward ─── */
@media print {
  /* Hide interactive / floating UI */
  .gnav, .gnav-mobile, .sahr-hours-pill, .chat-fab, .sahr-imprint,
  #sahr-cmdk, #sahr-cursor-trail, .atlas-whisper, .sahr-loader,
  .st-subscribe-btn, .st-refresh, .st-modal,
  .atelier-studio-atlas-canvas, .atelier-studio-shine,
  .sahr-legal-strip { display: none !important; }

  body {
    background: #fff !important;
    color: #000 !important;
    font-family: Georgia, serif !important;
  }
  h1, h2, h3, h4 {
    color: #000 !important;
    page-break-after: avoid;
  }
  a {
    color: #0066cc !important;
    text-decoration: underline !important;
  }
  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #666;
  }
  p, li { orphans: 3; widows: 3; }
  .hero, .cs-hero, .faro-hero, .atelier-section {
    background: none !important;
  }
}

/* ─── Forced-colors (Windows High Contrast) ─── */
@media (forced-colors: active) {
  .atelier-studio, .studio-card, .project {
    border: 1px solid CanvasText !important;
  }
  .atelier-studio:hover, .studio-card:hover {
    border-color: Highlight !important;
  }
}

/* ═══════════════════════════════════════════════
   NAV LINK — ATELIER 3D DISAMBIGUATOR
   Tiny cube icon before the word so visitors know it's the 3D tour
   ═══════════════════════════════════════════════ */
.gnav-link-atelier {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  position: relative;
}
.gnav-link-atelier::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14' fill='none'%3E%3Cpath d='M2 4L7 1L12 4V10L7 13L2 10V4Z' stroke='%235FC4FF' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cpath d='M7 1V7L2 4' stroke='%235FC4FF' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cpath d='M7 7L12 4M7 7V13' stroke='%235FC4FF' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.8;
  transition: opacity 180ms, transform 400ms cubic-bezier(.2,.7,.3,1);
}
.gnav-link-atelier:hover::before {
  opacity: 1;
  transform: rotate(90deg);
}
