/* ============================================================
   base.css
   Reset, base typography, and layout primitives shared by
   every page. Depends on tokens.css for color variables.
   ============================================================ */

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Geist', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.4s, color 0.4s;
}

::selection { background: var(--heat); color: var(--paper); }

/* Scrollbar (homepage uses it; harmless on every page) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper-2); }
::-webkit-scrollbar-thumb { background: var(--ink); }

/* Mono helper + uppercase label primitives */
.mono { font-family: 'Geist Mono', monospace; }
.meta {
  font-family: 'Geist Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-soft);
}
.meta-thin {
  font-family: 'Geist Mono', monospace; font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--muted);
}

/* ------------------------------------------------------------
   .wrap is the page content container. Default width matches
   the case-study pages (1280px). The homepage overrides this
   to 1800px in portfolio.css.
   ------------------------------------------------------------ */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 768px) { .wrap { padding: 0 40px; } }

/* Respect reduced motion globally */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------
   Back to top button. Injected by JS on every page (case-study
   pages via lightbox.js, homepage via portfolio.js). Fixed
   bottom-right, fades in after scrolling down one viewport.
   ------------------------------------------------------------ */
.back-to-top {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 900;
  width: 48px; height: 48px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: var(--heat);
  cursor: pointer;
  background: var(--glass-bg);
  border: 0.5px solid var(--glass-border);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--glass-shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .3s ease, transform .3s ease, background .2s ease, border-color .2s ease;
}
.back-to-top.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:hover {
  border-color: var(--heat);
  transform: translateY(-2px);
}
.back-to-top:focus-visible { outline: 2px solid var(--heat); outline-offset: 3px; }
.back-to-top svg { width: 20px; height: 20px; }
@media (min-width: 768px) {
  .back-to-top { bottom: 32px; right: 32px; }
}
