/* ============================================================
   guhan.us — Executive Dark
   Vanilla CSS, no framework. Designed for a low-power Pi origin
   behind Cloudflare. Aggressively cacheable, ~7KB gzipped.
   ============================================================ */

:root {
  --bg:        #0B1220;
  --bg-1:      #0F1730;
  --bg-2:      #131C36;
  --fg:        #E6EDF6;
  --muted:     #8B95A7;
  --hair:      rgba(230,237,246,0.08);
  --hair-2:    rgba(230,237,246,0.14);
  --accent:    #6AA9FF;
  --accent-2:  #8DC0FF;
  --glow:      rgba(106,169,255,0.18);
  --maxw:      1160px;
  --pad-x:     clamp(20px, 5vw, 48px);
  --font:      "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:      ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* -------- Reset ---------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--accent-2); }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* Subtle ambient glow */
body::before {
  content: "";
  position: fixed;
  inset: -25vh -25vw auto auto;
  width: 70vw; height: 70vw;
  max-width: 900px; max-height: 900px;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  filter: blur(10px);
  pointer-events: none;
  z-index: 0;
}
main, header, footer { position: relative; z-index: 1; }

/* -------- Nav ------------------------------------------------ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad-x);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: rgba(11,18,32,0.6);
  border-bottom: 1px solid var(--hair);
}
.nav__brand { display: inline-flex; align-items: center; gap: 12px; color: var(--fg); font-weight: 600; letter-spacing: -0.01em; }
.nav__mark {
  width: 14px; height: 14px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), #B58BFF);
  box-shadow: 0 0 24px var(--glow);
}
.nav__name { font-size: 15px; }
.nav__links { display: flex; align-items: center; gap: 22px; }
.nav__links a { color: var(--muted); font-size: 14px; font-weight: 500; }
.nav__links a:hover { color: var(--fg); }
.nav__cta {
  color: var(--fg) !important;
  padding: 8px 14px;
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  transition: border-color .2s ease, background .2s ease;
}
.nav__cta:hover { border-color: var(--accent); background: rgba(106,169,255,0.06); }
@media (max-width: 640px) {
  .nav__links a:not(.nav__cta) { display: none; }
}

/* -------- Layout helpers ------------------------------------- */
main { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--pad-x); }
.section { padding: 96px 0 24px; border-top: 1px solid var(--hair); }
.section--contact { padding-bottom: 120px; }
.section__head { display: flex; align-items: baseline; gap: 16px; margin-bottom: 40px; }
.section__index { font-family: var(--mono); color: var(--accent); font-size: 13px; letter-spacing: 0.1em; }
.section__title { font-size: clamp(28px, 4vw, 40px); font-weight: 600; }

/* -------- Hero ----------------------------------------------- */
.hero { padding: clamp(56px, 9vw, 110px) 0 clamp(48px, 8vw, 96px); }
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
@media (max-width: 880px) {
  .hero__grid { grid-template-columns: 1fr; }
}
.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}
.display {
  font-size: clamp(38px, 6.4vw, 72px);
  font-weight: 600;
  letter-spacing: -0.035em;
  background: linear-gradient(180deg, #FFFFFF 0%, #C9D4E8 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.lede {
  margin-top: 26px;
  font-size: clamp(16px, 1.6vw, 19px);
  color: #C5CDDD;
  max-width: 56ch;
  line-height: 1.65;
}
.lede strong { color: var(--fg); font-weight: 600; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px dashed var(--hair);
  color: var(--muted);
  font-size: 13px;
  font-family: var(--mono);
}
.hero__tags li { position: relative; padding-right: 14px; }
.hero__tags li:not(:last-child)::after {
  content: ""; position: absolute; right: 0; top: 50%;
  width: 3px; height: 3px; border-radius: 50%; background: var(--hair-2);
  transform: translateY(-50%);
}

.hero__portrait { margin: 0; }
.hero__portrait-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, #1A2444, #0E1730);
  border: 1px solid var(--hair-2);
  box-shadow:
    0 30px 60px rgba(0,0,0,0.45),
    0 0 0 1px rgba(106,169,255,0.06) inset;
}
.hero__portrait-frame::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(11,18,32,0.75) 100%);
  pointer-events: none;
}
.hero__portrait img { width: 100%; height: 100%; object-fit: cover; }
.hero__portrait figcaption {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.05em;
  text-align: right;
}

/* -------- Buttons ------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(180deg, #7BB3FF, #4F8EE6);
  color: #0B1220;
  box-shadow: 0 10px 24px -10px rgba(106,169,255,0.55);
}
.btn--primary:hover { color: #0B1220; box-shadow: 0 14px 30px -10px rgba(106,169,255,0.7); }
.btn--ghost {
  border-color: var(--hair-2);
  color: var(--fg);
  background: transparent;
}
.btn--ghost:hover { border-color: var(--accent); color: var(--fg); background: rgba(106,169,255,0.05); }
.btn--lg { padding: 14px 24px; font-size: 15px; }

/* -------- Prose --------------------------------------------- */
.prose p { color: #C5CDDD; max-width: 72ch; font-size: 17px; line-height: 1.75; }
.prose p + p { margin-top: 18px; }
.muted { color: var(--muted); font-weight: 500; }

/* -------- About split (prose + side recommendations) -------- */
.about__split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
@media (max-width: 900px) {
  .about__split { grid-template-columns: 1fr; }
}
.recos-side { display: flex; flex-direction: column; gap: 14px; }
.recos-side__lede {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 2px;
}
.reco-card { margin: 0; }
.reco-card blockquote {
  margin: 0 0 14px;
  color: #D2D9E6;
  font-size: 13.5px;
  line-height: 1.6;
  font-style: italic;
}
.reco-card figcaption {
  display: flex; flex-direction: column; gap: 1px;
  border-top: 1px dashed var(--hair);
  padding-top: 12px;
}
.reco-card figcaption strong { color: var(--fg); font-size: 12.5px; font-weight: 600; }
.reco-card figcaption span   { color: var(--muted); font-size: 11.5px; font-family: var(--mono); letter-spacing: 0.03em; }

/* -------- Manifesto callout --------------------------------- */
.manifesto {
  position: relative;
  margin: 88px 0 8px;
  padding: 36px 36px 36px 56px;
  border-radius: 16px;
  border: 1px solid var(--hair-2);
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(106,169,255,0.10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: center;
}
.manifesto::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--accent), transparent 90%);
}
.manifesto__lede {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.manifesto__body {
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.55;
  color: #E2E8F2;
  letter-spacing: -0.012em;
  max-width: 56ch;
  margin: 0;
}
.manifesto__body em {
  font-style: italic;
  color: var(--fg);
}
.manifesto__diagram {
  width: 100%;
  max-width: 420px;
  justify-self: end;
}
.manifesto__diagram svg {
  width: 100%;
  height: auto;
  display: block;
}
/* Faint pulse on the TLS lock indicators while the dot crosses them */
.diagram__lock {
  opacity: 0.55;
  animation: lock-pulse 4s ease-in-out infinite;
}
.diagram__lock:nth-of-type(2) { animation-delay: -2.7s; }
.diagram__lock:nth-of-type(3) { animation-delay: -1.3s; }
@keyframes lock-pulse {
  0%, 60%, 100% { opacity: 0.45; }
  20%           { opacity: 1; }
}
@media (max-width: 880px) {
  .manifesto {
    grid-template-columns: 1fr;
    padding: 32px 28px 32px 40px;
  }
  .manifesto__diagram {
    max-width: 380px;
    justify-self: start;
  }
}
@media (max-width: 640px) {
  .manifesto { padding: 28px 22px 28px 32px; }
}

/* -------- About stats strip --------------------------------- */
.stats {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0;
  border-top: 1px solid var(--hair);
  border-bottom: 1px solid var(--hair);
}
.stats li {
  padding: 22px 22px 22px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-right: 1px solid var(--hair);
}
.stats li:last-child { border-right: none; }
@media (max-width: 720px) {
  .stats li { border-right: none; border-bottom: 1px solid var(--hair); padding: 18px 0; }
  .stats li:last-child { border-bottom: none; }
}
.stats strong {
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 600;
  background: linear-gradient(180deg, #FFFFFF, #C9D4E8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stats span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  max-width: 28ch;
}

/* -------- Cards (skills, experience, credentials, etc.) ----- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}
.card {
  padding: 24px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  border: 1px solid var(--hair);
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}
.card:hover {
  border-color: var(--hair-2);
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
  transform: translateY(-2px);
}
.card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.card p { color: #BCC5D7; font-size: 14.5px; line-height: 1.65; }
.card__eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.card .ticked li {
  padding: 8px 0 8px 22px;
  font-size: 13.5px;
  border-bottom: 1px dashed var(--hair);
}
.card .ticked li:last-child { border-bottom: none; }
.card .ticked li::before { top: 16px; }
.card__link {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 1px;
  padding-bottom: 1px;
  transition: background-size .25s ease, color .2s ease;
}
.card__link:hover { color: var(--accent-2); background-size: 100% 1px; }
.card__link::after {
  content: " \2197";
  color: var(--muted);
  font-weight: 400;
  margin-left: 2px;
  transition: color .2s ease;
}
.card__link:hover::after { color: var(--accent-2); }
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 14px;
}
.chips li {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  padding: 4px 9px;
  border: 1px solid var(--hair);
  border-radius: 6px;
  letter-spacing: 0.02em;
}

/* -------- Cert + Contact cards (compact, icon inline) ------- */
.cards--certs,
.cards--contact {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.card--cert,
.card--contact {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  text-align: left;
}
.card--cert__logo,
.card--contact__icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  object-fit: contain;
  opacity: 0.95;
}
.card--cert__meta,
.card--contact__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.card--cert h3,
.card--contact h3 {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  color: var(--fg);
}
.card--cert .card__eyebrow,
.card--contact .card__eyebrow {
  margin: 0;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 11.5px;
}

/* Contact cards are anchors; preserve hover + arrow-on-hover feel */
.card--contact {
  text-decoration: none;
  color: var(--fg);
}
.card--contact:hover { color: var(--fg); }
.card--contact:hover .card__eyebrow { color: var(--accent); }

/* -------- Ticked list (used inside credential cards) -------- */
.ticked li {
  padding: 10px 0 10px 26px;
  position: relative;
  color: #C5CDDD;
  font-size: 14.5px;
  border-bottom: 1px dashed var(--hair);
}
.ticked li:last-child { border-bottom: none; }
.ticked li::before {
  content: "";
  position: absolute;
  left: 0; top: 18px;
  width: 12px; height: 6px;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

/* -------- Contact ------------------------------------------- */
.contact { display: grid; gap: 24px; max-width: 720px; }
.contact__lede { color: #C5CDDD; font-size: 18px; line-height: 1.7; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* -------- Footer -------------------------------------------- */
.foot {
  border-top: 1px solid var(--hair);
  padding: 28px var(--pad-x);
  max-width: var(--maxw);
  margin: 0 auto;
  color: var(--muted);
  font-size: 13px;
}
.foot__row { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* -------- Typewriter ---------------------------------------- */
.typewriter__char {
  opacity: 0;
  transition: opacity 60ms linear;
}
.typewriter__char--on {
  opacity: 1;
}
.typewriter--running::after {
  content: "\258C";
  display: inline-block;
  margin-left: 2px;
  color: var(--accent);
  font-weight: 700;
  animation: typewriter-caret 0.9s steps(2, end) infinite;
  vertical-align: baseline;
}
.typewriter--done::after { content: none; }
@keyframes typewriter-caret {
  to { opacity: 0; }
}

/* -------- Reveal animation (JS-fallback baseline) ----------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition:
    opacity .85s cubic-bezier(0.22, 1, 0.36, 1),
    transform .85s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* -------- Apple-style scroll-driven animations -------------- */
/* When the browser supports scroll-driven animations (Chrome 115+,
   Safari 26+), we ditch the IntersectionObserver path entirely and
   drive everything from real scroll position. Smoother, no jank. */
@supports (animation-timeline: view()) {
  html { scroll-behavior: smooth; }

  /* Each [data-reveal] eases in as it enters the viewport. */
  [data-reveal] {
    opacity: 0;
    transform: translateY(28px) scale(0.985);
    animation: scroll-reveal linear both;
    animation-timeline: view();
    animation-range: entry 8% cover 32%;
    will-change: opacity, transform;
    transition: none;
  }
  [data-reveal].is-visible { /* JS no-op in this branch */
    opacity: 0;
    transform: translateY(28px) scale(0.985);
  }

  @keyframes scroll-reveal {
    0%   { opacity: 0; transform: translateY(28px) scale(0.985); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
  }

  /* Card grids: subtle cascade. Each card enters slightly behind
     the previous one as the grid scrolls into view. */
  .cards > .card,
  .recos-side > .card {
    opacity: 0;
    transform: translateY(22px);
    animation: card-rise linear both;
    animation-timeline: view();
    animation-range: entry 4% cover 28%;
  }
  .cards > .card:nth-child(2),
  .recos-side > .card:nth-child(2) { animation-range: entry 7%  cover 32%; }
  .cards > .card:nth-child(3),
  .recos-side > .card:nth-child(3) { animation-range: entry 10% cover 36%; }
  .cards > .card:nth-child(4)      { animation-range: entry 13% cover 40%; }
  .cards > .card:nth-child(n+5)    { animation-range: entry 16% cover 44%; }

  @keyframes card-rise {
    0%   { opacity: 0; transform: translateY(22px); }
    100% { opacity: 1; transform: translateY(0); }
  }

  /* Hero portrait: gentle parallax. Drifts up slightly as the user
     scrolls past the hero. */
  .hero__portrait-frame {
    animation: portrait-parallax linear both;
    animation-timeline: scroll(root);
    animation-range: 0 80vh;
    will-change: transform;
  }
  @keyframes portrait-parallax {
    0%   { transform: translateY(0); }
    100% { transform: translateY(-40px); }
  }

  /* Section titles: slight scale-down as they sit at the top of the
     viewport. Tiny effect, but adds the high-end feel. */
  .section__title {
    animation: title-settle linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 18%;
    transform-origin: left center;
  }
  @keyframes title-settle {
    0%   { letter-spacing: 0.005em; }
    100% { letter-spacing: -0.02em; }
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  [data-reveal],
  .cards > .card,
  .recos-side > .card,
  .hero__portrait-frame,
  .section__title {
    opacity: 1; transform: none;
  }
  html { scroll-behavior: auto; }
}

/* -------- Print --------------------------------------------- */
@media print {
  body::before, .nav, .hero__cta, .contact__actions { display: none !important; }
  body { background: white; color: black; }
  .display, .display * { color: black !important; -webkit-text-fill-color: black; }
  .section { page-break-inside: avoid; }
}
