/* ================================================================
   Rahul Malik — Portfolio
   Type:  Bricolage Grotesque (display headings — sharp, no serif)
          Geist (body, #32404F)
          Geist Mono (eyebrows / small labels)
   Direction: precise, systems-minded, type-and-whitespace led.
   Fewer boxes. Hairlines over borders. Accent used sparingly.
================================================================ */

:root {
  --bg:        #FBFBF8;
  --surface:   #FFFFFF;
  --inset:     #F6F5F1;

  --head:      #232C34;   /* near-black slate for headlines */
  --body:      #32404F;   /* requested body color */
  --muted:     #8B939C;
  --faint:     #BFC3C8;

  --accent:    #3551CE;
  --accent-ink:#2A44B4;

  --line:      #E7E5DE;
  --line-soft: #F1EFE9;
  --line-hair: #EDEBE4;

  --serif: "Bricolage Grotesque", "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sans:  "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:  "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --shadow: 0 12px 40px -18px rgba(35,44,52,0.16);

  --max:   1080px;
  --read:  680px;
  --radius: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

:root[data-theme="dark"] {
  --bg:        #0d0d0d;
  --surface:   #171717;
  --inset:     #141414;

  --head:      #ededed;
  --body:      #a6a6a6;
  --muted:     #6a6a6a;
  --faint:     #3a3a3a;

  --accent:    #7a9cf5;
  --accent-ink:#9db0f8;

  --line:      #2a2a2a;
  --line-soft: #1c1c1c;
  --line-hair: #232323;

  --shadow: 0 16px 48px -20px rgba(0,0,0,0.8);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:#0d0d0d; --surface:#171717; --inset:#141414;
    --head:#ededed; --body:#a6a6a6; --muted:#6a6a6a; --faint:#3a3a3a;
    --accent:#7a9cf5; --accent-ink:#9db0f8;
    --line:#2a2a2a; --line-soft:#1c1c1c; --line-hair:#232323;
    --shadow:0 16px 48px -20px rgba(0,0,0,0.8);
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body {
  font-family: var(--sans);
  background: var(--bg); color: var(--body);
  font-size: 17px; line-height: 1.75;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  transition: background 0.4s var(--ease), color 0.3s var(--ease);
}
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 36px; }
.read { max-width: var(--read); margin: 0 auto; }

/* ── NAV ── */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(150%) blur(18px);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  border-bottom: 1px solid var(--line-soft);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 72px; gap: 20px; }
.brand { display: flex; flex-direction: column; line-height: 1.3; gap: 2px; }
.brand .b-name { font-family: var(--serif); font-size: 1.06rem; font-weight: 600; color: var(--head); letter-spacing: -0.01em; }
.brand .b-role { font-family: var(--mono); font-size: 0.68rem; color: var(--muted); letter-spacing: 0.02em; text-transform: uppercase; }
.nav-right { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; gap: 26px; }
.nav-links a { font-size: 0.875rem; color: var(--muted); font-weight: 450; transition: color 0.2s var(--ease); }
.nav-links a:hover, .nav-links a.active { color: var(--head); }

.theme-toggle {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.theme-toggle:hover { color: var(--head); border-color: var(--faint); background: var(--inset); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}

/* ── EYEBROW (mono) ── */
.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  margin-bottom: 20px; display: block;
}
.eyebrow.accent { color: var(--accent); }

/* ── HEADINGS (Bricolage Grotesque) ── */
h1.display {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.9rem, 6.4vw, 4.6rem); line-height: 1.05;
  letter-spacing: -0.012em; color: var(--head);
}
h1.display em { font-style: italic; font-weight: 500; color: inherit; }

h1.cs-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(2.4rem, 5.2vw, 3.5rem); line-height: 1.08;
  letter-spacing: -0.012em; color: var(--head);
}
h1.cs-title em { font-style: italic; }

h2.headline {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.65rem, 3.2vw, 2.15rem); line-height: 1.22;
  letter-spacing: -0.005em; color: var(--head); margin-bottom: 22px;
}
h2.headline em { font-style: italic; font-weight: 500; }

h4.dsub {
  font-family: var(--serif); font-size: 1.35rem; font-weight: 600;
  color: var(--head); letter-spacing: -0.005em; margin-bottom: 12px; line-height: 1.3;
}

.lead { font-size: 1.2rem; line-height: 1.6; color: var(--body); font-weight: 400; }
p { margin-bottom: 20px; }
p strong { color: var(--head); font-weight: 600; }
p:last-child, .read p:last-child { margin-bottom: 0; }
em { font-style: italic; }

hr.divider { height: 1px; background: var(--line-hair); border: 0; margin: 72px 0; }

/* pull-quote: serif, generous, no heavy rule */
.insight {
  font-family: var(--serif); font-style: italic; font-weight: 500;
  font-size: 1.55rem; line-height: 1.4; color: var(--head);
  margin: 40px 0; padding-left: 28px;
  border-left: 2px solid var(--accent);
}

/* ── HOME HERO ── */
.hero { padding: 132px 0 92px; }
.hero h1 { max-width: 15ch; }
.hero .lead { max-width: 44ch; margin-top: 32px; color: var(--body); }
.cta-row { display: flex; align-items: center; gap: 24px; margin-top: 44px; flex-wrap: wrap; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--head); color: var(--bg); font-weight: 500; font-size: 0.94rem;
  padding: 13px 26px; border-radius: 10px; letter-spacing: -0.005em;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}
.btn-primary:hover { transform: translateY(-2px); opacity: 0.9; }
.btn-ghost { color: var(--muted); font-size: 0.92rem; font-weight: 450; transition: color 0.2s var(--ease); }
.btn-ghost:hover { color: var(--head); }
.hero-meta { margin-top: 28px; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); letter-spacing: 0.01em; }

/* ── WORK GRID ── */
.section-head { padding: 16px 0 30px; }
.work-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px 30px; padding-bottom: 110px; }

.card {
  display: flex; flex-direction: column;
  transition: transform 0.45s var(--ease);
}
.card.is-link { cursor: pointer; }
.card-media {
  aspect-ratio: 16/10; overflow: hidden; border-radius: var(--radius);
  background: var(--inset); border: 1px solid var(--line-hair);
}
.card-media img, .card-media video { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease); }
.card.is-link:hover .card-media img, .card.is-link:hover .card-media video { transform: scale(1.035); }
.card-media .ph { width:100%; height:100%; display:flex; align-items:center; justify-content:center; color: var(--faint); font-family: var(--mono); font-size: 0.74rem; text-align:center; padding:18px; line-height:1.7; }
.card-body { padding: 22px 2px 0; display: flex; flex-direction: column; flex: 1; }
.card-eyebrow { font-family: var(--mono); font-size: 0.68rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 12px; }
.card-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; color: var(--head); letter-spacing: -0.005em; line-height: 1.2; }
.card-desc { margin-top: 12px; color: var(--body); font-size: 0.96rem; line-height: 1.65; flex: 1; }
.card-foot { margin-top: 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-tags { display: flex; gap: 16px; flex-wrap: wrap; }
.chip { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.02em; }
.card-link { color: var(--accent); font-size: 0.86rem; font-weight: 500; white-space: nowrap; transition: gap 0.2s; }
.card.is-link:hover .card-link { color: var(--accent-ink); }
.card.soon { opacity: 1; }
.card.soon .card-media { display: flex; align-items: center; justify-content: center; }
.card.soon .card-link { color: var(--muted); }

/* ── CASE STUDY: shell ── */
.cs-shell { display: grid; grid-template-columns: 180px 1fr; gap: 0 72px; align-items: start; }
.cs-rail { position: sticky; top: 100px; padding-top: 4px; }
.cs-rail .r-back { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); margin-bottom: 30px; display: inline-flex; gap: 5px; text-transform: uppercase; letter-spacing: 0.04em; transition: color 0.2s var(--ease); }
.cs-rail .r-back:hover { color: var(--head); }
.cs-rail .r-link { display: block; font-size: 0.86rem; color: var(--muted); padding: 8px 0; line-height: 1.3; transition: color 0.2s var(--ease); position: relative; }
.cs-rail .r-link:hover { color: var(--head); }
.cs-rail .r-link.active { color: var(--head); }
.cs-rail .r-link.active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.cs-col { min-width: 0; }

.cs-top { padding: 40px 0 0; }
.breadcrumb { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); margin-bottom: 30px; text-transform: uppercase; letter-spacing: 0.04em; }
.breadcrumb a:hover { color: var(--head); }
.breadcrumb .sep { margin: 0 8px; color: var(--faint); }
.breadcrumb .cur { color: var(--body); }

.cs-title-wrap { max-width: 880px; }
.cs-sub { font-size: 1.24rem; line-height: 1.55; color: var(--body); margin-top: 26px; max-width: 60ch; }

.cs-hero-media {
  margin: 52px 0 0; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line-hair); background: var(--inset);
}
.cs-hero-media img, .cs-hero-media video { width: 100%; display: block; }
.cs-hero-media .ph, figure .ph {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  color: var(--faint); font-family: var(--mono); font-size: 0.76rem; text-align: center; padding: 22px; line-height: 1.7;
}

/* meta strip — hairline separated, mono keys */
.meta-strip {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 28px;
  padding: 36px 0; margin: 40px 0 0; border-top: 1px solid var(--line-hair); border-bottom: 1px solid var(--line-hair);
}
.meta-strip .ms { display: flex; flex-direction: column; gap: 8px; }
.meta-strip .ms-k { font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.meta-strip .ms-v { font-size: 0.9rem; color: var(--head); line-height: 1.4; }

.cs-body { max-width: var(--read); }
.cs-col .cs-body { margin: 0; }

.cs-section { padding: 72px 0 0; }
.cs-section:first-child { padding-top: 56px; }
.cs-section p { color: var(--body); }
.cs-section ul.clean { list-style: none; display: flex; flex-direction: column; gap: 16px; margin: 18px 0 24px; }
.cs-section ul.clean li { position: relative; padding-left: 24px; color: var(--body); }
.cs-section ul.clean li::before { content:""; position:absolute; left:2px; top:13px; width:6px; height:6px; border-radius:50%; background: var(--faint); }
.cs-section ul.clean li b { color: var(--head); }

/* TL;DR — restrained: hairline frame, generous, no heavy fill */
.tldr { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px 0; margin: 16px 0; }
.tldr ul { list-style: none; }
.tldr li { color: var(--body); font-size: 0.98rem; padding: 16px 0; border-bottom: 1px solid var(--line-hair); }
.tldr li:last-child { border-bottom: none; }
.tldr li b { color: var(--head); font-weight: 600; }

/* three-column principles — NO boxes; mono index + serif term */
.cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin: 28px 0 8px; }
.cols3 .col { border-top: 1px solid var(--line); padding-top: 18px; }
.cols3 .col .ci { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); letter-spacing: 0.04em; margin-bottom: 12px; }
.cols3 .col .ct { font-family: var(--serif); font-weight: 600; font-size: 1.12rem; color: var(--head); margin-bottom: 8px; letter-spacing: -0.005em; }
.cols3 .col .cd { font-size: 0.9rem; color: var(--body); line-height: 1.6; }

/* decisions overview — clean rule-separated table */
.dtable { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 0.96rem; }
.dtable tr { border-bottom: 1px solid var(--line-hair); }
.dtable tr:last-child { border-bottom: none; }
.dtable td { padding: 16px 0; vertical-align: top; }
.dtable td:first-child { font-family: var(--serif); font-weight: 600; color: var(--head); width: 44%; font-size: 1.02rem; }
.dtable td:last-child { color: var(--body); padding-left: 24px; }

/* decision block — hairline separated, no card fill */
.decision { padding: 36px 0; border-top: 1px solid var(--line-hair); }
.decision:first-of-type { border-top: none; padding-top: 12px; }
.decision .d-num { font-family: var(--mono); font-size: 0.7rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin-bottom: 12px; }
.decision dl { display: grid; grid-template-columns: 92px 1fr; gap: 12px 24px; margin-top: 18px; }
.decision dt { font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); padding-top: 4px; }
.decision dd { color: var(--body); font-size: 0.95rem; }
.decision dd b { color: var(--head); }

/* figures */
figure { margin: 36px 0; }
figure img { border: 1px solid var(--line-hair); border-radius: var(--radius); background: var(--inset); width: 100%; }
figcaption { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-align: left; margin-top: 14px; line-height: 1.6; letter-spacing: 0.01em; }

/* metrics — clean rows, no boxes */
.metrics { margin-top: 16px; }
.metrics .mg { display: grid; grid-template-columns: 140px 1fr; gap: 24px; padding: 20px 0; border-top: 1px solid var(--line-hair); }
.metrics .mg:first-child { border-top: 1px solid var(--line); }
.metrics .mg .mh { font-family: var(--serif); font-weight: 600; color: var(--head); font-size: 1.05rem; }
.metrics .mg p { font-size: 0.92rem; color: var(--body); margin: 0; }

/* about */
.exp { padding: 28px 0; border-top: 1px solid var(--line-hair); }
.exp:first-of-type { border-top: 1px solid var(--line); }
.exp .role { font-family: var(--serif); font-weight: 600; color: var(--head); font-size: 1.15rem; }
.exp .co { color: var(--accent); font-size: 0.9rem; margin-top: 3px; }
.exp .when { font-family: var(--mono); color: var(--muted); font-size: 0.72rem; margin: 6px 0 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.exp ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.exp ul li { position: relative; padding-left: 20px; color: var(--body); font-size: 0.94rem; }
.exp ul li::before { content:""; position:absolute; left:2px; top:11px; width:5px; height:5px; border-radius:50%; background: var(--faint); }

.back { font-family: var(--mono); font-size: 0.74rem; color: var(--muted); margin-top: 48px; display: inline-flex; gap: 6px; text-transform: uppercase; letter-spacing: 0.04em; transition: color 0.2s var(--ease); }
.back:hover { color: var(--head); }

/* footer */
.footer { border-top: 1px solid var(--line-hair); margin-top: 110px; padding: 52px 0 80px; }
.footer .f-inner { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.footer a { color: var(--head); font-weight: 500; font-size: 0.92rem; transition: color 0.2s; }
.footer a:hover { color: var(--accent); }
.footer .copy { font-family: var(--mono); color: var(--muted); font-size: 0.72rem; letter-spacing: 0.02em; }

/* responsive */
@media (max-width: 900px) {
  .cs-shell { grid-template-columns: 1fr; gap: 0; }
  .cs-rail { display: none; }
  .work-grid { grid-template-columns: 1fr; gap: 44px; }
  .meta-strip { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .cols3 { grid-template-columns: 1fr; gap: 0; }
  .cols3 .col { border-top: none; border-bottom: 1px solid var(--line-hair); padding: 20px 0; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .wrap { padding: 0 22px; }
  .hero { padding: 84px 0 64px; }
  .meta-strip { grid-template-columns: 1fr 1fr; }
  .decision dl { grid-template-columns: 1fr; gap: 4px 0; }
  .decision dt { margin-top: 12px; }
  .metrics .mg { grid-template-columns: 1fr; gap: 6px; }
  .nav-links { gap: 18px; }
  .brand .b-role { display: none; }
}

/* ── SCROLL REVEAL ── */
/* Elements start invisible/shifted; JS adds .revealed when they enter the viewport */
[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
[data-reveal].revealed {
  opacity: 1;
  transform: translateY(0);
}
/* Staggered children: each child gets a tiny extra delay */
[data-reveal="stagger"] > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
[data-reveal="stagger"].revealed > *:nth-child(1) { transition-delay: 0ms;   opacity: 1; transform: none; }
[data-reveal="stagger"].revealed > *:nth-child(2) { transition-delay: 90ms;  opacity: 1; transform: none; }
[data-reveal="stagger"].revealed > *:nth-child(3) { transition-delay: 180ms; opacity: 1; transform: none; }
[data-reveal="stagger"].revealed > *:nth-child(4) { transition-delay: 270ms; opacity: 1; transform: none; }
[data-reveal="stagger"].revealed > *:nth-child(5) { transition-delay: 360ms; opacity: 1; transform: none; }
/* Honour reduced motion */
@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal="stagger"] > * { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ── ABOUT PAGE ── */
.about-intro { padding: 80px 0 60px; }
.about-intro .eyebrow { display: block; margin-bottom: 14px; }
.about-intro h1 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3.2rem); font-weight: 600; color: var(--head); line-height: 1.15; margin: 0 0 20px; }
.about-intro p { font-size: 1.05rem; color: var(--body); line-height: 1.7; max-width: 560px; }
.about-divider { border: none; border-top: 1px solid var(--line-hair); margin: 0 0 56px; }

/* Experience entries */
.exp { margin-bottom: 40px; padding-bottom: 40px; border-bottom: 1px solid var(--line-hair); }
.exp:last-of-type { border-bottom: none; }
.exp-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 10px; }
.exp .role { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; color: var(--head); }
.exp .co { font-family: var(--sans); font-size: 0.9rem; color: var(--body); }
.exp .when { font-family: var(--mono); font-size: 0.72rem; letter-spacing: .05em; color: var(--muted); margin-left: auto; }

/* How I work — tool narrative */
.work-narrative { margin-top: 16px; }
.work-narrative p { margin-bottom: 16px; }
.tool-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 28px 0;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
}
.tool-card .tc-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.tool-card .tc-name {
  font-family: var(--sans);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--head);
  line-height: 1.35;
}
