/* OffCoder website — custom styles. Tailwind handles 95% of layout; this file
   is for things Tailwind doesn't do well (prose, scrollbar, selection, etc.) */

/* Brand tokens — synced from branding/colors/palette.css */
:root {
  --atlas-50:  #FBF9F4;
  --atlas-100: #EDE7D8;
  --atlas-200: #CBD5E1;
  --atlas-400: #94A3B8;
  --atlas-600: #5B7A99;
  --atlas-800: #334155;
  --atlas-900: #0F172A;

  --ember-100: #ECE5D5;
  --ember-200: #E8C4A0;
  --ember-400: #D89868;
  --ember-600: #C2683A;
  --ember-800: #8A4520;

  /* Dark-mode surface tokens (warm slate, slightly cooler than atlas-900) */
  --bg:        #0A0F1A;
  --bg-card:   #10172A;
  --bg-high:   #1A2333;
}

html {
  scroll-behavior: smooth;
}

/* Disclosure-summary used by the top-nav "Our other products" dropdown.
   Hide the default triangle/marker so the rendered summary is just text +
   our own chevron. Also rotates the chevron when the disclosure is open. */
nav details > summary {
  list-style: none;
  cursor: pointer;
}
nav details > summary::-webkit-details-marker { display: none; }
nav details > summary::marker { content: ''; }
nav details[open] > summary svg.chev { transform: rotate(180deg); }
nav details > summary svg.chev { transition: transform 150ms ease; }

body {
  background: var(--bg);
  color: var(--atlas-50);
  /* Subtle ambient gradient — adds depth without being noisy */
  background-image:
    radial-gradient(at 20% 0%, rgba(194, 104, 58, 0.08) 0px, transparent 40%),
    radial-gradient(at 80% 100%, rgba(91, 122, 153, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Smooth transition default — applies to common interactive properties only.
   Not transition-all (= expensive); just colors + opacity + transform. */
a, button, [role="button"] {
  transition-property: color, background-color, border-color, opacity, transform, box-shadow;
  transition-duration: 200ms;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tiny lift on primary CTAs — feels alive without being noisy */
a.btn-lift:hover, button.btn-lift:hover {
  transform: translateY(-1px);
}

/* Selection — ember tint */
::selection {
  background: rgba(194, 104, 58, 0.35);
  color: var(--atlas-50);
}

/* Scrollbar — minimal, dark */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: var(--atlas-800);
  border-radius: 6px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--atlas-600); }

/* Honor user motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Prose (legal pages) ───────────────────────────────────────── */
.prose {
  color: var(--atlas-200);
  line-height: 1.7;
  max-width: 70ch;
}
.prose h1 {
  font-size: 2.25rem; font-weight: 500; color: var(--atlas-50);
  margin-top: 0; margin-bottom: 1.5rem; letter-spacing: -0.02em;
}
.prose h2 {
  font-size: 1.5rem; font-weight: 500; color: var(--atlas-50);
  margin-top: 2.5rem; margin-bottom: 1rem; letter-spacing: -0.015em;
}
.prose h3 {
  font-size: 1.125rem; font-weight: 500; color: var(--atlas-50);
  margin-top: 2rem; margin-bottom: 0.75rem;
}
.prose p { margin-bottom: 1.25rem; }
.prose ul, .prose ol { margin-bottom: 1.25rem; padding-left: 1.5rem; }
.prose li { margin-bottom: 0.5rem; }
.prose ul li { list-style: disc; }
.prose ol li { list-style: decimal; }
.prose a {
  color: var(--ember-400);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: color 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.prose a:hover { color: var(--ember-200); }
.prose strong { color: var(--atlas-50); font-weight: 500; }
.prose code {
  background: var(--bg-high);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.875em;
  color: var(--ember-200);
  font-family: 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
}
.prose hr {
  border: none;
  border-top: 1px solid var(--atlas-800);
  margin: 2.5rem 0;
}
.prose blockquote {
  border-left: 3px solid var(--ember-400);
  padding: 0.75rem 1.25rem;
  margin: 1.5rem 0;
  color: var(--atlas-100);
  background: var(--bg-card);
  border-radius: 0 6px 6px 0;
}
.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.9rem;
}
.prose th, .prose td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--atlas-800);
  text-align: left;
}
.prose th {
  background: var(--bg-card);
  font-weight: 500;
  color: var(--atlas-50);
}

/* ─── Subtle decorative class for content sections ───────────────── */
.section-divider {
  border-top: 1px solid var(--atlas-800);
}

/* ─── Homepage hero — drifting coding glyphs background ───────────
   Ambient animation: ~12 glyphs drift slowly across the hero, each
   with its own start position, opacity, size, and animation timing.
   Two soft blobs and a faint horizontal grid add depth. All purely
   decorative — pointer-events disabled at the wrapper level, no JS.
*/
.hero-bg .glyph {
  position: absolute;
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  color: rgba(194, 104, 58, 0.18); /* ember-600 @ 18% */
  user-select: none;
  white-space: nowrap;
  letter-spacing: -0.02em;
  text-shadow: 0 0 24px rgba(194, 104, 58, 0.15);
}

@keyframes drift-up {
  0%   { transform: translateY(0)    rotate(-2deg); opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { transform: translateY(-40px) rotate(3deg); opacity: 0; }
}
@keyframes drift-side {
  0%, 100% { transform: translate(0, 0)         rotate(-1deg); }
  50%      { transform: translate(20px, -14px)  rotate(2deg); }
}
@keyframes drift-diag {
  0%, 100% { transform: translate(0, 0)         rotate(2deg); opacity: 0.55; }
  50%      { transform: translate(-18px, -22px) rotate(-2deg); opacity: 1; }
}

/* Each glyph: unique placement, size, animation, delay. The numbers
   look arbitrary because they are — hand-tuned to feel scattered. */
.hero-bg .g1  { top:  8%; left:  6%; font-size: 4.0rem; animation: drift-side 5.5s ease-in-out infinite; animation-delay: -0.5s; }
.hero-bg .g2  { top: 12%; right: 8%; font-size: 2.8rem; animation: drift-up   9s ease-in-out infinite; animation-delay: -3s;   }
.hero-bg .g3  { top: 22%; left: 14%; font-size: 2.4rem; animation: drift-diag 7s ease-in-out infinite; animation-delay: -6s;   color: rgba(216, 152, 104, 0.22); /* ember-400 @ 22% */ }
.hero-bg .g4  { top: 28%; right: 16%; font-size: 3.6rem; animation: drift-side 8s ease-in-out infinite; animation-delay: -9s;  }
.hero-bg .g5  { top: 38%; left:  4%; font-size: 1.8rem; animation: drift-diag 5s ease-in-out infinite; animation-delay: -1s;   }
.hero-bg .g6  { top: 46%; right: 12%; font-size: 2.2rem; animation: drift-up  10s ease-in-out infinite; animation-delay: -7s;   }
.hero-bg .g7  { top: 56%; left: 18%; font-size: 1.6rem; animation: drift-side 6s ease-in-out infinite; animation-delay: -4s;   color: rgba(91, 122, 153, 0.32); /* atlas-600 @ 32% */ }
.hero-bg .g8  { top: 64%; right:  6%; font-size: 2.6rem; animation: drift-diag 7.5s ease-in-out infinite; animation-delay: -2s;  }
.hero-bg .g9  { top: 72%; left:  8%; font-size: 2.0rem; animation: drift-up   8.5s ease-in-out infinite; animation-delay: -8s;   }
.hero-bg .g10 { top: 78%; right: 22%; font-size: 1.6rem; animation: drift-side 6.5s ease-in-out infinite; animation-delay: -5s;  color: rgba(216, 152, 104, 0.20); }
.hero-bg .g11 { top: 84%; left: 24%; font-size: 1.4rem; animation: drift-diag 9.5s ease-in-out infinite; animation-delay: -11s; color: rgba(91, 122, 153, 0.28); }
.hero-bg .g12 { top: 88%; right: 14%; font-size: 1.5rem; animation: drift-up  11s ease-in-out infinite; animation-delay: -10s; }

/* Soft glow blobs behind the glyphs — one warm (ember), one cool (atlas)
   so the cluster doesn't feel mono-tone. */
.hero-bg .hero-blob {
  position: absolute;
  border-radius: 9999px;
  filter: blur(80px);
  opacity: 0.35;
}
.hero-bg .hero-blob-1 {
  width: 480px; height: 480px;
  top: 20%; left: -100px;
  background: radial-gradient(circle, rgba(194, 104, 58, 0.6) 0%, transparent 70%);
  animation: drift-side 12s ease-in-out infinite;
}
.hero-bg .hero-blob-2 {
  width: 380px; height: 380px;
  bottom: 10%; right: -80px;
  background: radial-gradient(circle, rgba(91, 122, 153, 0.5) 0%, transparent 70%);
  animation: drift-side 14s ease-in-out infinite;
  animation-delay: -8s;
}

/* Faint horizontal scan grid for the "code editor" vibe */
.hero-bg .hero-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(194, 104, 58, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(194, 104, 58, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
}

/* Honor reduced-motion users — they get the static positions but no
   movement. Cleaner than animating and trying to dial it down. */
@media (prefers-reduced-motion: reduce) {
  .hero-bg .glyph, .hero-bg .hero-blob {
    animation: none;
  }
}

/* On narrow phones, hide the smallest glyphs + drop the grid so the
   hero text isn't fighting for space. */
@media (max-width: 640px) {
  .hero-bg .g5, .hero-bg .g7, .hero-bg .g10, .hero-bg .g11, .hero-bg .g12,
  .hero-bg .hero-grid {
    display: none;
  }
  .hero-bg .glyph {
    font-size: 1.6rem !important;
    opacity: 0.6;
  }
}
