/* ============= Design tokens ============= */
:root {
  /* tuned LIGHT mode for better contrast */
  --bg: 245 247 251;          /* softer, less gray-blue */
  --text: 18 22 30;           /* slightly deeper */
  --muted: 105 112 124;
  --card: 255 255 255;
  --elev: 255 255 255 / .7;
  --outline: 18 22 40 / .10;  /* stronger hairline */
  --primary: 99 102 241;      /* indigo-500 */
  --primary-2: 236 72 153;    /* pink-500 */
  --accent: 34 197 94;        /* emerald-500 */
  --ring: 129 140 248;        /* indigo-300 */
  --radius: 18px;
  --shadow-soft: 0 10px 30px rgba(20, 20, 40, .07), 0 2px 10px rgba(20, 20, 40, .05);
  --shadow-strong: 0 30px 70px rgba(20, 20, 40, .18);
}

/* explicit DARK variables (JS toggles html[data-theme]) */
html[data-theme="dark"] {
  --bg: 10 12 16;
  --text: 232 235 245;
  --muted: 154 161 177;
  --card: 18 22 28;
  --elev: 255 255 255 / .06;
  --outline: 255 255 255 / .08;
  --primary: 165 180 252;   /* indigo-300 */
  --primary-2: 251 113 133; /* rose-400 */
  --accent: 52 211 153;     /* emerald-400 */
  --ring: 79 70 229;        /* indigo-600 */
}

/* ===== Base & layout ===== */
* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  color: rgb(var(--text));
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(var(--primary), .10), transparent 60%),
    radial-gradient(900px 600px at -10% 20%, rgba(var(--primary-2), .10), transparent 50%),
    rgb(var(--bg));
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.55;
  letter-spacing: .01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container { width: min(1120px, calc(100% - 3rem)); margin-inline: auto; }

a { color: inherit; text-decoration: none; }
.muted { color: rgb(var(--muted)); }

/* slight boost to contrast in LIGHT */
html[data-theme="light"] .muted { color: rgba(60,65,75,.85); }

/* Subtle noise overlay */
.noise {
  pointer-events: none;
  position: fixed; inset: 0;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140" viewBox="0 0 140 140"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="2" stitchTiles="stitch"/></filter><rect width="100%" height="100%" opacity="0.03" filter="url(%23n)"/></svg>');
  opacity: .6; mix-blend-mode: soft-light; z-index: 0;
}

/* ===== Nav ===== */
.nav-wrap {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  background: linear-gradient(to bottom, rgba(var(--card), .85), rgba(var(--card), .4));
  border-bottom: 1px solid rgb(var(--outline));
}
nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 700; letter-spacing: .02em; }
.logo {
  width: 36px; height: 36px; border-radius: 12px; position: relative;
  background: conic-gradient(from 180deg at 50% 50%, rgba(var(--primary),1), rgba(var(--primary-2),1));
  box-shadow: 0 10px 30px rgba(var(--primary), .25);
  overflow: hidden;
  text-align: center;
  display: grid;
  place-items: center
}
.logo::after { content: ""; position: absolute; inset: 1px; border-radius: 11px; background: rgba(255,255,255,.18); mix-blend-mode: overlay; }
.nav-links { display: flex; align-items: center; gap: 1.2rem; }
.nav-link { padding: .55rem .9rem; border-radius: 999px; font-weight: 600; color: rgb(var(--muted)); }
.nav-link:hover { color: rgb(var(--text)); background: rgba(var(--primary), .12); }

.theme-toggle {
  border: 1px solid rgb(var(--outline));
  background: rgba(var(--card), .75);
  border-radius: 12px; padding: .45rem .6rem; display: grid; place-items: center; cursor: pointer;
}
.theme-toggle:hover { box-shadow: var(--shadow-soft); }

/* ===== Hero ===== */
.hero { position: relative; padding: 8rem 0 5rem; }
.hero h1 { font-size: clamp(2.6rem, 5vw, 4rem); line-height: 1.05; margin: 0 0 1rem; font-weight: 800; letter-spacing: -0.02em; }
.grad { background: linear-gradient(90deg, rgb(var(--primary)), rgb(var(--primary-2)) 60%, rgb(var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { font-size: clamp(1rem, 1.2vw + .6rem, 1.25rem); max-width: 62ch; }

.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 1.6rem; }
.btn {
  --bg1: rgb(var(--primary)); --bg2: rgb(var(--primary-2));
  display: inline-flex; align-items: center; gap: .55rem; padding: .9rem 1.1rem; border-radius: 14px; font-weight: 700; border: 1px solid rgb(var(--outline));
  background: linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0)) padding-box,
              linear-gradient(90deg, var(--bg1), var(--bg2)) border-box;
  color: white; box-shadow: 0 10px 30px rgba(99, 102, 241, .35);
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-strong); }

.btn.secondary {
  color: rgb(var(--text));
  background: linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.75));
  box-shadow: var(--shadow-soft);
  border: 1px solid rgb(var(--outline));
}

[data-theme="dark"] .btn.secondary {
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.08));
  color: rgb(var(--text));
}

.hero-badges { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 2rem; }
.badge { border: 1px solid rgb(var(--outline)); background: rgba(var(--card), .9); border-radius: 999px; padding: .5rem .8rem; display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 999px; background: radial-gradient(circle at 30% 30%, white, rgba(255,255,255,.2)), rgb(var(--primary)); box-shadow: 0 0 0 3px rgba(var(--primary), .15); }

/* Blobs */
.blob { position: absolute; filter: blur(50px); opacity: .55; z-index: -1; }
.blob.one { width: 380px; height: 380px; background: radial-gradient(circle at 30% 30%, rgba(var(--primary), .65), transparent 70%); top: -60px; right: -40px; animation: float1 16s ease-in-out infinite; }
.blob.two { width: 300px; height: 300px; background: radial-gradient(circle at 70% 70%, rgba(var(--primary-2), .55), transparent 70%); bottom: -40px; left: -20px; animation: float2 18s ease-in-out infinite; }
@keyframes float1 { 0%,100% { transform: translateY(0) translateX(0);} 50% { transform: translateY(12px) translateX(-10px);} }
@keyframes float2 { 0%,100% { transform: translateY(0) translateX(0);} 50% { transform: translateY(-12px) translateX(10px);} }

/* ===== Sections & cards ===== */
section { padding: 4.5rem 0; position: relative; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.eyebrow { display: inline-block; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; font-size: .78rem; color: rgb(var(--muted)); }
h2 { font-size: clamp(1.6rem, 2.3vw + .8rem, 2.4rem); margin: .4rem 0 0; letter-spacing: -0.01em; }

.grid { display: grid; gap: 1.1rem; }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px){ .grid.cols-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px){ .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  position: relative; border-radius: var(--radius); background: rgba(var(--card), .9);
  border: 1px solid rgb(var(--outline)); box-shadow: var(--shadow-soft); overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease; will-change: transform;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-strong); }
.card .shine { position: absolute; inset: 0; background: radial-gradient(600px 200px at var(--mx, 50%) -20%, rgba(255,255,255,.35), transparent 60%); opacity: 0; transition: opacity .25s ease; }
.card:hover .shine { opacity: .9; }
.card-content { padding: 1.3rem 1.4rem; }

.metric { display: flex; align-items: center; gap: .9rem; }
.metric .num { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.02em; }
.metric .label { color: rgb(var(--muted)); font-weight: 600; }

.project {
  aspect-ratio: 16 / 10; display: grid; place-items: end; background:
    linear-gradient(180deg, rgba(0,0,0,.0), rgba(0,0,0,.45)),
    linear-gradient(120deg, rgba(var(--primary), .25), rgba(var(--primary-2), .25)),
    radial-gradient(1200px 600px at -20% -40%, rgba(var(--primary), .35), transparent 60%),
    radial-gradient(1200px 600px at 120% 140%, rgba(var(--primary-2), .35), transparent 60%);
  color: white; border-bottom-left-radius: 0; border-bottom-right-radius: 0;
}
.project .title { padding: 1rem 1.2rem; font-weight: 700; letter-spacing: .01em; }

/* ===== CTA & footer ===== */
.cta {
  text-align: center;
  background: linear-gradient(180deg, rgba(var(--primary), .12), rgba(var(--primary-2), .12));
  border: 1px solid rgb(var(--outline));
  border-radius: calc(var(--radius) + 6px);
  padding: 3rem 1.5rem;
  box-shadow: var(--shadow-soft);
}
footer { padding: 3.2rem 0 3.6rem; color: rgb(var(--muted)); font-size: .95rem; }

/* Utilities */
.row { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.space { height: 1.2rem; }
.pill { padding: .5rem .8rem; border-radius: 999px; border: 1px solid rgb(var(--outline)); background: rgba(var(--card), .9); }

/* Fade-in on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .card, .btn { transition: none; }
  .blob { animation: none; }
}
/* Screen reader only label */
.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;
}

/* Language selector */
.lang-select {
  appearance: none;
  border: 1px solid rgb(var(--outline));
  background: rgba(var(--card), .75);
  border-radius: 12px;
  padding: .45rem 1.9rem .45rem .6rem;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.lang-select:hover { box-shadow: var(--shadow-soft); }

/* simple caret via background-image */
.lang-select {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="m6 9 6 6 6-6"/></svg>');
  background-repeat: no-repeat;
  background-position: right .6rem center;
}

/* Dark tweak so it blends better */
html[data-theme="dark"] .lang-select {
  background: rgba(var(--card), .18);
}

/* Keep your existing .btn.secondary dark-mode fix: */
html[data-theme="dark"] .btn.secondary {
  background: linear-gradient(180deg, rgba(255,255,255,.14), rgba(255,255,255,.08));
  color: rgb(var(--text));
}
/* Language selector (native <select>, styled to match UI) */
.lang-select {
  -webkit-appearance: none;
  appearance: none;

  display: inline-flex;
  align-items: center;
  gap: .5rem;

  height: 36px;                /* matches theme toggle */
  padding: .3rem 1.75rem .3rem .65rem;

  font: inherit;
  font-weight: 700;
  letter-spacing: .01em;

  color: rgb(var(--text));
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.75)) padding-box,
    rgba(var(--card), .75);
  border: 1px solid rgb(var(--outline));
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  cursor: pointer;

  /* caret */
  background-image: url('data:image/svg+xml;utf8,\
<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">\
<path d="m6 9 6 6 6-6"/></svg>');
  background-repeat: no-repeat;
  background-position: right .6rem center;
  background-size: 14px 14px;
}

.lang-select:hover { box-shadow: var(--shadow-strong); }

.lang-select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--ring));
}

/* Dark mode tweak */
html[data-theme="dark"] .lang-select {
  background:
    linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.10)) padding-box,
    rgba(var(--card), .18);
  border: 1px solid rgb(var(--outline));
  color: rgb(var(--text));
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* Make sure it aligns neatly with nav items */
.nav-links .lang-select { margin-left: .2rem; }
