/* ===========================================================
   Dr Ali Khaghani - Engineering Consultant
   Plain CSS, no framework. Edit colours in :root below.
   =========================================================== */

:root {
  --navy:      #0f2336;
  --navy-2:    #16314a;
  --slate:     #45586b;
  --ink:       #1a2430;
  --muted:     #5d6b78;
  --line:      #e3e8ed;
  --bg:        #ffffff;
  --bg-alt:    #f5f7f9;
  --accent:    #1f8a8a;   /* teal - engineering, calm, not corporate-blue */
  --accent-d:  #166b6b;
  --accent-soft:#e6f3f3;
  --radius:    14px;
  --shadow:    0 1px 2px rgba(15,35,54,.06), 0 8px 24px rgba(15,35,54,.06);
  --shadow-lg: 0 12px 40px rgba(15,35,54,.12);
  --maxw:      1120px;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-disp: 'IBM Plex Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 { font-family: var(--font-disp); font-weight: 600; line-height: 1.15; color: var(--navy); letter-spacing: -.01em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); margin: 0 0 .5em; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.4rem); margin: 0 0 .4em; }
h3 { font-size: 1.2rem; margin: 0 0 .4em; }
p  { margin: 0 0 1em; }
a  { color: var(--accent-d); text-decoration: none; }
a:hover { text-decoration: underline; }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .76rem;
  font-weight: 600;
  color: var(--accent-d);
  margin: 0 0 .8em;
}

/* ---------- Mode switch (Industry / Academic) ---------- */
.mode-toggle-wrap { display: flex; justify-content: center; margin-bottom: 36px; }
.mode-toggle {
  display: inline-flex; gap: 4px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 5px;
  box-shadow: var(--shadow);
}
.mode-btn {
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-weight: 600; font-size: .95rem;
  color: var(--slate);
  padding: .6em 1.35em; border-radius: 999px;
  transition: background .18s ease, color .18s ease;
}
.mode-btn:hover { color: var(--navy); }
.mode-btn[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* Show only the active track. CSS-driven so there is no flash before JS loads,
   and each element keeps its natural display (grid/flex/block) when shown. */
body[data-mode="industry"] [data-track="academic"] { display: none; }
body[data-mode="academic"] [data-track="industry"] { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: .98rem;
  padding: .8em 1.5em;
  border-radius: 999px;
  border: 1px solid var(--accent);
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--accent-d); border-color: var(--accent-d); text-decoration: none; transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg-alt); border-color: var(--slate); }
.btn-small { padding: .55em 1.1em; font-size: .9rem; }
.btn-full { width: 100%; }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand-mark {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--navy); color: #fff;
  font-family: var(--font-disp); font-weight: 600; font-size: 1.1rem;
  letter-spacing: .02em;
}
/* The "pico point" - precision at the smallest scale */
.brand-mark::after {
  content: ""; position: absolute; top: 5px; right: 5px;
  width: 6px; height: 6px; border-radius: 50%;
  background: #46d6c0;
}
/* On the dark footer, lift the square off the navy background so it stays visible */
.site-footer .brand-mark { background: var(--navy-2); }
.brand-text { display: flex; flex-direction: column; font-weight: 600; line-height: 1.1; }
.brand-text small { font-weight: 500; color: var(--muted); font-size: .72rem; letter-spacing: .02em; }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--slate); font-weight: 500; font-size: .96rem; }
.nav-links a:hover { color: var(--navy); text-decoration: none; }
.nav-links a.btn { color: #fff; }
.nav-links a.active { color: var(--navy); font-weight: 700; }

/* Portfolio page intro */
.page-intro { max-width: 70ch; margin: 0 auto; text-align: center; }
.page-intro .section-sub { margin-left: auto; margin-right: auto; }
.nav-toggle { display: none; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--navy); margin: 5px 0; transition: .2s; }

/* ---------- Hero ---------- */
.hero {
  background:
    radial-gradient(1100px 400px at 85% -10%, rgba(31,138,138,.10), transparent 60%),
    linear-gradient(180deg, #fff 0%, var(--bg-alt) 100%);
  padding: clamp(48px, 8vw, 90px) 0;
  border-bottom: 1px solid var(--line);
}
.hero-tagline {
  text-align: center;
  margin: 0 0 20px;
  font-family: var(--font-disp);
  font-style: italic;
  font-size: clamp(1rem, 2vw, 1.18rem);
  color: var(--slate);
}
.hero-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 56px; align-items: center; }
.hero-copy .lead { font-size: 1.12rem; color: var(--slate); max-width: 40ch; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 1.6em 0 2em; }
.hero-stats { display: flex; gap: 34px; list-style: none; padding: 0; margin: 0; }
.hero-stats li { display: flex; flex-direction: column; }
.hero-stats strong { font-family: var(--font-disp); font-size: 1.9rem; color: var(--navy); line-height: 1; }
.hero-stats span { font-size: .82rem; color: var(--muted); margin-top: 4px; }

.hero-card {
  background: var(--navy);
  border-radius: 18px;
  padding: 26px;
  box-shadow: var(--shadow-lg);
  background-image: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 100%);
}
.hero-card-inner { color: #cdd9e3; font-size: .92rem; }
.hc-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 14px; border-radius: 10px; background: rgba(255,255,255,.04); margin-bottom: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #3b4a5a; }
.dot.ok { background: #46d6c0; box-shadow: 0 0 0 4px rgba(70,214,192,.15); }
.hc-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.08); margin: 16px 4px 10px; overflow: hidden; }
.hc-bar i { display: block; height: 100%; background: linear-gradient(90deg, #1f8a8a, #46d6c0); border-radius: 999px; }
.hc-cap { color: #8aa0b2; font-size: .82rem; margin: 0 4px; }

/* ---------- Trust strip ---------- */
.trust { padding: 30px 0; border-bottom: 1px solid var(--line); background: #fff; }
.trust-label { text-align: center; text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; color: var(--muted); margin: 0 0 14px; }
.trust-label-sub { margin-top: 26px; }
.trust-logos { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 34px; list-style: none; padding: 0; margin: 0; }
.trust-logos li { font-weight: 600; color: var(--slate); font-size: 1rem; opacity: .82; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 60ch; margin: 0 0 44px; }
.section-sub { color: var(--slate); font-size: 1.06rem; }

.grid { display: grid; gap: 22px; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
}

/* Services */
.services { grid-template-columns: repeat(3, 1fr); }
.service { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.service:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #d3dde4; }
.svc-icon { color: var(--accent); margin-bottom: 14px; line-height: 0; }
.svc-icon svg { width: 30px; height: 30px; }
.service p { color: var(--slate); margin: 0; font-size: .98rem; }
.service-cta { background: var(--accent-soft); border-color: #cfe7e7; display: flex; flex-direction: column; align-items: flex-start; }
.service-cta h3 { color: var(--accent-d); }
.service-cta p { color: var(--slate); }
.service-cta .btn { margin-top: auto; }

/* Expertise */
.expertise { grid-template-columns: repeat(2, 1fr); }
.exp h3 { color: var(--navy); margin-bottom: 14px; }
.tags { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li { background: var(--bg-alt); border: 1px solid var(--line); color: var(--slate); font-size: .85rem; font-weight: 500; padding: .35em .8em; border-radius: 999px; }
.section-alt .tags li { background: #fff; }

/* Work / projects */
.work { grid-template-columns: repeat(2, 1fr); }
.project { transition: transform .15s ease, box-shadow .15s ease; }
.project:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.proj-tag { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 700; color: var(--accent-d); margin: 0 0 .6em; }
.project p:last-child { color: var(--slate); margin: 0; font-size: .96rem; }
.work-foot { margin-top: 30px; text-align: center; }
.link-strong { font-weight: 600; font-size: 1.02rem; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.4fr .9fr; gap: 50px; align-items: start; }
.about-copy p { color: var(--slate); font-size: 1.04rem; }
.about-copy .btn { margin-top: 8px; }
.about-side { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.section-alt .about-side { background: #fff; }
.about-side h3 { color: var(--navy); margin-bottom: 16px; }
.cred-list { list-style: none; padding: 0; margin: 0; }
.cred-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .94rem; color: var(--slate); }
.cred-list li:last-child { border-bottom: 0; }
.cred-list strong { color: var(--ink); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.05fr; gap: 50px; align-items: start; }
.contact-points { list-style: none; padding: 0; margin: 22px 0 0; }
.contact-points li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; color: var(--slate); }
.contact-points svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--accent); }
.contact-form { display: grid; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .86rem; font-weight: 600; color: var(--ink); }
.field .opt { font-weight: 400; color: var(--muted); }
.field input, .field select, .field textarea {
  font: inherit; color: var(--ink);
  padding: .7em .85em;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-alt);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; }
.form-note { font-size: .9rem; margin: 4px 0 0; min-height: 1.2em; }
.form-note.ok  { color: var(--accent-d); }
.form-note.err { color: #b4452f; }

/* ---------- Research (academic deep-dive) ---------- */
.research-intro { max-width: 70ch; }
.research-intro p { color: var(--slate); font-size: 1.06rem; }
.research-intro em { font-style: italic; color: var(--ink); }
.block-title { font-family: var(--font-disp); font-size: 1.3rem; color: var(--navy); margin: 8px 0 20px; }

.findings { grid-template-columns: repeat(2, 1fr); }
.finding { transition: transform .15s ease, box-shadow .15s ease; }
.finding:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.finding .papers { text-transform: uppercase; letter-spacing: .06em; font-size: .72rem; font-weight: 700; color: var(--accent-d); margin: 0 0 .5em; }
.finding p:last-child { color: var(--slate); margin: 0; font-size: .97rem; }

.future {
  margin-top: 40px;
  background: var(--accent-soft);
  border: 1px solid #cfe7e7;
  border-radius: var(--radius);
  padding: 30px 32px;
}
.future h3 { color: var(--accent-d); margin-bottom: .3em; }
.future > p { color: var(--slate); margin-bottom: .6em; }
.draft-tag {
  display: inline-block; vertical-align: middle; margin-left: 8px;
  font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: #fff; background: var(--accent); padding: .3em .75em; border-radius: 999px;
}
.future ul { margin: .4em 0 0; padding-left: 1.1em; }
.future li { margin: .55em 0; color: var(--slate); }
.future li strong { color: var(--ink); }

.pub-block { margin-top: 46px; }
.pub-group { margin-bottom: 24px; }
.pub-group h3 { color: var(--navy); font-size: 1.05rem; margin-bottom: .5em; }
.pub-list { margin: 0; padding-left: 1.4em; }
.pub-list li { margin: .5em 0; color: var(--slate); font-size: .95rem; line-height: 1.55; }
.pub-list li em { color: var(--ink); }
.pub-foot { margin-top: 18px; font-weight: 600; }

/* ---------- Lab (tools I'm building) ---------- */
#lab { background: var(--accent-soft); }
.lab-cat { margin-top: 44px; }
.lab-cat:first-of-type { margin-top: 4px; }
.lab-cat-title {
  font-family: var(--font-mono); font-size: .8rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--accent-d);
  margin: 0 0 18px; padding-bottom: 10px; border-bottom: 1px solid #cfe7e7;
}
.tool h3 + p { color: var(--slate); font-size: .96rem; margin: 0; }
.tool-status {
  display: inline-block; margin-top: 16px;
  font-family: var(--font-mono); font-size: .66rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--accent-d);
  background: #fff; border: 1px solid #cfe7e7; padding: .35em .75em; border-radius: 999px;
}
.tool-link { display: inline-block; margin-top: 16px; font-weight: 600; font-size: .92rem; color: var(--accent-d); }

/* ---------- Case study (Lab detail page) ---------- */
.case { max-width: 74ch; }
.case h2 { margin-bottom: .5em; }
.case h3 { color: var(--navy); margin: 1.7em 0 .4em; }
.case p { color: var(--slate); }
.case .eq {
  display: block; font-family: var(--font-mono); font-size: .92rem;
  background: #fff; color: var(--navy);
  border: 1px solid var(--line); border-left: 3px solid var(--accent);
  padding: .8em 1.05em; border-radius: 8px; margin: .4em 0 1.3em;
  overflow-x: auto; white-space: nowrap;
}
.result-line {
  border-left: 3px solid var(--accent); padding: .1em 0 .1em 14px;
  margin: 0 0 1.3em; color: var(--ink); font-weight: 500;
}
.case-fig { margin: 1.7em 0; }
.case-fig img { width: 100%; height: auto; display: block; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.case-fig figcaption { font-size: .85rem; color: var(--muted); margin-top: 10px; }
.spec-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.spec-list li { font-size: .92rem; color: var(--slate); padding: 8px 0; border-bottom: 1px solid var(--line); }
.spec-list li strong { color: var(--ink); font-weight: 600; }
.result-tiles { display: flex; flex-wrap: wrap; gap: 24px 44px; margin: 0; padding: 0; list-style: none; }
.result-tiles strong { display: block; font-family: var(--font-disp); font-size: 1.7rem; font-weight: 600; color: var(--navy); line-height: 1.1; }
.result-tiles span { font-size: .82rem; color: var(--muted); }
.table-scroll { overflow-x: auto; margin: .4em 0 1.3em; }
.case table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.case th, .case td { text-align: left; padding: .55em .8em; border-bottom: 1px solid var(--line); vertical-align: top; }
.case th { color: var(--navy); font-family: var(--font-mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.case td { color: var(--slate); }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #b8c6d2; padding: 50px 0 30px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 30px; align-items: start; }
.site-footer .brand-mark { margin-bottom: 12px; }
.site-footer p { margin: 0; font-size: .92rem; line-height: 1.5; }
.site-footer nav { display: flex; flex-direction: column; gap: 8px; }
.site-footer nav a { color: #b8c6d2; font-size: .92rem; }
.site-footer nav a:hover { color: #fff; }
.copyright { align-self: end; font-size: .82rem; color: #7e93a6; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Precision-technical labels in IBM Plex Mono */
.eyebrow, .trust-label, .proj-tag, .finding .papers {
  font-family: var(--font-mono);
  letter-spacing: .04em;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .hero-card { order: -1; }
  .services, .work, .findings { grid-template-columns: 1fr 1fr; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 34px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
/* Collapse the nav to a hamburger before the items would crowd the brand */
@media (max-width: 1080px) {
  .nav-links {
    position: absolute; top: 70px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--line);
    padding: 8px 24px 18px;
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .nav-links a.btn { text-align: center; margin-top: 10px; border-bottom: 0; }
  .nav-toggle { display: block; }
}
@media (max-width: 640px) {
  .services, .work, .expertise, .findings, .footer-grid, .spec-list { grid-template-columns: 1fr; }
  .hero-stats { gap: 22px; }
}
