/* ============================================================
   Sarmad Domit — Portfolio
   Shared design system
   Cinematic · technical · premium · dark · electric cyan
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* ---- palette ---- */
  --bg:          #07080b;
  --bg-2:        #0a0c11;
  --bg-3:        #0e1117;
  --surface:     rgba(255, 255, 255, 0.024);
  --surface-2:   rgba(255, 255, 255, 0.04);
  --border:      rgba(255, 255, 255, 0.08);
  --border-2:    rgba(255, 255, 255, 0.14);

  --text:        #e9ebef;
  --text-dim:    #9aa1ad;
  --text-faint:  #626b78;

  --accent:      #2fe6e6;
  --accent-soft: #6ff2f2;
  --accent-deep: #0e8f96;
  --accent-glow: rgba(47, 230, 230, 0.45);
  --accent-dim:  rgba(47, 230, 230, 0.12);

  /* ---- secondary accent: cinematic red (teal/red film-grade pairing) ---- */
  --red:         #f24b46;
  --red-soft:    #ff7d76;
  --red-glow:    rgba(242, 75, 70, 0.42);
  --red-dim:     rgba(242, 75, 70, 0.12);

  /* ---- type ---- */
  --serif: 'Instrument Serif', Georgia, serif;
  --sans:  'Space Grotesk', system-ui, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;

  /* ---- fluid modular type scale (1.5x display / 1.25x text) ---- */
  --fs-display: clamp(3.5rem, 1.6rem + 8.2vw, 9.5rem);   /* 56 → 152 hero */
  --fs-h1:      clamp(2.75rem, 1.7rem + 5.2vw, 6.5rem);  /* 44 → 104 */
  --fs-h2:      clamp(2rem, 1.35rem + 3.2vw, 3.75rem);   /* 32 → 60  */
  --fs-h3:      clamp(1.35rem, 1.18rem + 0.85vw, 1.85rem);/* 21.6 → 29.6 */
  --fs-lead:    clamp(1.125rem, 1.02rem + 0.5vw, 1.375rem);/* 18 → 22 */
  --fs-body:    clamp(1rem, 0.97rem + 0.16vw, 1.0625rem); /* 16 → 17 */
  --fs-sm:      0.875rem;     /* 14 */
  --fs-xs:      0.8125rem;    /* 13 */
  --fs-eyebrow: 0.75rem;      /* 12 */

  /* tracking */
  --tr-display: -0.025em;
  --tr-tight:   -0.02em;
  --tr-eyebrow: 0.2em;

  /* ---- layout ---- */
  --maxw: 1440px;
  --gutter: clamp(20px, 5vw, 64px);
  --nav-h: 72px;
}

/* ---- reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; font-size: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.65;
  font-weight: 400;
  letter-spacing: -0.003em;
  overflow-x: hidden;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  font-optical-sizing: auto;
}
p { text-wrap: pretty; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--accent); color: #03110f; }

/* ---- background canvas + gradients ---- */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.bg-wash {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1100px 720px at 78% -8%, rgba(47,230,230,0.10), transparent 60%),
    radial-gradient(820px 620px at 4% 96%, rgba(242,75,70,0.07), transparent 60%),
    radial-gradient(900px 700px at 8% 12%, rgba(70,110,150,0.08), transparent 60%),
    radial-gradient(1000px 900px at 50% 115%, rgba(47,230,230,0.05), transparent 55%);
}
.bg-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
main, footer, header { position: relative; z-index: 2; }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  padding: 0 var(--gutter);
  transition: background .4s ease, border-color .4s ease, backdrop-filter .4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(8, 9, 12, 0.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 9px;
  display: grid; place-items: center;
  border: 1px solid var(--border-2);
  background: linear-gradient(150deg, rgba(47,230,230,0.18), rgba(255,255,255,0.02));
  font-family: var(--mono); font-weight: 600; font-size: 14px; color: var(--accent-soft);
  letter-spacing: -0.5px;
  box-shadow: inset 0 0 18px rgba(47,230,230,0.12);
}
.brand-name { font-size: 15px; font-weight: 500; letter-spacing: 0.04em; line-height: 1.15; }
.brand-name small { display: block; font-family: var(--mono); font-size: 10px; color: var(--text-faint); letter-spacing: 0.18em; text-transform: uppercase; font-weight: 400; white-space: nowrap; }

.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-links a {
  position: relative;
  font-size: 13px; letter-spacing: 0.05em; color: var(--text-dim);
  padding: 9px 14px; border-radius: 8px; white-space: nowrap;
  transition: color .25s;
}
.nav-links { flex-wrap: nowrap; }
.nav-links a::after {
  content: ''; position: absolute; left: 14px; right: 14px; bottom: 4px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .35s cubic-bezier(.5,0,0,1); opacity: .9;
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.active { color: var(--text); }
.nav-links a.active::after { transform: scaleX(1); }

.nav-cta {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; white-space: nowrap;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--accent-dim); color: var(--accent-soft);
  background: var(--accent-dim);
  transition: box-shadow .3s, background .3s, transform .2s;
}
.nav-cta:hover { box-shadow: 0 0 22px var(--accent-glow); background: rgba(47,230,230,0.2); }

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

/* ============================================================
   LAYOUT PRIMITIVES
   ============================================================ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
section { position: relative; }
.section-pad { padding: clamp(72px, 11vw, 150px) 0; }

.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: var(--fs-eyebrow); font-weight: 500; letter-spacing: var(--tr-eyebrow); text-transform: uppercase;
  color: var(--accent-soft); margin-bottom: 24px;
}
.kicker::before { content: ''; width: 26px; height: 1px; background: linear-gradient(90deg, var(--accent), transparent); }

.section-head { max-width: 760px; margin-bottom: clamp(40px, 6vw, 72px); }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-head.center .kicker { justify-content: center; }
.section-head.center .kicker::before { display: none; }

h1, h2, h3, h4 { font-weight: 400; line-height: 1.04; letter-spacing: var(--tr-tight); text-wrap: balance; }
.display {
  font-family: var(--serif);
  font-size: var(--fs-display);
  line-height: 0.92; font-weight: 400; letter-spacing: var(--tr-display);
  text-wrap: balance;
}
.display .it { font-style: normal; }
h2.title { font-family: var(--serif); font-size: var(--fs-h2); line-height: 1.0; letter-spacing: var(--tr-tight); }
h2.title .accent, .display .accent { color: var(--accent); }
.lead {
  font-size: var(--fs-lead); color: var(--text-dim); font-weight: 400;
  line-height: 1.55; letter-spacing: -0.006em; max-width: 60ch; margin-top: 22px;
  text-wrap: pretty;
}
.section-head.center .lead { margin-left: auto; margin-right: auto; }

.eyebrow-num { font-family: var(--mono); font-size: var(--fs-eyebrow); color: var(--text-faint); letter-spacing: 0.12em; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  font-family: var(--sans); font-size: var(--fs-sm); font-weight: 500; letter-spacing: -0.005em;
  padding: 13px 22px; border-radius: 10px;
  border: 1px solid var(--border-2); color: var(--text);
  background: var(--surface);
  transition: transform .22s cubic-bezier(.4,0,0,1), border-color .3s, box-shadow .3s, background .3s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { transform: translateY(-2px); border-color: var(--border-2); background: var(--surface-2); }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-deep));
  color: #02110f; border-color: transparent; font-weight: 500;
  box-shadow: 0 8px 30px -8px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 12px 40px -6px var(--accent-glow); transform: translateY(-2px); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 9px 15px; font-size: 13px; }
.btn-icon { padding: 12px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* ============================================================
   GLASS CARD
   ============================================================ */
.card {
  position: relative;
  background: linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012));
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  transition: transform .4s cubic-bezier(.3,0,0,1), border-color .4s, box-shadow .4s;
  backdrop-filter: blur(6px);
}
.card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(420px 220px at var(--mx, 70%) var(--my, 0%), rgba(47,230,230,0.10), transparent 60%);
  opacity: 0; transition: opacity .4s; z-index: 4;
}
.card:hover { border-color: var(--border-2); box-shadow: 0 30px 70px -34px rgba(0,0,0,0.9), 0 0 0 1px rgba(47,230,230,0.06); }
.card:hover::before { opacity: 1; }
.card-body { padding: clamp(20px, 2.4vw, 30px); position: relative; z-index: 3; }

/* tilt wrapper */
.tilt { will-change: transform; transition: transform .3s cubic-bezier(.3,0,0,1); }

/* ---- visual placeholder (cinematic abstract) ---- */
.viz {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #0c1218, #090b10 70%);
  border-bottom: 1px solid var(--border);
}
/* when a real image is supplied via data (assets/cms.js), it fills the
   placeholder and the abstract grid + glyph text are hidden. */
.viz.has-img { background-size: cover; background-position: center; }
.viz.has-img::before, .viz.has-img::after { opacity: 0; }
.viz.has-img .viz-glyph { display: none; }
.viz::before {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(47,230,230,0.10) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47,230,230,0.10) 1px, transparent 1px);
  background-size: 30px 30px;
  mask-image: radial-gradient(120% 100% at 80% 0%, #000 10%, transparent 75%);
  -webkit-mask-image: radial-gradient(120% 100% at 80% 0%, #000 10%, transparent 75%);
  opacity: .5;
}
.viz::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(380px 200px at 75% 18%, rgba(47,230,230,0.22), transparent 60%),
    radial-gradient(300px 260px at 18% 92%, rgba(90,120,170,0.18), transparent 62%);
}
.viz-glyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: rgba(233,235,239,0.34); z-index: 2; text-align: center; padding: 20px;
  white-space: pre-line;
}
.viz-label {
  position: absolute; left: 16px; bottom: 14px; z-index: 3;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
}
.viz-label::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }

/* ---- badges / chips ---- */
.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; white-space: nowrap;
  padding: 5px 10px; border-radius: 6px;
  background: rgba(255,255,255,0.035); border: 1px solid var(--border);
  color: var(--text-dim); transition: color .3s, border-color .3s, background .3s;
}
.card:hover .tag, .tagrow:hover .tag { border-color: rgba(47,230,230,0.22); color: var(--accent-soft); }
.tag.solid { background: var(--accent-dim); border-color: rgba(47,230,230,0.25); color: var(--accent-soft); }
.tag.red { background: var(--red-dim); border-color: rgba(242,75,70,0.3); color: var(--red-soft); }
.accent-red { color: var(--red); }

.status {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-dim);
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.status.concept .dot { background: var(--red); box-shadow: 0 0 9px var(--red); }
.status.concept { color: var(--red-soft); }
.status.research .dot { background: #7c8cff; box-shadow: 0 0 9px #7c8cff; }

/* ============================================================
   GRIDS
   ============================================================ */
.grid { display: grid; gap: 22px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ============================================================
   REVEAL ANIMATION
   ============================================================ */
[data-reveal] { opacity: 0; }
[data-reveal].in { animation: revealIn .72s cubic-bezier(.2,0,0,1) both; }
@keyframes revealIn { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
/* hard failsafe: if animations stall in a throttled context, force-show everything */
html.reveal-all [data-reveal] { opacity: 1 !important; transform: none !important; animation: none !important; }
[data-reveal][data-delay="1"] { animation-delay: .08s; }
[data-reveal][data-delay="2"] { animation-delay: .16s; }
[data-reveal][data-delay="3"] { animation-delay: .24s; }
[data-reveal][data-delay="4"] { animation-delay: .32s; }
[data-reveal][data-delay="5"] { animation-delay: .40s; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer { border-top: 1px solid var(--border); padding: clamp(48px,7vw,80px) 0 40px; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; align-items: start; }
.footer h3 { font-family: var(--serif); font-size: 30px; margin-bottom: 14px; }
.footer p { color: var(--text-dim); font-size: 14px; max-width: 38ch; }
.footer-links { display: flex; flex-direction: column; gap: 10px; }
.footer-links a, .footer-links span { color: var(--text-dim); font-size: 14px; transition: color .25s; }
.footer-links a:hover { color: var(--accent-soft); }
.footer-col h5 { font-family: var(--mono); font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 16px; }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); font-family: var(--mono); font-size: 11px; color: var(--text-faint); letter-spacing: 0.06em; }

.brand-name small { white-space: nowrap; }
/* hide the long brand subtitle once the nav gets tight, so all links stay on one line */
@media (max-width: 1180px) {
  .brand-name small { display: none; }
}

/* ---- CV view toggle (shared by cv.html + cv-nodal.html) ---- */
.view-toggle { display: inline-flex; padding: 4px; border: 1px solid var(--border); border-radius: 100px; background: var(--surface); flex-shrink: 0; }
.view-toggle a { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; padding: 8px 16px; border-radius: 100px; color: var(--text-dim); transition: color .25s, background .25s; white-space: nowrap; }
.view-toggle a.active { background: var(--accent-dim); color: var(--accent-soft); }
.view-toggle a:hover:not(.active) { color: var(--text); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* landscape tablets / small laptops — keep the full nav but tighten it */
@media (max-width: 1180px) and (min-width: 961px) {
  .nav-links a { padding: 9px 11px; font-size: 12.5px; letter-spacing: 0.03em; }
  .nav-inner { gap: 16px; }
}
/* tablets (portrait + landscape) */
@media (max-width: 1024px) {
  :root { --gutter: clamp(22px, 4.5vw, 48px); }
  .section-pad { padding: clamp(60px, 9vw, 110px) 0; }
}
@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-toggle { display: flex; }
  .nav-links.open {
    display: flex; flex-direction: column; align-items: stretch;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: rgba(8,9,12,0.96); backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border); padding: 14px var(--gutter) 22px; gap: 2px;
  }
  .nav-links.open a { padding: 14px 6px; font-size: 16px; border-bottom: 1px solid var(--border); }
  .nav-links.open a::after { display: none; }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .section-pad { padding: 64px 0; }
}
/* ---- phones ---- */
@media (max-width: 560px) {
  :root { --gutter: 18px; }
  /* nav: drop the inline CTA, keep brand + hamburger only */
  .nav-cta { display: none; }
  .brand-name small { display: none; }
  .brand-name { font-size: 14px; }
  /* tighter buttons + full-width primary actions read better on phone */
  .btn { padding: 12px 18px; font-size: 13.5px; }
  .hero-btns.btn-row { gap: 10px; }
  .footer-bottom { flex-direction: column; gap: 8px; }
  .kicker { font-size: 11px; letter-spacing: 0.16em; }
}
@media (max-width: 400px) {
  /* keep the giant serif display from overflowing on the smallest phones */
  .display, .hero h1 { font-size: clamp(40px, 13vw, 60px); }
}
