/* ==========================================================================
   BentoCoder — base.css
   Design tokens, reset, typography, layout utilities, reveal animation.
   ========================================================================== */

:root {
  /* Tray (backgrounds) */
  --tray: #0f0f10;
  --tray-2: #18181a;
  --tray-3: #222225;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Compartments (from the logo) */
  --rice: #f2ede6;
  /* --orange: #eb6434; */
  --orange: #e05a2b;
  --orange-soft: rgba(235, 100, 52, 0.14);
  --green: #7cab3a;
  --green-soft: rgba(124, 171, 58, 0.14);
  --yellow: #ffa31a;
  --yellow-soft: rgba(255, 163, 26, 0.14);
  --steel: #8e9096;
  --steel-soft: rgba(142, 144, 150, 0.14);
  --ink: #141414;

  /* Text */
  --text: var(--rice);
  --text-muted: #a9a59f;
  --text-dim: #8c8781; /* ≥ 4.5:1 contrast on --tray and --tray-2 (WCAG AA) */

  /* Type */
  --font-display: 'Syne', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'DM Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

  /* Layout */
  --container: 1200px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-y: clamp(4rem, 10vw, 7.5rem);
  --radius: 14px;
  --radius-sm: 8px;
  --nav-h: 72px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 1rem);
}

body {
  min-height: 100vh;
  background: var(--tray);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; }

::selection { background: var(--orange); color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  text-wrap: balance;
  overflow-wrap: break-word;
}

p { text-wrap: pretty; }

.mono { font-family: var(--font-mono); }
.accent { color: var(--orange); }
.muted { color: var(--text-muted); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }
.section--alt {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01));
  border-block: 1px solid var(--line);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem; left: 0.75rem;
  z-index: 1000;
  padding: 0.6rem 1rem;
  background: var(--orange);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s;
}
.skip-link:focus { transform: none; }

/* Faint grid, like the inside of a tray */
.bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

/* ---------- Reveal on scroll ----------
   Only hide content when JS is running (html.js), so it never stays hidden. */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0s);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}
