/* =========================================================================
   TexelPack — site stylesheet
   Dark theme, Blender-orange accent. No build step, no external deps.
   Edit design tokens in :root below to retheme the whole site.
   ========================================================================= */

/* ---- Design tokens ----------------------------------------------------- */
:root {
  /* Surfaces */
  --bg:          #14110f;   /* page background */
  --bg-alt:      #1a1715;   /* alternating sections */
  --surface:     #1f1c19;   /* cards */
  --surface-2:   #262220;   /* raised cards / hover */
  --border:      #34302c;   /* hairlines */
  --border-soft: #2a2623;

  /* Text */
  --text:        #ececec;
  --text-muted:  #a39e98;
  --text-dim:    #7b766f;

  /* Brand */
  --accent:      #ff7a18;   /* Blender orange */
  --accent-600:  #e96b0c;
  --accent-soft: rgba(255, 122, 24, 0.14);
  --accent-glow: rgba(255, 122, 24, 0.30);
  --link:        #ffa45c;

  /* Status (mirror the in-addon overlay legend) */
  --ok:    #4fc77d;
  --warn:  #ffd24a;
  --bad:   #ff5d52;
  --info:  #4a9eff;

  /* Type */
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;

  /* Layout */
  --maxw: 1140px;
  --maxw-prose: 760px;
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 64px;

  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; }
a { color: var(--link); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--accent); }

h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); }
h3 { font-size: 1.25rem; }
p  { color: var(--text-muted); }

code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 0.1em 0.45em;
  font-size: 0.82em;
  color: var(--text);
  white-space: nowrap;
}

::selection { background: var(--accent); color: #1a1715; }

/* ---- Layout helpers ---------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 24px; }
.section { padding-block: clamp(56px, 9vw, 110px); }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border-soft); }
.section__head { max-width: 680px; margin: 0 auto clamp(32px, 5vw, 56px); text-align: center; }
.section__head p { margin-top: 14px; font-size: 1.08rem; }
.eyebrow {
  display: inline-block;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.text-center { text-align: center; }
.muted { color: var(--text-muted); }

/* ---- Buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.55em;
  font-weight: 600; font-size: 0.98rem;
  padding: 0.7em 1.4em;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s var(--ease), background 0.15s var(--ease), border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent); color: #1a1311;
  box-shadow: 0 6px 22px -6px var(--accent-glow);
}
.btn--primary:hover { background: var(--accent-600); color: #1a1311; box-shadow: 0 10px 30px -8px var(--accent-glow); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); border-color: var(--text-dim); }
.btn--block { width: 100%; justify-content: center; }
.btn--lg { padding: 0.85em 1.7em; font-size: 1.05rem; }

/* ---- Header ------------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--header-h);
  background: rgba(20, 17, 15, 0.82);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.site-header__inner {
  height: 100%;
  display: flex; align-items: center; gap: 28px;
  max-width: var(--maxw); margin-inline: auto; padding-inline: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -0.02em; }
.brand:hover { color: var(--text); }
.brand__mark {
  width: 28px; height: 28px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent-600));
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset;
}
.brand__mark svg { width: 17px; height: 17px; }
.brand b { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav a {
  color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
  padding: 8px 12px; border-radius: 7px;
}
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a.is-active { color: var(--accent); }
.nav__cta { margin-left: 10px; }
/* El CTA del header es un btn--primary: texto oscuro legible sobre naranja
   (las reglas .nav a / .nav a:hover lo pisaban con texto claro). */
.nav a.btn--primary { color: #1a1311; }
.nav a.btn--primary:hover { color: #1a1311; background: var(--accent-600); }

/* Language switcher (built by include.js) */
.nav__lang { position: relative; margin-left: 6px; }
.lang-switch { position: relative; }
.lang-switch summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 10px; border-radius: 7px;
  color: var(--text-muted); font-size: 0.9rem; font-weight: 500;
  border: 1px solid var(--border);
}
.lang-switch summary::-webkit-details-marker { display: none; }
.lang-switch summary:hover { color: var(--text); background: var(--surface); }
.lang-switch summary svg { width: 16px; height: 16px; flex: none; }
.lang-switch summary .chev { width: 13px; height: 13px; transition: transform 0.15s var(--ease); }
.lang-switch[open] summary .chev { transform: rotate(180deg); }
.lang-switch__menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 120;
  min-width: 168px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow);
  display: grid; gap: 2px;
}
.lang-switch__menu a {
  display: block; padding: 9px 12px; border-radius: 6px;
  color: var(--text-muted); font-size: 0.92rem; font-weight: 500;
}
.lang-switch__menu a:hover { background: var(--surface-2); color: var(--text); }
.lang-switch__menu a.is-active { color: var(--accent); background: var(--accent-soft); }

@media (max-width: 860px) {
  .nav__lang { margin: 12px 0 0; }
  .lang-switch summary { width: 100%; justify-content: center; }
  .lang-switch__menu { position: static; box-shadow: none; margin-top: 6px; }
}

.nav-toggle {
  display: none; margin-left: auto;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  width: 42px; height: 38px; cursor: pointer; color: var(--text);
  align-items: center; justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 860px) {
  .nav-toggle { display: inline-flex; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--bg-alt); border-bottom: 1px solid var(--border);
    padding: 14px 20px 22px; margin-left: 0;
    transform: translateY(-120%); transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow);
  }
  .nav.is-open { transform: translateY(0); }
  .nav a { padding: 12px 10px; font-size: 1.02rem; }
  .nav__cta { margin: 10px 0 0; }
}

/* ---- Hero -------------------------------------------------------------- */
.hero { position: relative; padding-top: clamp(60px, 9vw, 110px); padding-bottom: clamp(60px, 9vw, 110px); overflow: hidden; }
.hero::before {
  /* texel / atlas grid motif */
  content: ""; position: absolute; inset: 0; z-index: 0;
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 30%, transparent 75%);
  opacity: 0.5;
}
.hero::after {
  content: ""; position: absolute; z-index: 0; top: -20%; left: 50%; transform: translateX(-50%);
  width: 720px; height: 520px; pointer-events: none;
  background: radial-gradient(circle, var(--accent-glow), transparent 65%);
  filter: blur(30px); opacity: 0.55;
}
.hero__inner { position: relative; z-index: 1; text-align: center; max-width: 820px; margin-inline: auto; }
.hero__badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
  padding: 6px 14px; border-radius: 999px; margin-bottom: 26px;
}
.hero__badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.hero h1 { margin-bottom: 20px; }
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), #ffb056);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub { font-size: clamp(1.05rem, 2.2vw, 1.3rem); max-width: 620px; margin: 0 auto 32px; color: var(--text-muted); }
.hero__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero__meta { margin-top: 22px; font-size: 0.88rem; color: var(--text-dim); }

/* ---- Feature grid ------------------------------------------------------ */
.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) { .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 24px;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), background 0.18s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); background: var(--surface-2); }
.card__icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 16px;
}
.card__icon svg { width: 24px; height: 24px; }
.card h3 { margin-bottom: 8px; }
.card p { font-size: 0.95rem; }

/* feature group label inside features section */
.feature-group__title { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 48px 0 18px; }
.feature-group:first-of-type .feature-group__title { margin-top: 0; }

/* ---- Table ------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
thead th { background: var(--surface-2); color: var(--text); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface); }
.stars { color: var(--accent); letter-spacing: 2px; }
.stars .off { color: var(--border); }

/* ---- Steps (quick start) ---------------------------------------------- */
.steps { counter-reset: step; display: grid; gap: 18px; max-width: 720px; margin-inline: auto; }
.step { display: grid; grid-template-columns: 44px 1fr; gap: 18px; align-items: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.step__num { counter-increment: step; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; }
.step__num::before { content: counter(step); }
.step h3 { margin-bottom: 4px; }
.step p { font-size: 0.95rem; }

/* ---- Code blocks ------------------------------------------------------- */
pre {
  background: #0e0c0b; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px 20px; overflow-x: auto;
  font-size: 0.88rem; line-height: 1.55; color: #d6d2cc;
}
pre code { color: inherit; }
:not(pre) > code {
  background: var(--surface-2); border: 1px solid var(--border-soft);
  padding: 0.12em 0.42em; border-radius: 5px; color: var(--link); font-size: 0.88em;
}

/* ---- Callouts ---------------------------------------------------------- */
.callout {
  display: flex; gap: 12px;
  border: 1px solid var(--border); border-left-width: 3px;
  background: var(--surface); border-radius: var(--radius-sm);
  padding: 14px 18px; margin: 22px 0; font-size: 0.95rem;
}
.callout p { color: var(--text); }
.callout__icon { flex: none; font-size: 1.1rem; line-height: 1.5; }
.callout--note { border-left-color: var(--info); }
.callout--tip  { border-left-color: var(--ok); }
.callout--warn { border-left-color: var(--warn); }

/* legend chips (overlay colors) */
.legend { display: flex; flex-wrap: wrap; gap: 10px; margin: 18px 0; }
.legend span { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text-muted); }
.legend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* ---- CTA band ---------------------------------------------------------- */
.cta-band { text-align: center; }
.cta-band__box {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border); border-radius: 20px;
  padding: clamp(40px, 6vw, 72px) 24px;
}
.cta-band__box::before {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, var(--accent-glow), transparent 60%); opacity: 0.5;
}
.cta-band__box > * { position: relative; }
.cta-band h2 { margin-bottom: 14px; }
.cta-band p { max-width: 520px; margin: 0 auto 28px; }

/* =========================================================================
   Docs layout
   ========================================================================= */
.docs { display: grid; grid-template-columns: 256px minmax(0, 1fr); gap: 48px;
  max-width: var(--maxw); margin-inline: auto; padding: 40px 24px clamp(60px, 9vw, 100px); align-items: start; }

.docs-side { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; max-height: calc(100vh - var(--header-h) - 40px); overflow-y: auto; }
.docs-side__group { margin-bottom: 24px; }
.docs-side__title { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 8px; padding-left: 12px; }
.docs-side ul { list-style: none; padding: 0; }
.docs-side a { display: block; color: var(--text-muted); font-size: 0.93rem; padding: 7px 12px; border-radius: 7px; border-left: 2px solid transparent; }
.docs-side a:hover { color: var(--text); background: var(--surface); }
.docs-side a.is-active { color: var(--accent); background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }

.docs-main { min-width: 0; max-width: var(--maxw-prose); }
.docs-main h1 { margin-bottom: 10px; }
.docs-main > p.lead { font-size: 1.12rem; color: var(--text-muted); margin-bottom: 30px; }
.docs-main h2 { margin: 44px 0 16px; padding-top: 8px; border-top: 1px solid var(--border-soft); }
.docs-main h2:first-of-type { border-top: 0; }
.docs-main h3 { margin: 28px 0 10px; }
.docs-main p, .docs-main ul, .docs-main ol { margin-bottom: 16px; }
.docs-main ul, .docs-main ol { padding-left: 22px; color: var(--text-muted); }
.docs-main li { margin-bottom: 6px; }
.docs-main li::marker { color: var(--accent); }
.docs-main .table-wrap { margin: 20px 0; }

.docs-breadcrumb { font-size: 0.85rem; color: var(--text-dim); margin-bottom: 18px; }
.docs-breadcrumb a { color: var(--text-muted); }

.docs-pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--border); }
.docs-pager a { display: flex; flex-direction: column; gap: 2px; flex: 1; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.docs-pager a:hover { border-color: var(--accent); background: var(--surface); }
.docs-pager a.next { text-align: right; align-items: flex-end; }
.docs-pager small { color: var(--text-dim); font-size: 0.78rem; }
.docs-pager span { color: var(--text); font-weight: 600; }

.docs-toggle { display: none; }

@media (max-width: 900px) {
  .docs { grid-template-columns: 1fr; gap: 0; }
  .docs-side {
    position: static; max-height: none; overflow: visible;
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; margin-bottom: 28px;
  }
}

/* ---- Footer ------------------------------------------------------------ */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--border); padding-block: 56px 32px; margin-top: 0; }
.site-footer__grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 40px; }
@media (max-width: 760px) { .site-footer__grid { grid-template-columns: 1fr 1fr; gap: 32px 24px; } }
@media (max-width: 460px) { .site-footer__grid { grid-template-columns: 1fr; } }
.site-footer__brand p { font-size: 0.92rem; margin-top: 12px; max-width: 280px; }
.site-footer h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 14px; }
.site-footer ul { list-style: none; padding: 0; display: grid; gap: 9px; }
.site-footer a { color: var(--text-muted); font-size: 0.93rem; }
.site-footer a:hover { color: var(--accent); }
.site-footer__bottom {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px;
  margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border-soft);
  font-size: 0.85rem; color: var(--text-dim);
}
.site-footer__bottom a { color: var(--text-dim); }

/* ---- Reveal-on-scroll (progressive enhancement) ------------------------ */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}

/* ---- Interface overview page ------------------------------------------- */
.cat { margin: 40px 0; scroll-margin-top: calc(var(--header-h) + 16px); }
.cat__head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.cat__icon {
  width: 38px; height: 38px; flex: none; border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.cat__icon svg { width: 22px; height: 22px; }
.cat__head h2 { margin: 0; border: 0; padding: 0; }
/* Screenshot placeholder — swap each for an <img> when captures are ready (#229). */
.shot {
  display: grid; place-items: center; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: var(--surface-2); color: var(--text-dim);
  aspect-ratio: 16 / 10; margin: 16px 0; padding: 24px; font-size: 0.9rem;
}
.shot svg { width: 30px; height: 30px; margin-bottom: 10px; opacity: 0.6; }
.shot span { max-width: 380px; }
.shot img, .shot video { width: 100%; height: 100%; object-fit: contain; border-radius: var(--radius); }
.shot--filled { border-style: solid; padding: 0; overflow: hidden; }
/* Vertical media (portrait video / tall screenshot) — keep its own aspect ratio
   instead of being cropped to the 16/10 box. */
.shot--portrait { aspect-ratio: auto; }
.shot--portrait img, .shot--portrait video { width: auto; height: auto; max-width: 100%; max-height: 75vh; }

/* ---- Utility ----------------------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.stack-sm { display: grid; gap: 8px; }
