/* ═══════════════════════════════════════════════════════════════
   TOOLVAULT — core.css
   CSS custom properties, reset, typography, utility classes.
   Import this first on every page.
   ═══════════════════════════════════════════════════════════════ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;1,9..144,300;1,9..144,400;1,9..144,500&family=Outfit:wght@300;400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── Theme tokens (ALTO) ── */
:root,
[data-theme="dark"] {
  --bg:      #1a1714;
  --bg2:     #211e1a;
  --bg3:     #2b2722;
  --bd:      #332f28;
  --bd2:     #3f3930;
  --tx:      #f0ebe3;
  --tx2:     #9a8e7e;
  --tx3:     #5a5248;
  --ac:      #e07d3c;
  --ac-dim:  rgba(224,125,60,0.12);
  --ac-glow: rgba(224,125,60,0.25);
  --danger:  #e05252;
  --success: #5aab6a;
  --r:       6px;
  --rl:      12px;
  --shadow:  0 2px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.45);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg:      #faf7f2;
  --bg2:     #ffffff;
  --bg3:     #f2ece4;
  --bd:      #e4d8ca;
  --bd2:     #d4c8b8;
  --tx:      #1a1510;
  --tx2:     #7a6a58;
  --tx3:     #b0a090;
  --ac:      #c4601e;
  --ac-dim:  rgba(196,96,30,0.09);
  --ac-glow: rgba(196,96,30,0.2);
  --danger:  #c94040;
  --success: #3d8a4e;
  --shadow:  0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  color-scheme: light;
}

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--tx);
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s, color 0.25s;
  min-height: 100dvh;
}
img, video, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; font-size: inherit; }
a { color: var(--ac); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { list-style: none; }
hr { border: none; border-top: 1px solid var(--bd); }

/* ── Typography scale ── */
.font-display { font-family: 'Fraunces', serif; }
.font-mono    { font-family: 'DM Mono', monospace; }

h1, .h1 {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
h2, .h2 {
  font-family: 'Fraunces', serif;
  font-size: clamp(1.3rem, 3vw, 1.8rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
h3, .h3 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.text-xs  { font-size: 0.72rem; }
.text-sm  { font-size: 0.82rem; }
.text-md  { font-size: 0.92rem; }
.text-lg  { font-size: 1.1rem; }
.text-muted  { color: var(--tx2); }
.text-dim    { color: var(--tx3); }
.text-accent { color: var(--ac); }
.text-mono   { font-family: 'DM Mono', monospace; }
.italic { font-style: italic; }
.font-light  { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semi   { font-weight: 600; }

/* ── Spacing ── */
.mt-auto { margin-top: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.gap-xs  { gap: 0.35rem; }
.gap-sm  { gap: 0.6rem; }
.gap-md  { gap: 1rem; }
.gap-lg  { gap: 1.5rem; }
.gap-xl  { gap: 2rem; }

/* ── Flex/grid helpers ── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.flex-1      { flex: 1; }
.min-w-0     { min-width: 0; }
.w-full      { width: 100%; }
.hidden      { display: none !important; }
.sr-only     { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Focus ring (accessibility) ── */
:focus-visible {
  outline: 2px solid var(--ac);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--tx3); }

/* ── Selection ── */
::selection { background: var(--ac-dim); color: var(--tx); }

/* ── Theme transition ── */
*, *::before, *::after {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 0.2s;
  transition-timing-function: ease;
}
/* Don't animate layout properties */
.no-transition { transition: none !important; }

/* ── Shared lightbox ── */
.tv-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s !important;
}
.tv-lightbox.open { opacity: 1; pointer-events: all; }
.tv-lightbox-img {
  max-width: min(92vw, 960px);
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
  display: block;
  transition: none !important;
}
.tv-lightbox-close,
.tv-lightbox-nav {
  position: fixed;
  background: rgba(26, 23, 20, 0.72);
  border: 1px solid rgba(240, 235, 227, 0.1);
  border-radius: 50%;
  color: rgba(240, 235, 227, 0.65);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s, color 0.15s, background 0.15s !important;
}
.tv-lightbox-close:hover,
.tv-lightbox-nav:hover {
  border-color: #e07d3c;
  color: #e07d3c;
  background: rgba(26, 23, 20, 0.9);
}
/* Close button — × symbol via CSS */
.tv-lightbox-close { top: 1rem; right: 1rem; width: 36px; height: 36px; font-size: 0.9rem; }
/* Nav arrows — CSS chevrons, perfectly centered */
.tv-lightbox-nav   { top: 50%; transform: translateY(-50%); width: 40px; height: 40px; font-size: 0; }
.tv-lightbox-nav.prev { left: 1rem; }
.tv-lightbox-nav.next { right: 1rem; }
.tv-lightbox-nav:disabled { opacity: 0.18; pointer-events: none; }
.tv-lightbox-nav::after {
  content: '';
  display: block;
  width: 9px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-top: 1.5px solid currentColor;
  transition: border-color 0.15s !important;
}
.tv-lightbox-nav.prev::after { transform: rotate(-135deg) translate(-1px, 1px); }
.tv-lightbox-nav.next::after { transform: rotate(45deg) translate(-1px, 1px); }
.tv-lightbox-info {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.6);
  color: rgba(255, 255, 255, 0.85);
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  padding: 0.3rem 0.9rem;
  border-radius: 99px;
  pointer-events: none;
  white-space: nowrap;
  transition: none !important;
}

/* ── Cookie consent banner ── */
#cookie-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  background: var(--bg2);
  border-top: 1px solid var(--bd);
  padding: 0.85rem 1.25rem;
}
.cookie-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.cookie-msg {
  flex: 1;
  min-width: 200px;
  font-size: 0.8rem;
  color: var(--tx2);
  line-height: 1.6;
}
.cookie-msg code {
  font-family: 'DM Mono', monospace;
  color: var(--ac);
  font-size: 0.75rem;
  display: block;
  margin-bottom: 0.2rem;
}
.cookie-btns {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
