/* ============================================================
   SWORLD — shared theme (index.html + product.html)
   Pure black + Tesla red #E31937 (dark) · clean white + same
   red (light). All neutrals are CSS-var driven; Tailwind's
   white/black/panel utilities are remapped to the vars in the
   per-page tailwind.config, so every /alpha utility follows
   the active theme automatically.
============================================================ */

/* ---------- palettes ---------- */
:root, html[data-theme="dark"] {
  --accent-rgb: 227 25 55;    /* Tesla red (dark theme)   */
  --accent-hi: #FF5C75;       /* lighter accent for gradient tops */
  --bg-rgb: 0 0 0;            /* page background          */
  --panel-rgb: 11 11 13;      /* bento / panel surface    */
  --text-rgb: 245 245 247;    /* primary text             */
  --bento-border: rgba(255, 255, 255, .08);
  --glass-bg: rgba(11, 11, 13, .72);
  --chip-border: rgba(255, 255, 255, .12);
  --chip-color: rgba(255, 255, 255, .65);
  --field-bg: rgba(255, 255, 255, .03);
  --field-border: rgba(255, 255, 255, .1);
  --dot-bg: rgba(255, 255, 255, .22);
  --chart-grid: rgba(255, 255, 255, .06);
  --chart-tick: rgba(255, 255, 255, .45);
  --scroll-track: #000;
  --scroll-thumb: #26262a;
}
html[data-theme="light"] {
  --accent-rgb: 0 102 255;    /* signal blue (light theme) */
  --accent-hi: #66A3FF;
  --bg-rgb: 255 255 255;
  --panel-rgb: 245 245 247;
  --text-rgb: 17 17 19;
  --bento-border: rgba(0, 0, 0, .1);
  --glass-bg: rgba(255, 255, 255, .78);
  --chip-border: rgba(0, 0, 0, .14);
  --chip-color: rgba(0, 0, 0, .6);
  --field-bg: rgba(0, 0, 0, .03);
  --field-border: rgba(0, 0, 0, .12);
  --dot-bg: rgba(0, 0, 0, .2);
  --chart-grid: rgba(0, 0, 0, .08);
  --chart-tick: rgba(0, 0, 0, .5);
  --scroll-track: #fff;
  --scroll-thumb: #d6d6da;
}

html { background: rgb(var(--bg-rgb)); }
body {
  background: rgb(var(--bg-rgb)); color: rgb(var(--text-rgb));
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
  transition: background .45s ease, color .45s ease;
}
::selection { background: rgb(var(--accent-rgb)); color: #fff; }

/* ---------- red-only tech gradients (same hue, opacity only) ---------- */
.grad-red        { background:linear-gradient(135deg, rgb(var(--accent-rgb) / .55) 0%, rgb(var(--accent-rgb) / .12) 55%, rgb(var(--accent-rgb) / 0) 100%); }
.grad-red-radial { background:radial-gradient(ellipse 80% 60% at 30% 20%, rgb(var(--accent-rgb) / .35) 0%, rgb(var(--accent-rgb) / .06) 45%, transparent 75%); }
html[data-theme="light"] .grad-red-radial {
  background:radial-gradient(ellipse 80% 60% at 30% 20%, rgb(var(--accent-rgb) / .16) 0%, rgb(var(--accent-rgb) / .04) 45%, transparent 75%);
}
.grad-text-red   { background:linear-gradient(180deg, var(--accent-hi) 0%, rgb(var(--accent-rgb)) 45%, rgb(var(--accent-rgb) / .35) 100%); -webkit-background-clip:text; background-clip:text; color:transparent; }
.grad-text-white { background:linear-gradient(180deg, rgb(var(--text-rgb)) 0%, rgb(var(--text-rgb)) 55%, rgb(var(--text-rgb) / .35) 100%); -webkit-background-clip:text; background-clip:text; color:transparent; }

.glass { background:var(--glass-bg); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); }

/* ---------- bento ---------- */
.bento { position:relative; display:block; border:1px solid var(--bento-border); border-radius:24px; overflow:hidden;
         background:rgb(var(--panel-rgb)); transition:border-color .45s ease, transform .45s ease, background .45s ease; }
.bento:hover { border-color:rgb(var(--accent-rgb) / .45); transform:translateY(-4px); }
.bento:hover .bento-img { transform:scale(1.06); }
.bento-img { transition:transform .8s cubic-bezier(.16,1,.3,1); }
.img-cover { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }

.chip { font-family:'JetBrains Mono',monospace; font-size:10.5px; letter-spacing:.02em;
        border:1px solid var(--chip-border); color:var(--chip-color); border-radius:999px;
        padding:3px 9px; display:inline-block; transition:all .3s; }
.chip:hover { border-color:rgb(var(--accent-rgb) / .6); color:rgb(var(--accent-rgb)); }

.hairline { height:1px; background:linear-gradient(90deg, transparent, rgb(var(--accent-rgb) / .6), transparent); }

/* ---------- marquee ---------- */
@keyframes tick { from { transform:translateX(0);} to { transform:translateX(-50%);} }
.marquee-track { display:flex; width:max-content; animation:tick 38s linear infinite; }
.marquee:hover .marquee-track { animation-play-state:paused; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width:9px; }
::-webkit-scrollbar-track { background:var(--scroll-track); }
::-webkit-scrollbar-thumb { background:var(--scroll-thumb); border-radius:8px; }
::-webkit-scrollbar-thumb:hover { background:rgb(var(--accent-rgb)); }

/* ---------- SVG line-art draw-on ----------
   Neutral strokes/fills are theme-var driven so outline art
   stays visible on white; red strokes are inline in the SVGs
   and identical in both themes. */
.draw path, .draw line, .draw circle, .draw rect, .draw polyline {
  stroke-dasharray:1200; stroke-dashoffset:1200;
  transition:stroke-dashoffset 2.2s cubic-bezier(.16,1,.3,1);
}
.draw.on path, .draw.on line, .draw.on circle, .draw.on rect, .draw.on polyline { stroke-dashoffset:0; }
.draw .ln1 { stroke:rgb(var(--text-rgb) / .42); }
.draw .acc { stroke:rgb(var(--accent-rgb)); }
.draw .accSoft { stroke:rgb(var(--accent-rgb) / .55); }
.draw .accFaint { stroke:rgb(var(--accent-rgb) / .4); }
.draw stop.accHi { stop-color:var(--accent-hi); }
.draw stop.accLo { stop-color:rgb(var(--accent-rgb) / .35); }
.draw .ln2 { stroke:rgb(var(--text-rgb) / .25); }
.draw text { fill:rgb(var(--text-rgb) / .65); font-family:'JetBrains Mono', monospace; }

.will-reveal { will-change:transform, opacity; }

/* ---------- nav ---------- */
.nav-link { position:relative; }
.nav-link::after { content:''; position:absolute; left:0; bottom:-4px; width:0; height:1.5px;
                   background:rgb(var(--accent-rgb)); transition:width .35s cubic-bezier(.16,1,.3,1); }
.nav-link:hover::after { width:100%; }

#themeToggle { width:2.5rem; height:2.5rem; border-radius:9999px;
               border:1px solid var(--chip-border); color:var(--chip-color);
               display:inline-flex; align-items:center; justify-content:center;
               font-size:.8rem; transition:all .3s; }
#themeToggle:hover { border-color:rgb(var(--accent-rgb) / .6); color:rgb(var(--accent-rgb)); }

/* ---------- forms ---------- */
input, textarea, select { color-scheme:dark; }
html[data-theme="light"] input, html[data-theme="light"] textarea, html[data-theme="light"] select { color-scheme:light; }
.field { background:var(--field-bg); border:1px solid var(--field-border); border-radius:12px;
         padding:14px 16px; width:100%; outline:none; transition:border-color .3s; font-size:14px; }
.field:focus { border-color:rgb(var(--accent-rgb) / .7); }

/* ---------- carousel ---------- */
.slide { position:absolute; inset:0; opacity:0; pointer-events:none; z-index:0; }
.slide.active { opacity:1; pointer-events:auto; z-index:10; }
.carousel-dot { width:26px; height:3px; border-radius:2px; background:var(--dot-bg);
                transition:all .4s; cursor:pointer; }
.carousel-dot.active { background:rgb(var(--accent-rgb)); box-shadow:0 0 10px rgb(var(--accent-rgb) / .8); }

/* ---------- detail spec rows ---------- */
[data-spec-row] { opacity:1; }
