/* ==========================================================================
   Mahim Patel — Portfolio design system
   Loaded after assets/css/tailwind.css. Tokens → base → chrome → components.
   ========================================================================== */

:root {
  --ink: #0B2447;
  --ink-2: #12325E;
  --ink-3: #1B4577;
  --brass: #8E6F38;
  --brass-soft: #F3ECDB;
  --pos: #265C45;
  --neg: #923F36;

  --text: #222937;
  --text-2: #363E4C;
  --muted: #4B5463;
  --faint: #687282;

  --line: #E1E5EA;
  --line-soft: #EBEEF2;
  --line-strong: #CBD1DA;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;

  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --wrap: 1280px;
  --radius: 3px;
}

/* ---------- Base ---------- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--surface);
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: #E6D9B8; color: var(--ink); }

a { text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
  border-radius: 2px;
}

svg { flex-shrink: 0; }

strong, b { font-weight: 600; }

.skip-link {
  position: absolute; left: 1rem; top: -4rem; z-index: 100;
  background: var(--ink); color: #fff; padding: .6rem 1rem; border-radius: var(--radius);
  font-size: 13px; transition: top .15s;
}
.skip-link:focus { top: .75rem; }

/* Type roles ----------------------------------------------------------- */
.font-editorial, .font-serif {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-feature-settings: 'lnum' 1, 'kern' 1;
}
h1.font-editorial, h2.font-editorial { letter-spacing: -0.02em; }
h3.font-editorial, h4.font-editorial { letter-spacing: -0.01em; }

/* The former monospace "terminal" voice becomes a clean tabular sans */
.font-mono-num {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: 'tnum' 1, 'lnum' 1;
}
.font-mono, code, pre, kbd { font-family: var(--mono); }

.font-bold, .font-extrabold { font-weight: 600; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.uppercase:not([class*="tracking-"]) { letter-spacing: .05em; }
.tracking-widest { letter-spacing: .14em; }
.tracking-wider { letter-spacing: .08em; }

/* ---------- Layout wrappers ---------- */
.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1rem, 3vw, 2rem);
}

main { padding-top: clamp(2.5rem, 5vw, 4.5rem) !important; padding-bottom: clamp(3rem, 6vw, 5rem) !important; }

/* ---------- Top bar ---------- */
.topbar { background: var(--ink); color: #C5D0E2; font-size: 12px; letter-spacing: .03em; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 38px; padding-block: 6px; }
.topbar-left { display: flex; align-items: center; flex-wrap: wrap; row-gap: 2px; }
.topbar-item { white-space: nowrap; }
.topbar-item + .topbar-item::before {
  content: ""; display: inline-block; width: 1px; height: 11px; margin: 0 14px;
  background: rgba(255, 255, 255, .24); vertical-align: -1px;
}
.topbar-lead { color: #fff; font-weight: 600; letter-spacing: .1em; font-size: 11px; }
.topbar-link { color: #fff; white-space: nowrap; font-weight: 500; opacity: .92; }
.topbar-link:hover { opacity: 1; text-decoration: underline; }

/* ---------- Header ---------- */
.site-header { background: var(--surface); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 88px; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; color: inherit; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 46px; height: 46px; flex: none;
  background: var(--ink); color: #fff; border-radius: var(--radius);
  font: 600 17px/1 var(--serif); letter-spacing: .05em;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  display: flex; align-items: center; gap: 12px;
  font: 600 21px/1.15 var(--serif); letter-spacing: -.012em; color: var(--ink);
}
.brand-age {
  font: 500 11.5px/1 var(--sans); letter-spacing: .04em; color: var(--faint);
  padding-left: 12px; border-left: 1px solid var(--line-strong);
}
.brand-sub {
  display: block; margin-top: 5px;
  font-size: 11px; line-height: 1.3; font-weight: 500; letter-spacing: .13em;
  text-transform: uppercase; color: var(--faint);
}
.header-actions { display: flex; align-items: center; gap: .75rem; }
.menu-toggle {
  display: none; width: 42px; height: 42px; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: #fff; color: var(--ink); cursor: pointer;
}
.menu-toggle:hover { background: var(--surface-2); }

/* ---------- Primary nav (sticky) ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .96);
  -webkit-backdrop-filter: saturate(1.6) blur(12px); backdrop-filter: saturate(1.6) blur(12px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  transition: box-shadow .2s;
}
.site-nav.is-stuck { box-shadow: 0 6px 18px -12px rgba(11, 36, 71, .35); }
.nav-row { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.nav-row::-webkit-scrollbar { display: none; }
.nav-link {
  position: relative; display: inline-flex; align-items: center; height: 50px; padding: 0 14px;
  font-size: 13.5px; font-weight: 500; color: var(--muted); white-space: nowrap; text-decoration: none;
  transition: color .15s;
}
.nav-link:first-child { padding-left: 0; }
.nav-link:hover { color: var(--ink); }
.nav-link.is-active { color: var(--ink); font-weight: 600; }
.nav-link.is-active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2px; background: var(--brass);
}
.nav-link:first-child.is-active::after { left: 0; }
.nav-idx { font-size: 11px; color: var(--faint); margin-right: 7px; font-variant-numeric: tabular-nums; }
.nav-link.is-active .nav-idx { color: var(--brass); }
.nav-ext { font-size: 11px; opacity: .5; margin-left: 5px; }

/* ---------- Mobile menu ---------- */
.mobile-menu { border-top: 1px solid var(--line); background: #fff; padding-block: .5rem 1rem; }
.mobile-nav-link {
  display: flex; align-items: center; padding: .85rem 0; border-bottom: 1px solid var(--line-soft);
  font-size: 15px; font-weight: 500; color: var(--text-2); text-decoration: none;
}
.mobile-nav-link.is-active { color: var(--ink); font-weight: 600; }
.mobile-nav-link .nav-idx { min-width: 28px; }
.mobile-cta { width: 100%; justify-content: center; margin-top: 1rem; }

@media (max-width: 1023px) {
  .site-header { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--line); }
  .site-nav { display: none; }
  .menu-toggle { display: inline-flex; }
  .header-row { min-height: 68px; padding-block: 10px; }
  .brand { gap: 12px; }
  .brand-name { font-size: 18px; white-space: nowrap; }
  .brand-age { white-space: nowrap; }
  .brand-mark { width: 40px; height: 40px; font-size: 15px; }
  .brand-sub { font-size: 9.5px; letter-spacing: .09em; }
  .header-actions .header-cta { display: none; }
}
@media (min-width: 1024px) { .mobile-menu { display: none !important; } }
@media (max-width: 640px) {
  .topbar-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .topbar-left { flex-direction: column; align-items: flex-start; gap: 2px; }
  .topbar-item { white-space: normal; }
  .topbar-item + .topbar-item::before { display: none; }
  .topbar-link { opacity: 1; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  font: 500 13.5px/1 var(--sans); letter-spacing: .01em; text-decoration: none; white-space: nowrap;
  cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: var(--ink-2); }
.btn-quiet { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.btn-quiet:hover { background: var(--surface-2); border-color: #B3BCC9; }

/* ---------- Surfaces ---------- */
.card-formal {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
  transition: border-color .2s ease, background-color .2s ease;
}
.card-formal:hover { border-color: #BFC8D4; box-shadow: none; }
.card-featured {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 2px rgba(11, 36, 71, .04), 0 12px 32px -20px rgba(11, 36, 71, .18);
}
.card-placeholder { background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* Remove decorative colour bars on cards — hierarchy comes from type and space */
.card-formal[class*="border-l-"], .card-formal[class*="border-t-"] {
  border-left-width: 1px; border-top-width: 1px;
  border-left-color: var(--line); border-top-color: var(--line);
}
.card-formal[class*="border-l-"]:hover, .card-formal[class*="border-t-"]:hover {
  border-left-color: #BFC8D4; border-top-color: #BFC8D4;
}
[class*="border-l-4"]:not(.card-formal), [class*="border-l-2"]:not(.card-formal) { border-left-width: 2px; }

/* ---------- Tables ---------- */
.table-formal th {
  background: var(--surface-2); color: var(--muted); font-weight: 600; text-transform: uppercase;
  font-size: 11px; letter-spacing: .07em; border-bottom: 1px solid var(--line-strong);
}
.table-formal td { border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.table-formal tr:hover td { background: var(--surface-2); }
table { font-variant-numeric: tabular-nums; }

/* ---------- Math callouts (projects) ---------- */
.math-callout {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 2px solid var(--ink);
  padding: 1.25rem 1.5rem; box-shadow: none;
}
.math-callout .katex-display { margin: .85rem 0; overflow-x: auto; overflow-y: hidden; }
.math-callout .math-expl {
  font-family: var(--sans); font-size: .8125rem; color: var(--muted); line-height: 1.6;
  border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem;
}
pre code { font-family: var(--mono); font-size: 12.5px; }
.katex { font-size: 1.04em; }

/* ---------- Status markers (replace emoji glyphs) ---------- */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.dot-pos { background: #2F7155; }
.dot-neg { background: #A9564B; }

/* ---------- Modals ---------- */
body.modal-open { overflow: hidden; }
.portfolio-modal { background: rgba(7, 20, 43, .62) !important; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }

/* ---------- Footer ---------- */
footer { color: var(--muted); }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #C5CCD6 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #C5CCD6; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #A8B1BF; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .site-header, .site-nav, .menu-toggle, .portfolio-modal { display: none !important; }
  body { background: #fff; }
}

/* ==========================================================================
   Components — overview / hero
   ========================================================================== */
.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }

#main { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2rem); }
.measure-reading #main > * { max-width: 64rem; }
.measure-reading #main section > p, .page-projects #main section > p { max-width: 74ch; }

.eyebrow {
  display: inline-block; font: 600 12px/1.4 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--brass);
}
[class*="text-[#0B2447]"].tracking-widest { color: var(--brass); font-weight: 600; }
p.uppercase { text-transform: none; letter-spacing: 0; }

.section-head { padding-bottom: .25rem; }

.status-line {
  display: inline-flex; align-items: center; gap: 10px;
  font: 500 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brass); }

.hero-title {
  font-size: clamp(2.9rem, 6vw, 4.5rem); line-height: 1.02; letter-spacing: -.03em; font-weight: 600; color: var(--ink);
}
.hero-sub {
  font-family: var(--sans); font-size: clamp(1.15rem, 2vw, 1.4rem); font-weight: 400; line-height: 1.4; color: var(--muted);
}
.pullquote { border-left: 2px solid var(--brass); padding: .2rem 0 .2rem 1.4rem; background: none; }
.pullquote-text { font-size: 1.2rem; line-height: 1.6; font-style: italic; color: var(--text-2); }

.btn-lg { height: 46px; padding: 0 22px; font-size: 14px; }
.btn-link { background: none; color: var(--ink); padding: 0 6px; border-color: transparent; }
.btn-link:hover { text-decoration: underline; }

.cred-list {
  display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: .5rem; padding-top: 1.35rem;
  border-top: 1px solid var(--line); font-size: 13px; color: var(--text-2);
}
.cred-item { display: flex; align-items: center; gap: 8px; }
.cred-check { color: var(--pos); }

/* Portrait */
.portrait-card {
  background: var(--surface); border: 1px solid var(--line-strong); padding: 10px;
  box-shadow: 0 1px 2px rgba(11, 36, 71, .04), 0 28px 50px -30px rgba(11, 36, 71, .32);
}
.portrait-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 4px 4px 12px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint);
}
.portrait-tag { font-weight: 600; color: var(--ink); }
.portrait-frame { position: relative; overflow: hidden; background: var(--surface-2); }
.portrait-img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 4.25; object-fit: cover; object-position: 50% 10%; }
.portrait-cap {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 22px; color: #fff;
  background: linear-gradient(to top, rgba(7, 20, 43, .84), rgba(7, 20, 43, 0) 50%);
}
.meta-table { margin-top: 8px; padding: 0 6px; }
.meta-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 18px;
  padding: 11px 0; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--faint);
}
.meta-row:first-child { border-top: 0; }
.meta-row > span:first-child { font-size: 11px; letter-spacing: .08em; flex: none; }
.meta-row > span:last-child { text-align: right; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border: 1px solid var(--line); border-radius: 2px;
  font: 600 11px/1.35 var(--sans); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.chip-pos { color: #1F4A39; background: #F2F7F4; border-color: #C6DDD0; }

/* Stat strip */
.stat-strip {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line);
}
.stat { padding: 28px 28px 30px; border-left: 1px solid var(--line); }
.stat:first-child { border-left: 0; padding-left: 0; }
.stat-label { display: block; margin-bottom: 12px; font: 600 11.5px/1.3 var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.stat-value { font-size: 1.9rem; line-height: 1.12; font-weight: 600; color: var(--ink); letter-spacing: -.02em; }
.stat-sub { margin-top: 8px; font-size: 13px; line-height: 1.45; font-weight: 600; color: var(--brass); }
.stat-desc { margin-top: 12px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
@media (max-width: 1023px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .stat-strip { grid-template-columns: 1fr; }
  .stat { border-left: 0; padding-left: 0; padding-right: 0; border-top: 1px solid var(--line); }
  .stat:first-child { border-top: 0; }
}

/* Recruiter dossier */
.dossier { background: var(--surface-2); border: 1px solid var(--line); padding: clamp(1.5rem, 3vw, 2.5rem); }
.action {
  display: flex; flex-direction: column; justify-content: space-between; width: 100%; text-align: left;
  background: #fff; border: 1px solid var(--line); padding: 22px; text-decoration: none; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.action:hover { border-color: var(--ink); box-shadow: 0 10px 24px -16px rgba(11, 36, 71, .35); }
.action-ico {
  display: grid; place-items: center; width: 38px; height: 38px; margin-bottom: 16px;
  border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: #fff;
  transition: background-color .2s, color .2s, border-color .2s;
}
.action:hover .action-ico { background: var(--ink); color: #fff; border-color: var(--ink); }
.action-foot {
  display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 600; color: var(--ink);
}

/* About */
.comp-row { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.comp-row:first-child { border-top: 0; padding-top: 4px; }

/* Footer */
.site-footer { margin-top: 6rem; border-top: 1px solid var(--line); background: var(--surface-2); padding: 3.5rem 0; font-size: 13px; color: var(--muted); }
.site-footer a:hover, .site-footer button:hover { color: var(--ink); }

/* ==========================================================================
   Refinements across all pages
   ========================================================================== */
/* dark panels: one border treatment instead of rainbow outlines */
[class*="bg-[#0B2447]"] [class*="border-emerald-"],
[class*="bg-[#0B2447]"] [class*="border-rose-"],
[class*="bg-[#0B2447]"] [class*="border-indigo-"],
[class*="bg-[#0B2447]"] [class*="border-amber-"],
[class*="bg-[#0B2447]"] [class*="border-sky-"] { border-color: rgba(255, 255, 255, .16); }

@media (min-width: 768px) {
  a[class*="bg-[#0B2447]"], button[class*="bg-[#0B2447]"] { white-space: nowrap; }
}

/* Typographic polish */
h1, h2, h3, h4 { text-wrap: balance; }
p, li { text-wrap: pretty; }
[class*="bg-emerald-50"][class*="border-emerald-"][class*="inline-flex"] { white-space: nowrap; }
