/* ==========================================================================
   DESIGN SYSTEM — "Lamplight"
   A reusable token + component layer. Drop this file into any page and
   build with the classes/variables below to keep interfaces unified.
   Depends on: Source Serif 4 (display) + Inter (body), loaded via <link>.
   ========================================================================== */

/* -------------------------------- Tokens -------------------------------- */
:root {
  /* Color — surfaces */
  --void: #0F1113;
  --surface: #1A1C1F;
  --surface-2: #23262A;
  --surface-3: #2E3136;
  --border: #2E3136;
  --border-soft: rgba(255, 255, 255, 0.07);

  /* Color — accents */
  --sand: #D6DDC4;
  --accent: #F4A261;
  --accent-dim: #C9814D;
  --accent-wash: rgba(244, 162, 97, 0.12);
  --accent-glow: rgba(244, 162, 97, 0.28);

  /* Color — text */
  --ink-0: #F5F3EE;
  --ink-1: #C7C9CC;
  --ink-2: #8B8F94;
  --ink-3: #5E6267;

  /* Type */
  --font-display: "Source Serif 4", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --fs-2xs: 0.6875rem;   /* 11px */
  --fs-xs: 0.8125rem;    /* 13px */
  --fs-sm: 0.9375rem;    /* 15px */
  --fs-md: 1.0625rem;    /* 17px */
  --fs-lg: 1.375rem;     /* 22px */
  --fs-xl: 2rem;         /* 32px */
  --fs-2xl: clamp(2.25rem, 3.4vw, 3rem);
  --fs-3xl: clamp(2.75rem, 5vw, 4rem);

  --lh-tight: 1.15;
  --lh-snug: 1.35;
  --lh-normal: 1.6;

  --tracking-wide: 0.09em;
  --tracking-wider: 0.14em;

  /* Space scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --sp-20: 80px;
  --sp-24: 96px;
  --sp-32: 128px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 160ms;
  --dur-med: 320ms;
  --dur-slow: 640ms;

  /* Layout */
  --container-w: 1180px;
  --edge: clamp(24px, 5vw, 64px);
}

@media (prefers-reduced-motion: reduce) {
  :root { --dur-fast: 0ms; --dur-med: 0ms; --dur-slow: 0ms; }
}

/* -------------------------------- Reset ---------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: dark; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--void);
  color: var(--ink-1);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p { margin: 0; }

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

/* ------------------------------ Typography ------------------------------- */
.font-display { font-family: var(--font-display); }
.font-body { font-family: var(--font-body); }

.display-3xl { font-family: var(--font-display); font-size: var(--fs-3xl); line-height: var(--lh-tight); font-weight: 400; letter-spacing: -0.01em; color: var(--ink-0); }
.display-2xl { font-family: var(--font-display); font-size: var(--fs-2xl); line-height: var(--lh-tight); font-weight: 400; letter-spacing: -0.01em; color: var(--ink-0); }
.display-lg  { font-family: var(--font-display); font-size: var(--fs-xl);  line-height: var(--lh-snug); font-weight: 400; color: var(--ink-0); }
.display-md  { font-family: var(--font-display); font-size: var(--fs-lg);  line-height: var(--lh-snug); font-weight: 400; color: var(--ink-0); }

.text-body    { font-size: var(--fs-md); color: var(--ink-1); }
.text-sm      { font-size: var(--fs-sm); color: var(--ink-1); }
.text-xs      { font-size: var(--fs-xs); color: var(--ink-2); }
.text-muted   { color: var(--ink-2); }
.text-faint   { color: var(--ink-3); }
.text-accent  { color: var(--accent); }
.text-ink0    { color: var(--ink-0); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-wash);
  flex: none;
}
.eyebrow.muted { color: var(--ink-2); }
.eyebrow.muted::before { background: var(--ink-2); box-shadow: none; }

/* -------------------------------- Layout --------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-w);
  margin-inline: auto;
  padding-inline: var(--edge);
}
.section { padding-block: var(--sp-24); }
.section-tight { padding-block: var(--sp-16); }

.stack-4 > * + * { margin-top: var(--sp-4); }
.stack-6 > * + * { margin-top: var(--sp-6); }
.stack-8 > * + * { margin-top: var(--sp-8); }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }

.grid { display: grid; gap: var(--sp-8); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (min-width: 901px) and (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

.divider {
  height: 1px;
  width: 100%;
  background: var(--border);
  border: 0;
}

/* -------------------------------- Buttons --------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-6);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.btn svg { width: 16px; height: 16px; transition: transform var(--dur-fast) var(--ease-out); }

.btn-primary {
  background: var(--accent);
  color: #1A1206;
}
.btn-primary:hover { box-shadow: 0 0 0 6px var(--accent-wash); transform: translateY(-1px); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--ink-0);
}
.btn-ghost:hover { border-color: var(--accent); background: var(--accent-wash); }

.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.link-arrow svg { width: 15px; height: 15px; transition: transform var(--dur-fast) var(--ease-out); }
.link-arrow:hover svg { transform: translate(3px, -3px); }

/* --------------------------------- Nav ------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: var(--sp-5);
  background: color-mix(in srgb, var(--void) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled { border-bottom-color: var(--border); }

.nav-mark {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  color: var(--ink-0);
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
}
.nav-mark .dot { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: var(--sp-8); }
.nav-links a {
  font-size: var(--fs-sm);
  color: var(--ink-1);
  position: relative;
  padding-bottom: 4px;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 0;
  height: 1px;
  background: var(--accent);
  transition: width var(--dur-fast) var(--ease-out);
}
.nav-links a:hover { color: var(--ink-0); }
.nav-links a:hover::after { width: 100%; }
.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
}

/* --------------------------------- Cards ----------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}
.card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border-soft));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent), 0 24px 48px -24px rgba(0,0,0,0.6);
  transform: translateY(-4px);
}

.icon-tile {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--accent);
  transition: background var(--dur-med) var(--ease-out), box-shadow var(--dur-med) var(--ease-out);
}
.icon-tile svg { width: 20px; height: 20px; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  font-size: var(--fs-2xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--ink-2);
}

/* -------------------------------- Socials ---------------------------------- */
.social-row { display: flex; gap: var(--sp-3); }
.social-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  color: var(--ink-1);
  transition: color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.social-btn svg { width: 17px; height: 17px; }
.social-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }

/* -------------------------------- Forms ------------------------------------ */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.field label { font-size: var(--fs-xs); color: var(--ink-2); letter-spacing: var(--tracking-wide); text-transform: uppercase; }
.field input, .field textarea {
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
  color: var(--ink-0);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  transition: border-color var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field input:focus, .field textarea:focus { border-color: var(--accent); background: var(--surface); outline: none; }

/* ------------------------------ Code window --------------------------------- */
/* A decorative terminal/code window — reusable anywhere a portrait or product
   shot doesn't fit (about sections, empty states, hero alternates). */
.code-window {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
}
.code-window-bar {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.code-window-bar span {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--border);
}
.code-window-bar .dot-a { background: #4a4d52; }
.code-window-bar .dot-b { background: #6b6e73; }
.code-window-bar .dot-c { background: var(--accent); }
.code-window-title { margin-left: var(--sp-2); font-size: var(--fs-2xs); color: var(--ink-3); letter-spacing: var(--tracking-wide); }
.code-window pre {
  margin: 0;
  padding: var(--sp-6);
  font-size: var(--fs-xs);
  line-height: 1.9;
  color: var(--ink-2);
  overflow-x: auto;
}
.code-window .tok-key { color: var(--accent); }
.code-window .tok-str { color: var(--sand); }
.code-window .tok-com { color: var(--ink-3); }
.code-window .tok-fn  { color: #E9C8A6; }

/* -------------------------------- Toast -------------------------------------- */
.toast {
  position: fixed;
  bottom: var(--sp-8);
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--ink-0);
  font-size: var(--fs-xs);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out);
  z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast svg { width: 14px; height: 14px; color: var(--accent); }

/* ------------------------------ Skeleton loading ------------------------------ */
.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skeleton-sheen 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-sheen {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ------------------------------ Utilities ---------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}
