/* ==========================================================================
   Rohan Jalil — AI Agent & Full-Stack Developer
   Design system: editorial-technical. Warm paper, deep ink, ultramarine.
   Zero JavaScript. Fraunces / Instrument Sans / Spline Sans Mono.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --paper: #faf6ef;
  --paper-2: #f2ecdf;
  --paper-3: #eae2d1;
  --ink: #16130d;
  --ink-2: #3d382c;
  --ink-3: #6b6455;
  --line: rgba(22, 19, 13, 0.14);
  --line-soft: rgba(22, 19, 13, 0.08);
  --accent: #2430d8;
  --accent-deep: #1a24ad;
  --accent-bright: #7c86ff;
  --accent-wash: rgba(36, 48, 216, 0.07);
  --ok: #1d7a4f;

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Instrument Sans", "Avenir Next", "Helvetica Neue", sans-serif;
  --font-mono: "Spline Sans Mono", "SF Mono", Menlo, monospace;

  --size-hero: clamp(2.7rem, 6.4vw, 5.4rem);
  --size-h1: clamp(2.3rem, 4.8vw, 3.9rem);
  --size-h2: clamp(1.65rem, 3vw, 2.4rem);
  --size-h3: clamp(1.2rem, 1.8vw, 1.45rem);
  --size-body: 1.0625rem;
  --size-small: 0.9rem;
  --size-eyebrow: 0.75rem;

  --space-section: clamp(4.5rem, 10vw, 8.5rem);
  --width-content: 72rem;
  --width-prose: 44rem;
  --radius: 10px;
  --radius-lg: 16px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--size-body);
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--accent); color: var(--paper); }

/* ---------- Typography ---------- */
h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 560;
  line-height: 1.06;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 { font-size: var(--size-h1); }
h2 { font-size: var(--size-h2); line-height: 1.12; }
h3 { font-size: var(--size-h3); font-weight: 600; line-height: 1.3; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--size-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.eyebrow::before {
  content: "";
  width: 1.75rem;
  height: 1px;
  background: var(--accent);
  flex: none;
}
.eyebrow--plain::before { display: none; }

.lede {
  font-size: clamp(1.15rem, 1.8vw, 1.3rem);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 38em;
  text-wrap: pretty;
}

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--width-content);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}
.section { padding-block: var(--space-section); }
.section--tight { padding-block: calc(var(--space-section) * 0.62); }
.section-head { margin-bottom: clamp(2.25rem, 5vw, 3.75rem); max-width: 52rem; }
.section-head h2 { margin-top: 1.1rem; }
.section-head .lede { margin-top: 1.1rem; }
.rule { border: 0; border-top: 1px solid var(--line); }

/* Dotted engineering-grid texture */
.texture {
  background-image: radial-gradient(rgba(22, 19, 13, 0.075) 1px, transparent 1px);
  background-size: 26px 26px;
}

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: 0.9rem;
}
.wordmark {
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.wordmark b { color: var(--accent); font-weight: 640; }
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-2);
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--ink); background: var(--accent-wash); }
.nav-links a[aria-current="page"] { color: var(--accent); }
.nav-cta {
  margin-left: 0.5rem;
  flex: none;
}
@media (max-width: 680px) {
  .nav a.nav-cta { display: none; }
  .nav { gap: 0.75rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.85rem 1.35rem;
  border-radius: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -10px rgba(36, 48, 216, 0.55);
}
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: none;
}
.btn--sm { padding: 0.55rem 0.95rem; font-size: 0.74rem; }
.btn .arrow { transition: transform 0.15s; }
.btn:hover .arrow { transform: translateX(3px); }

/* On dark sections */
.on-dark .btn { background: var(--paper); border-color: var(--paper); color: var(--ink); }
.on-dark .btn:hover { background: var(--accent-bright); border-color: var(--accent-bright); color: var(--ink); }
.on-dark .btn--ghost { background: transparent; color: var(--paper); border-color: rgba(250, 246, 239, 0.35); }
.on-dark .btn--ghost:hover { color: var(--accent-bright); border-color: var(--accent-bright); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(4rem, 9vw, 7.5rem) clamp(3.5rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--line-soft);
}
.hero h1 { font-size: var(--size-hero); max-width: 13ch; }
.hero h1 em {
  font-style: italic;
  font-weight: 480;
  color: var(--accent);
}
.hero .lede { margin-top: 1.75rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.5rem; }
.hero-eyebrow { margin-bottom: 1.5rem; }
.hero-inner { position: relative; z-index: 2; }

/* Agent-graph decoration */
.hero-graph {
  position: absolute;
  right: 2%;
  top: 50%;
  transform: translateY(-50%);
  width: min(36vw, 520px);
  z-index: 1;
  opacity: 0.85;
  pointer-events: none;
}
.hero-graph .edge {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
}
.hero-graph .edge--live {
  stroke: var(--accent);
  stroke-dasharray: 6 8;
  animation: flow 2.6s linear infinite;
}
.hero-graph .node { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.hero-graph .node--accent { fill: var(--accent); stroke: var(--accent); }
.hero-graph .node-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--ink-3);
}
@keyframes flow { to { stroke-dashoffset: -56; } }
@media (max-width: 1240px) {
  .hero-graph { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-graph .edge--live { animation: none; }
  html { scroll-behavior: auto; }
}

/* Compact interior hero */
.hero--page { padding-block: clamp(3rem, 6vw, 4.5rem) clamp(2.5rem, 5vw, 3.5rem); }
.hero--page h1 { font-size: var(--size-h1); max-width: 18ch; }

/* ---------- Breadcrumbs ---------- */
.crumbs {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  margin-bottom: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.crumbs a { color: var(--ink-3); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--line); }
.crumbs [aria-current] { color: var(--ink); }

/* ---------- Meta stamp (last reviewed / dates) ---------- */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  background: var(--paper);
}
.stamp::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

/* ---------- Stats strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  border-block: 1px solid var(--line);
}
.stat {
  padding: 1.75rem 1.5rem 1.6rem;
  border-right: 1px solid var(--line-soft);
}
.stat:last-child { border-right: 0; }
.stat .num {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.2vw, 2.7rem);
  font-weight: 560;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat .num sup { font-size: 0.5em; color: var(--accent); }
.stat .label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 0.7rem;
}
@media (max-width: 720px) {
  .stat { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .stat:last-child { border-bottom: 0; }
}

/* ---------- Card grids ---------- */
.grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
}
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  background: var(--paper-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  padding: 1.9rem 1.75rem 1.75rem;
  text-decoration: none;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(36, 48, 216, 0.35);
  box-shadow: 0 18px 40px -24px rgba(22, 19, 13, 0.35);
}
.card .index {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}
.card h3 { font-size: 1.28rem; }
.card p { color: var(--ink-2); font-size: 0.98rem; line-height: 1.6; }
.card .go {
  margin-top: auto;
  padding-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
  transition: color 0.15s;
}
.card:hover .go { color: var(--accent); }

/* Tag row */
.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  background: var(--paper);
}

/* ---------- Spec table (engineering-brief) ---------- */
.spec {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--line);
  font-size: 0.98rem;
}
.spec th, .spec td {
  text-align: left;
  vertical-align: top;
  padding: 0.95rem 1rem 0.95rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.spec th {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  width: 13rem;
  padding-right: 2rem;
}
.spec td { color: var(--ink-2); }
.spec td strong { color: var(--ink); }
@media (max-width: 620px) {
  .spec, .spec tbody, .spec tr, .spec th, .spec td { display: block; width: 100%; }
  .spec th { border-bottom: 0; padding-bottom: 0.2rem; }
  .spec td { padding-top: 0.15rem; }
}

/* Comparison / data table */
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 34rem;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line-soft);
}
.data-table thead th {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}
.data-table td strong { color: var(--accent); }

/* ---------- Prose (long-form case studies / service body) ---------- */
.prose { max-width: var(--width-prose); }
.prose > * + * { margin-top: 1.2rem; }
.prose h2 { margin-top: 3.2rem; }
.prose h3 { margin-top: 2.2rem; }
.prose h2 + *, .prose h3 + * { margin-top: 1rem; }
.prose a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose a:hover { color: var(--accent-deep); }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin-block: 0.45rem; }
.prose li::marker { color: var(--accent); font-family: var(--font-mono); font-size: 0.9em; }
.prose strong { font-weight: 600; }
.prose .spec, .prose .table-scroll { margin-block: 1.8rem; }

/* Numbered section headings for case studies */
.prose .num-h {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
}
.prose .num-h .n {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--accent);
  flex: none;
}

/* Answer-first callout: quotable block */
.answer {
  border-left: 3px solid var(--accent);
  background: var(--accent-wash);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1.35rem 1.6rem;
  font-size: 1.02rem;
}
.answer strong { color: var(--ink); }

/* Key metric callout */
.metric-band {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1px;
  background: var(--line-soft);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-block: 2rem;
}
.metric-band .m { background: var(--paper-2); padding: 1.4rem 1.3rem; }
.metric-band .m .num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 560;
  color: var(--accent-deep);
  line-height: 1;
}
.metric-band .m .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 0.55rem;
  line-height: 1.5;
}

/* Code / architecture block */
.prose pre, .arch {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.65;
  background: var(--ink);
  color: #e9e4d8;
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  overflow-x: auto;
}
.arch .c { color: #8f887a; }
.arch .a { color: var(--accent-bright); }

/* FAQ */
.faq { max-width: var(--width-prose); border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line-soft); }
.faq summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1.3rem 0.25rem;
  font-family: var(--font-display);
  font-size: 1.14rem;
  font-weight: 600;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--accent);
  flex: none;
  transition: transform 0.2s;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq .faq-a { padding: 0 0.25rem 1.4rem; color: var(--ink-2); max-width: 40em; }
.faq .faq-a > * + * { margin-top: 0.8rem; }

/* ---------- Dark band (ink sections) ---------- */
.band-dark {
  background: var(--ink);
  color: var(--paper);
}
.band-dark .eyebrow { color: var(--accent-bright); }
.band-dark .eyebrow::before { background: var(--accent-bright); }
.band-dark .lede { color: rgba(250, 246, 239, 0.72); }
.band-dark ::selection { background: var(--accent-bright); color: var(--ink); }

/* Profile links row (evidence) */
.proof-links { display: flex; flex-wrap: wrap; gap: 0.9rem; }
.proof-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.05em;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.85rem 1.15rem;
  color: var(--ink-2);
  background: var(--paper);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.proof-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.on-dark .proof-link { background: transparent; color: rgba(250,246,239,0.8); border-color: rgba(250,246,239,0.25); }
.on-dark .proof-link:hover { color: var(--accent-bright); border-color: var(--accent-bright); }

/* ---------- Timeline (career) ---------- */
.timeline { border-left: 1px solid var(--line); padding-left: 2rem; display: grid; gap: 2.2rem; max-width: var(--width-prose); }
.timeline .t-item { position: relative; }
.timeline .t-item::before {
  content: "";
  position: absolute;
  left: calc(-2rem - 5px);
  top: 0.5rem;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--accent);
}
.timeline .t-when {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.timeline h3 { margin-top: 0.35rem; }
.timeline p { color: var(--ink-2); margin-top: 0.45rem; max-width: 38em; }

/* ---------- CTA band ---------- */
.cta-band { text-align: left; }
.cta-band .display {
  font-size: clamp(2.2rem, 5vw, 4rem);
  max-width: 16ch;
}
.cta-band .actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.25rem; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: rgba(250, 246, 239, 0.75);
  padding-block: clamp(3.5rem, 7vw, 5.5rem) 2.5rem;
  font-size: 0.95rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 3rem;
}
@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer .wordmark { color: var(--paper); }
.footer-tag { margin-top: 1rem; max-width: 26em; line-height: 1.65; }
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(250, 246, 239, 0.45);
  margin-bottom: 1rem;
}
.footer-col ul { list-style: none; padding: 0; display: grid; gap: 0.55rem; }
.footer-col a { text-decoration: none; color: rgba(250, 246, 239, 0.78); transition: color 0.15s; }
.footer-col a:hover { color: var(--accent-bright); }
.footer-base {
  border-top: 1px solid rgba(250, 246, 239, 0.14);
  padding-top: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: rgba(250, 246, 239, 0.45);
}
.footer-base a { color: inherit; text-decoration: none; }
.footer-base a:hover { color: var(--accent-bright); }

/* ---------- Page-load reveal ---------- */
@media (prefers-reduced-motion: no-preference) {
  .reveal { animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .reveal-2 { animation: rise 0.7s 0.12s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .reveal-3 { animation: rise 0.7s 0.24s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Utilities ---------- */
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
