/* ========================================
   Loam — Shared Design System
   Design: Diana Reyes
   ======================================== */

/* ── RESET ── */

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

/* ── VARIABLES ── */

:root {
  /* Ground family deepened 2026-07-31 — the storyboard paper tone (#F7F6F2)
     read as white at full-bleed screen brightness. Oat/linen, not paper. */
  --bg:          #EFE6D2;
  --surface:     #E6DCC4;
  --surface-alt: #CFDABC;
  --primary:     #2E4A3A;
  --primary-dim: #26402F;
  --accent:      #C15F3C;
  --accent-dim:  #A2492B;
  --cta:         #B0542F; /* resting text-CTA ground — #C15F3C fails AA under light text */
  --accent-ink:  #9A4426; /* terracotta as small TEXT on light grounds — AA on --bg and 0.88-glass; --accent/--accent-dim fall short there */
  --text:        #2B2723;
  --text-muted:  #5D564A;
  --text-dim:    #5D564A;
  --border:      #D8CDB4;
  --border-light:#C6B99C;
  --error:       #A2492B;
  --success:     #2E4A3A;

  /* Team Colors */
  --carl:        #2E4A3A;
  --diana:       #C15F3C;
  --anthony:     #7E9B72;
  --abish:       #6E675D;

  /* Typography */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Cascadia Code', monospace;

  /* Layout */
  --content-width: 960px;
  --section-pad: 80px;
  --nav-height: 60px;
}

/* ── BASE ── */

html {
  scroll-behavior: smooth;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--bg);
  min-height: 100vh;
  font-family: var(--font-body) !important;
  animation: pageEnter 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ── TYPOGRAPHY ── */

h1, h2, h3, h4 {
  font-family: var(--font-display) !important;
  font-weight: 700;
  color: var(--primary) !important;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h1 {
  font-size: 3.2rem;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

h2 {
  font-size: 2rem;
  margin-bottom: 20px;
}

h2 .dot { color: var(--primary); }
h1 .dot { color: var(--primary); }

pre, code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

pre {
  padding: 20px;
  overflow-x: auto;
}

code {
  padding: 2px 6px;
  border-radius: 4px;
  /* Site-M2: inline code in prose carries file paths, URLs and command flags,
     and none of those offer a break opportunity. A single token such as
     `~/.claude/settings.local.json` was pushing whole pages sideways on a phone.
     `anywhere` rather than `break-word` on purpose: only `anywhere` reduces the
     element's min-content width, which is what stops a grid or flex track from
     blowing out around it. */
  overflow-wrap: anywhere;
}

/* Block code keeps its own horizontal scroll — it is read as a unit and must
   not be re-wrapped mid-command. See `pre { overflow-x: auto }` above. */
pre code {
  overflow-wrap: normal;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  border-radius: 0;
}

/* ── LABELS ── */

.label, .mono-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── LAYOUT UTILITIES ── */

.content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 32px;
}

section {
  padding: var(--section-pad) 0;
}

.section-lead {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--text-muted);
  max-width: 720px;
  margin-bottom: 40px;
}

.section-lead strong { color: var(--text); font-weight: 600; }

.divider {
  width: 48px;
  height: 2px;
  background: var(--primary);
  margin-bottom: 24px;
}

/* ── NAVIGATION ── */

.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: rgba(239, 230, 210, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  border-bottom: 1px solid var(--border);
}

.site-nav .nav-inner {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 32px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-nav .nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.site-nav .nav-logo img {
  width: 28px;
  height: 28px;
}

.site-nav .nav-logo span {
  color: var(--primary);
  text-transform: lowercase;
}

.site-nav .nav-links {
  display: flex;
  gap: 32px;
  list-style: none;
}

.site-nav .nav-links a {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.site-nav .nav-links a:hover {
  color: var(--text);
}

.site-nav .nav-links a.active {
  color: var(--primary);
}

.site-nav .nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
}

.site-nav .nav-login {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: #F7F6F2;
  background: var(--cta);
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  text-decoration: none;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.site-nav .nav-login:hover {
  background: var(--accent-dim);
}

/* Hamburger button */
.site-nav .nav-hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-shrink: 0;
}

.site-nav .nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  margin: 5px 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  border-radius: 1px;
}

.site-nav .nav-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-nav .nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.site-nav .nav-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile slide-in panel.
   ── FIX Site-M2 (2026-07-26) — DO NOT RE-PARK THIS PANEL OFF-CANVAS.
   The closed panel used to sit at `right: -280px`. A position:fixed box that
   hangs past the initial containing block is counted into the DOCUMENT's
   scrollable overflow region, so every page carrying this nav had 280px of
   horizontal scroll on a phone — measured on prod at a locked 390x844 viewport:
   documentElement.scrollWidth 655 against clientWidth 375, on 14 of 15 public
   pages. It also left all eight nav links (and Login) focusable while the drawer
   was shut; tabbing into one scrolled the page sideways to chase it.

   The closed panel is now `display: none`, which cannot overflow anything and
   cannot be tabbed into. Measured alternatives that DO NOT work, so nobody
   re-tries them: `transform: translateX(100%)` measures WORSE (935 — transformed
   overflow is still counted); `visibility: hidden` and `content-visibility:
   hidden` change nothing. The slide survives via allow-discrete + @starting-style
   where supported, and degrades to an instant open where it isn't.

   Do NOT answer a future overflow report with `html { overflow-x: hidden }`.
   Two pages shipped exactly that patch and it is why this defect survived for
   months: a page with a root-level clip can never report itself broken again. */
.site-nav .nav-mobile {
  display: none;
  position: fixed;
  top: var(--nav-height);
  right: 0;
  width: 280px;
  height: calc(100vh - var(--nav-height));
  background: var(--surface);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.3s ease, display 0.3s allow-discrete;
  z-index: 999;
  padding: 24px;
  flex-direction: column;
  gap: 8px;
}

.site-nav .nav-mobile.open {
  transform: translateX(0);
}

/* Slide in from off-canvas on first paint of the open state. Browsers without
   @starting-style ignore this block and the panel simply appears. */
@starting-style {
  .site-nav .nav-mobile.open {
    transform: translateX(100%);
  }
}

.site-nav .nav-mobile a {
  display: block;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  padding: 12px 16px;
  border-radius: 6px;
  transition: color 0.2s ease, background 0.2s ease;
}

.site-nav .nav-mobile a:hover {
  color: var(--text);
  background: var(--surface-alt);
}

.site-nav .nav-mobile a.active {
  color: var(--primary);
}

.site-nav .nav-mobile .mobile-login {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: #F7F6F2;
  background: var(--cta);
  text-align: center;
  border-radius: 6px;
  padding: 12px 20px;
}

.site-nav .nav-mobile .mobile-login:hover {
  background: var(--accent-dim);
}

/* Mobile overlay */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  top: var(--nav-height);
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
}

.nav-overlay.open {
  display: block;
}

/* ── FOOTER ── */

.site-footer {
  padding: 60px 0;
  text-align: center;
  background: #16211B;
  border-top: 1px solid var(--border);
}

.site-footer .footer-brand {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: #F7F6F2;
  margin-bottom: 8px;
}

.site-footer .footer-copy {
  font-size: 0.8rem;
  color: #DDE4D2;
  margin-bottom: 12px;
}

.site-footer .footer-links {
  margin-bottom: 16px;
}

.site-footer .footer-links a {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #DDE4D2;
  text-decoration: none;
  letter-spacing: 0.05em;
  margin: 0 12px;
  transition: color 0.2s ease;
}

.site-footer .footer-links a:hover {
  color: #F7F6F2;
}

.site-footer .footer-disclaimer {
  font-size: 0.75rem;
  color: #DDE4D2;
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.6;
}

.site-footer .footer-disclaimer a {
  color: #DDE4D2;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── FLOATING AUDIO PLAYER ── */

.audio-player {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  cursor: pointer;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1), padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 44px;
  padding: 0;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}

.audio-player:hover {
  border-color: var(--border-light);
}

.audio-player.active {
  width: 200px;
  padding: 0 16px 0 14px;
}

.audio-player .audio-icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.audio-player .audio-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

.audio-player.active .audio-icon svg {
  stroke: var(--text-muted);
}

.audio-player .audio-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 100%;
  margin-left: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.audio-player.active .audio-waveform {
  opacity: 1;
}

.audio-player .audio-waveform .bar {
  width: 3px;
  border-radius: 2px;
  animation: waveform 1.2s ease-in-out infinite;
}

.audio-player .audio-waveform .bar:nth-child(1) {
  height: 8px;
  background: var(--carl);
  animation-delay: 0s;
}

.audio-player .audio-waveform .bar:nth-child(2) {
  height: 14px;
  background: var(--diana);
  animation-delay: 0.15s;
}

.audio-player .audio-waveform .bar:nth-child(3) {
  height: 10px;
  background: var(--anthony);
  animation-delay: 0.3s;
}

.audio-player .audio-waveform .bar:nth-child(4) {
  height: 16px;
  background: var(--abish);
  animation-delay: 0.45s;
}

.audio-player .audio-waveform .bar:nth-child(5) {
  height: 6px;
  background: var(--carl);
  animation-delay: 0.6s;
}

.audio-player .audio-waveform .bar:nth-child(6) {
  height: 12px;
  background: var(--diana);
  animation-delay: 0.75s;
}

.audio-player .audio-waveform .bar:nth-child(7) {
  height: 9px;
  background: var(--anthony);
  animation-delay: 0.9s;
}

@keyframes waveform {
  0%, 100% { transform: scaleY(0.4); }
  50%      { transform: scaleY(1); }
}

.audio-player.paused .audio-waveform .bar {
  animation-play-state: paused;
}

/* ── RESPONSIVE BREAKPOINTS ── */

@media (max-width: 768px) {
  :root { --section-pad: 56px; }

  h1 { font-size: 2.2rem; }

  .content { padding: 0 20px; }

  /* Nav: show hamburger, hide desktop links */
  .site-nav .nav-links { display: none; }
  .site-nav .nav-login-desktop { display: none; }
  .site-nav .nav-hamburger { display: block; }
  /* Only the OPEN panel is rendered. A closed panel stays display:none so it
     cannot extend the page's scrollable width or take focus — see Site-M2. */
  .site-nav .nav-mobile.open { display: flex; }
}

@media (max-width: 480px) {
  :root { --section-pad: 40px; }

  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.5rem; }

  .content { padding: 0 16px; }
  .site-nav .nav-inner { padding: 0 16px; }
}

/* ── PRINT ── */

@media print {
  :root {
    --bg: #fff; --surface: #f8f8fa; --surface-alt: #f0f0f4;
    --text: #1a1a1a; --text-muted: #444; --text-dim: #777;
    --border: #ddd; --primary: #2E4A3A; --accent: #C15F3C;
  }
  html { font-size: 13px; background: white; }
  body { background: white; }
  .site-nav { display: none; }
  .audio-player { display: none; }
  .site-footer { border-top: 1px solid #ddd; }
}

/* ============================================================
   M9: AMBIENT EXPERIENCE LAYER
   Design: Diana Reyes
   ============================================================ */

/* ─── D2: Page Entry Animation ─── */

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body {
    animation: none;
  }
  .audio-player .audio-waveform .bar {
    animation: none;
  }
}

/* ─── D4: Cursor Glow (Inhabited Feeling) ─── */

#cursor-glow {
  display: none;
}

@media (max-width: 768px) {
  #cursor-glow {
    display: none;
  }
}

/* ─── D3: Nav Link Animated Underline ─── */

.site-nav .nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-nav .nav-links a:hover::after {
  transform: scaleX(1);
}

/* Active indicator stays visible (override base scaleX(0)) */
.site-nav .nav-links a.active::after {
  transform: scaleX(1);
  transition: none;
}

/* ─── D3: Card Hover Lift ─── */

.card-lift {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 36px rgba(43, 39, 35, 0.10);
}

@media (prefers-reduced-motion: reduce) {
  .card-lift {
    transition: none;
  }
  .card-lift:hover {
    transform: none;
    box-shadow: none;
  }
}
