/* ============================================================
   Muhammad Ahmad Waseem — Portfolio
   Design system: Editorial / Technical
   ============================================================ */

:root {
  /* -------- Palette (warm paper + ink + burnt sienna) -------- */
  --paper:      oklch(0.972 0.008 85);
  --paper-2:    oklch(0.945 0.010 82);
  --paper-3:    oklch(0.905 0.012 80);
  --ink:        oklch(0.205 0.012 60);
  --ink-2:      oklch(0.345 0.012 60);
  --ink-3:      oklch(0.555 0.012 65);
  --rule:       oklch(0.86 0.010 75);
  --rule-2:     oklch(0.80 0.012 75);
  --accent:     oklch(0.52 0.14 38);  /* burnt sienna */
  --accent-2:   oklch(0.42 0.13 38);
  --highlight:  oklch(0.88 0.08 88);  /* marker yellow */

  /* -------- Type -------- */
  --f-display: 'Instrument Serif', 'Iowan Old Style', Garamond, serif;
  --f-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* -------- Layout -------- */
  --rail-w: 0px;
  --nav-h: 64px;
  --gutter: clamp(24px, 4vw, 72px);
  --max-w:  1400px;
}

/* -------- Base ---------------------------------------------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body {
  background-image:
    radial-gradient(1200px 600px at 90% -10%, oklch(0.92 0.03 40 / .35), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, oklch(0.90 0.02 80 / .4), transparent 60%);
  background-attachment: fixed;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--paper); }

/* -------- Type utilities ------------------------------------ */
.f-display { font-family: var(--f-display); font-weight: 400; letter-spacing: -0.01em; }
.f-mono    { font-family: var(--f-mono); font-size: 0.78rem; letter-spacing: 0.02em; }
.mono-label {
  font-family: var(--f-mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
}
h1, h2, h3 { margin: 0; }

/* -------- Layout shell -------------------------------------- */
.shell { min-height: 100vh; position: relative; }

/* Top navigation bar */
.topnav {
  position: sticky; top: 0; z-index: 60;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 40px;
  padding: 0 var(--gutter);
  height: var(--nav-h);
  background: oklch(0.975 0.006 80 / 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topnav-brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--f-display);
  font-size: 1.25rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.topnav-brand .mark {
  width: 30px; height: 30px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display);
  font-size: 15px;
  transition: background .2s ease, color .2s ease;
}
.topnav-brand:hover .mark { background: var(--ink); color: var(--paper); }
.topnav-brand .who { display: flex; flex-direction: column; line-height: 1.1; }
.topnav-brand .who em { font-style: italic; color: var(--accent); }
.topnav-brand .who small { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }

.topnav-links {
  display: flex; gap: 2px;
  justify-content: center;
}
.topnav-links a {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 10px 14px;
  border-bottom: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.topnav-links a .num { font-size: 9px; color: var(--ink-3); }
.topnav-links a:hover { color: var(--ink); }
.topnav-links a.active { color: var(--accent); border-bottom-color: var(--accent); }
.topnav-links a.active .num { color: var(--accent); }

.topnav-right {
  display: flex; align-items: center; gap: 16px;
  font-family: var(--f-mono); font-size: 10px;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3);
}
.topnav-right .dot { width: 6px; height: 6px; background: oklch(0.62 0.17 145); border-radius: 50%; display: inline-block; margin-right: 6px; box-shadow: 0 0 0 3px oklch(0.62 0.17 145 / .18); animation: pulse 2s infinite ease-in-out; }
.topnav-right .btn-mini { padding: 7px 12px; border: 1px solid var(--ink); color: var(--ink); }
.topnav-right .btn-mini:hover { background: var(--ink); color: var(--paper); }

.mobilenav-toggle { display: none; background: transparent; border: 1px solid var(--rule-2); padding: 8px 10px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); cursor: pointer; }
@media (max-width: 980px) {
  .topnav { grid-template-columns: auto auto; gap: 16px; }
  .topnav-links { display: none; position: absolute; top: var(--nav-h); left: 0; right: 0; flex-direction: column; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 12px var(--gutter); gap: 0; }
  .topnav-links.open { display: flex; }
  .topnav-links a { padding: 14px 0; border-bottom: 1px solid var(--rule); }
  .topnav-right .sub-text { display: none; }
  .mobilenav-toggle { display: inline-block; }
}

/* Remove old rail */
.rail { display: none !important; }

/* Left nav rail */
.rail {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--rail-w);
  border-right: 1px solid var(--rule);
  background: oklch(0.975 0.006 80 / 0.75);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0;
  z-index: 50;
}
.rail-logo {
  display: block;
  width: 38px; height: 38px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-display);
  font-size: 20px;
  color: var(--ink);
  transition: background .25s ease, color .25s ease;
}
.rail-logo:hover { background: var(--ink); color: var(--paper); }
.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: auto 0;
  align-items: center;
}
.rail-nav a {
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 10px 0;
  width: 100%;
  text-align: center;
  position: relative;
  transition: color .2s ease;
  display: block;
}
.rail-nav a .num { display: block; font-size: 8px; margin: 0 0 2px; }
.rail-nav a:hover { color: var(--ink); }
.rail-nav a.active { color: var(--accent); }
.rail-nav a.active::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -2px;
  transform: translateX(-50%);
  width: 14px; height: 1px;
  background: var(--accent);
}
.rail-nav .num { color: var(--ink-3); display: block; font-size: 8px; margin: 0 0 2px; }
.rail-socials {
  display: flex; flex-direction: column; gap: 12px;
  align-items: center;
}
.rail-socials a {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2);
  transition: color .2s ease, transform .2s ease;
}
.rail-socials a:hover { color: var(--accent); transform: translateY(-2px); }
.rail-socials svg { width: 16px; height: 16px; }

/* Legacy topstrip — kept hidden for compatibility */
.topstrip { display: none; }
/* (legacy) */
.topstrip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  background: oklch(0.975 0.006 80 / 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topstrip .left { display: flex; gap: 24px; align-items: center; }
.topstrip .right { display: flex; gap: 24px; align-items: center; }
.topstrip .dot {
  width: 6px; height: 6px;
  background: oklch(0.62 0.17 145);
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 3px oklch(0.62 0.17 145 / .18);
  animation: pulse 2s infinite ease-in-out;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .45; }
}

/* Content container */
.page { padding: 48px var(--gutter) 120px; }
.container { max-width: var(--max-w); margin: 0 auto; }

/* Section header (reusable) */
.sect-head {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 32px;
  align-items: baseline;
  border-top: 1px solid var(--ink);
  padding: 28px 0 18px;
  margin-top: 80px;
}
.sect-head .idx {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.sect-head h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 4.5vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.sect-head .lede {
  grid-column: 2;
  font-size: 1.05rem;
  color: var(--ink-2);
  max-width: 62ch;
  margin-top: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: background .25s ease, color .25s ease, transform .25s ease;
  background: transparent;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn svg { width: 14px; height: 14px; }

/* Links within prose */
.link {
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 1px;
  transition: color .2s ease, border-color .2s ease;
}
.link:hover { color: var(--accent); border-color: var(--accent); }

/* Cards / common */
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .8s ease, transform .8s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 820px) {
  .sect-head { grid-template-columns: 1fr; gap: 6px; }
  .sect-head .lede { grid-column: 1; }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 60px var(--gutter) 40px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  background: oklch(0.945 0.010 82);
}
.site-footer h3 {
  font-family: var(--f-display);
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1;
  letter-spacing: -0.02em;
  max-width: 12ch;
}
.site-footer .meta {
  text-align: right;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.8;
}
.site-footer .meta a:hover { color: var(--accent); }
@media (max-width: 820px) {
  .site-footer { grid-template-columns: 1fr; }
  .site-footer .meta { text-align: left; }
}

/* Tweaks panel */
.tweaks-fab {
  position: fixed;
  bottom: 20px; right: 20px;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 100;
  border: none;
  box-shadow: 0 6px 20px oklch(0.2 0.01 60 / .25);
}
.tweaks-fab.visible { display: flex; }
.tweaks-panel {
  position: fixed;
  bottom: 76px; right: 20px;
  width: 280px;
  background: var(--paper);
  border: 1px solid var(--ink);
  padding: 16px;
  z-index: 100;
  display: none;
  box-shadow: 0 12px 32px oklch(0.2 0.01 60 / .2);
}
.tweaks-panel.open { display: block; }
.tweaks-panel h4 {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 12px;
}
.tweaks-row { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; align-items: center; }
.tweaks-row label { font-size: 12px; color: var(--ink-2); }
.tweaks-swatches { display: flex; gap: 8px; }
.tweaks-swatches button {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  cursor: pointer;
  padding: 0;
}
.tweaks-swatches button.on { outline: 2px solid var(--ink); outline-offset: 2px; }
