/* ============================================================
   Aman Kumar Yadav — Portfolio
   Dark "ops-terminal" theme · no build step · Cloudflare Pages
   ============================================================ */

:root {
  --bg: #faf6ed;
  --bg-soft: #f2ecdd;
  --surface: rgba(255, 253, 247, 0.75);
  --surface-strong: #ffffff;
  --border: rgba(122, 106, 80, 0.22);
  --border-bright: rgba(180, 83, 9, 0.5);
  --text: #2b241a;
  --text-dim: #6f6552;
  --accent: #b45309;      /* cyan */
  --accent-2: #c2410c;    /* violet */
  --accent-3: #0f8a5f;    /* green (terminal) */
  --danger: #dc2626;
  --warn: #a16207;
  --radius: 16px;
  --font-sans: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --shadow-glow: 0 0 40px rgba(180, 83, 9, 0.12);
  --nav-h: 72px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(180, 83, 9, 0.22); color: #2b241a; }

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.container {
  width: min(1120px, 100% - 3rem);
  margin-inline: auto;
}

.accent { color: var(--accent); }

/* Registered custom property lets the gradient angle animate natively
   (cutting-edge CSS Houdini @property; older browsers just show a static gradient) */
@property --grad-angle {
  syntax: "<angle>";
  initial-value: 90deg;
  inherits: false;
}

.gradient-text {
  background: linear-gradient(var(--grad-angle, 90deg), var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: grad-spin 8s linear infinite;
}
@keyframes grad-spin {
  to { --grad-angle: 450deg; }
}

h1, h2, h3 { text-wrap: balance; }

/* Cross-document view transition (index ↔ 404) in supporting browsers */
@view-transition {
  navigation: auto;
}

/* Visually hidden but available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  background: var(--accent);
  color: #fff8ec;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 150;
  background: transparent;
}
.scroll-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.1s linear;
}

/* Native scroll-driven progress bar where supported — zero JS on the hot scroll path.
   script.js detects support and skips its width fallback. */
@supports (animation-timeline: scroll()) {
  .scroll-progress span {
    width: 100%;
    transition: none;
    transform: scaleX(0);
    transform-origin: 0 50%;
    animation: grow-progress auto linear both;
    animation-timeline: scroll(root);
  }
  @keyframes grow-progress {
    to { transform: scaleX(1); }
  }
}

/* ---------- Background layers ---------- */
#particles {
  position: fixed;
  inset: 0;
  z-index: -3;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(122, 106, 80, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(122, 106, 80, 0.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, black 40%, transparent 100%);
  pointer-events: none;
}

.bg-glow {
  position: fixed;
  z-index: -2;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.35;
  pointer-events: none;
}
.bg-glow--1 {
  width: 520px; height: 520px;
  top: -180px; right: -120px;
  background: radial-gradient(circle, rgba(217, 119, 6, 0.35), transparent 70%);
}
.bg-glow--2 {
  width: 620px; height: 620px;
  bottom: -240px; left: -180px;
  background: radial-gradient(circle, rgba(194, 65, 12, 0.28), transparent 70%);
}

/* ---------- Glass card ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 12px;
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }

.btn--primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff8ec;
  box-shadow: 0 4px 24px rgba(180, 83, 9, 0.3);
}
.btn--primary:hover { box-shadow: 0 8px 32px rgba(180, 83, 9, 0.42); }

.btn--outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--border-bright);
}
.btn--outline:hover { background: rgba(180, 83, 9, 0.08); }

.btn--sm { padding: 8px 18px; font-size: 0.82rem; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}
.nav.is-scrolled {
  background: rgba(250, 246, 237, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--border);
}

.nav__inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.nav__logo {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.06rem;
  color: var(--text);
}
.nav__logo:hover { text-decoration: none; }
.nav__prompt { color: var(--accent-3); }

.nav__menu {
  display: flex;
  align-items: center;
  gap: 26px;
  list-style: none;
}

.nav__link {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-dim);
  transition: color 0.2s ease;
}
.nav__link:hover, .nav__link.is-active { color: var(--accent); text-decoration: none; }

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  cursor: pointer;
  padding: 8px;
}
.nav__toggle span {
  width: 24px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav__toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__toggle.is-open span:nth-child(2) { opacity: 0; }
.nav__toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  align-items: center;
  gap: 48px;
  padding-top: calc(var(--nav-h) + 24px);
  padding-bottom: 48px;
}

.hero__hello {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent-3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.status-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--accent-3);
  box-shadow: 0 0 0 0 rgba(15, 138, 95, 0.5);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 10px rgba(15, 138, 95, 0); }
  100% { box-shadow: 0 0 0 0 rgba(15, 138, 95, 0); }
}

.hero__title {
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

.hero__role {
  font-family: var(--font-mono);
  font-size: clamp(1.02rem, 2.2vw, 1.3rem);
  margin-bottom: 22px;
  min-height: 1.8em;
}
/* On narrow phones the longest role wraps to 2 lines — reserve both so
   the rotating text never shifts the content below it */
@media (max-width: 480px) {
  .hero__role { min-height: 3.6em; }
}
.hero__role-prefix { color: var(--text-dim); }
.typed { color: var(--accent); font-weight: 700; }
.typed-cursor {
  color: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero__summary {
  color: var(--text-dim);
  max-width: 56ch;
  margin-bottom: 30px;
}
.hero__summary strong { color: var(--text); font-weight: 600; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}

.hero__meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  font-size: 0.9rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* ---------- Terminal ---------- */
/* The terminal window deliberately stays dark on the light page —
   its colors are hardcoded, decoupled from the light theme tokens. */
.terminal {
  border-radius: var(--radius);
  border: 1px solid rgba(43, 36, 26, 0.9);
  background: rgba(10, 8, 3, 0.92);
  box-shadow: var(--shadow-glow), 0 24px 60px rgba(43, 36, 26, 0.35);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 0.83rem;
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.terminal__dot { width: 12px; height: 12px; border-radius: 50%; }
.terminal__dot--r { background: #ff5f57; }
.terminal__dot--y { background: #febc2e; }
.terminal__dot--g { background: #28c840; }
.terminal__title {
  margin-left: 10px;
  color: #a89f8d;
  font-size: 0.78rem;
}

.terminal__body {
  padding: 18px;
  height: 360px; /* fixed so the typing animation never shifts page layout */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(251, 191, 36, 0.35) transparent;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal__body .t-prompt { color: #34d399; }
.terminal__body .t-cmd { color: #ede8df; }
.terminal__body .t-out { color: #a89f8d; }
.terminal__body .t-ok { color: #34d399; }
.terminal__body .t-info { color: #fbbf24; }
.terminal__body .t-warn { color: #eab308; }
.terminal__body .t-caret {
  display: inline-block;
  width: 8px; height: 1.05em;
  background: #34d399;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

/* ---------- Metrics ---------- */
.metrics { padding-block: 24px 8px; }

.metrics__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.metric {
  text-align: center;
  padding: 26px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.metric:hover { border-color: var(--border-bright); transform: translateY(-4px); }

.metric__value {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 3.4vw, 2.4rem);
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}

.metric__label {
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ---------- Sections ---------- */
.section { padding-block: 96px 0; }
.section--contact { padding-bottom: 80px; }

.section__title {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 700;
  margin-bottom: 42px;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.section__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-bright), transparent);
  margin-left: 8px;
}
.section__num {
  font-family: var(--font-mono);
  font-size: 0.65em;
  color: var(--accent);
  font-weight: 500;
}

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: start;
}

.about__text p { margin-bottom: 18px; color: var(--text-dim); }
.about__text strong { color: var(--text); font-weight: 600; }

.about__card { padding: 26px; }
.about__card-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 14px;
  font-weight: 500;
}
.about__yaml {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.9;
  overflow-x: auto;
}
.y-key { color: var(--accent); }
.y-val { color: var(--text); }
.y-bool { color: var(--accent-2); }
.y-dash { color: var(--text-dim); }

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  display: grid;
  gap: 34px;
  padding-left: 28px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2), transparent);
  opacity: 0.5;
}

.timeline__item { position: relative; }

.timeline__marker {
  position: absolute;
  left: -28px;
  top: 30px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 12px rgba(180, 83, 9, 0.35);
}

.timeline__card {
  padding: 28px 30px;
  transition: border-color 0.3s ease, transform 0.3s ease;
}
.timeline__card:hover { border-color: var(--border-bright); transform: translateX(4px); }

.timeline__head h3 { font-size: 1.15rem; margin-bottom: 4px; }
.timeline__org {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--accent);
  margin-bottom: 16px;
}
.timeline__date {
  color: var(--text-dim);
  font-size: 0.82rem;
  margin-left: 10px;
}

.timeline__points {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}
.timeline__points li {
  position: relative;
  padding-left: 22px;
  color: var(--text-dim);
  font-size: 0.95rem;
}
.timeline__points li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}
.timeline__points strong { color: var(--text); font-weight: 600; }

/* ---------- Tags & chips ---------- */
.tags, .chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags li {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  padding: 4px 12px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(180, 83, 9, 0.08);
  border: 1px solid rgba(180, 83, 9, 0.28);
}

.chips li {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  padding: 7px 15px;
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  transition: border-color 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
  cursor: default;
}
.chips li:hover {
  border-color: var(--border-bright);
  box-shadow: 0 0 16px rgba(180, 83, 9, 0.15);
  color: var(--accent);
}

/* ---------- Skills ---------- */
.skills {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.skills__group { padding: 26px; }
.skills__group h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Marquee ---------- */
.marquee {
  margin-top: 44px;
  overflow: hidden;
  border-block: 1px solid var(--border);
  padding-block: 14px;
  mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, black 12%, black 88%, transparent);
}
.marquee__track {
  display: flex;
  gap: 28px;
  width: max-content;
  font-family: var(--font-mono);
  color: var(--text-dim);
  font-size: 0.9rem;
  animation: marquee 28s linear infinite;
}
@keyframes marquee {
  to { transform: translateX(-50%); }
}
.marquee:hover .marquee__track { animation-play-state: paused; }

/* ---------- Projects ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.project {
  position: relative;
  padding: 28px;
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
  transform-style: preserve-3d;
  will-change: transform;
}
.project:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-glow);
}

.project__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(180, 83, 9, 0.08), transparent 60%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.project:hover .project__glow { opacity: 1; }

.project__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.project__icon { font-size: 1.6rem; }
.project__head h3 { font-size: 1.06rem; }

.project p {
  color: var(--text-dim);
  font-size: 0.93rem;
  margin-bottom: 18px;
}
.project strong { color: var(--text); font-weight: 600; }

.project__links {
  display: flex;
  gap: 18px;
  margin-top: 16px;
}
.project__links a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- Education ---------- */
.edu {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 28px 30px;
}
.edu__icon { font-size: 2.2rem; }
.edu h3 { font-size: 1.1rem; margin-bottom: 4px; }
.edu__org {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* ---------- Contact ---------- */
.contact {
  text-align: center;
  padding: 56px 32px;
  background:
    radial-gradient(600px circle at 50% 0%, rgba(180, 83, 9, 0.06), transparent 60%),
    var(--surface);
}

.contact__lead {
  max-width: 52ch;
  margin: 0 auto 30px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.contact__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 22px;
}

.contact__alt {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--text-dim);
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 40px;
  border-top: 1px solid var(--border);
  padding: 34px 24px 42px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
}
.footer__mono {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

/* ---------- Reveal animation ----------
   Hidden state is gated on the .js class (set inline in <head>) so visitors
   with JS blocked or failed still see all content. */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}


/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 40px;
    padding-top: calc(var(--nav-h) + 48px);
    min-height: 0;
  }
  .about { grid-template-columns: 1fr; }
  .projects { grid-template-columns: 1fr 1fr; }
  .metrics__grid { grid-template-columns: 1fr 1fr; }

  /* Hamburger kicks in at 960px: below that the full nav row no longer fits
     (e.g. iPad portrait at 768px) and links would wrap inside the fixed header */
  .nav__toggle { display: flex; }
  .nav__menu {
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    max-height: calc(100svh - var(--nav-h));
    overflow-y: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(250, 246, 237, 0.98);
    border-bottom: 1px solid var(--border);
    padding: 10px 24px 20px;
    transform: translateY(-12px);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
  }
  .nav__menu.is-open {
    transform: none;
    opacity: 1;
    visibility: visible;
  }
  .nav__menu li { width: 100%; }
  .nav__link { display: block; padding: 12px 0; font-size: 1rem; }
  .nav__cta { margin-top: 12px; }
}

@media (max-width: 720px) {
  .projects { grid-template-columns: 1fr; }
  .skills { grid-template-columns: 1fr; }
  .section { padding-block: 72px 0; }
  .section--contact { padding-bottom: 64px; }
  .terminal__body { height: 300px; }
  .edu { flex-direction: row; }
}

@media (max-width: 480px) {
  .metrics__grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .container { width: min(1120px, 100% - 2rem); }
  .timeline { padding-left: 22px; }
  .timeline__marker { left: -22px; }
  .timeline__card { padding: 22px 20px; }
  .contact { padding: 44px 20px; }
  .contact__actions .btn { width: 100%; justify-content: center; word-break: break-all; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .marquee__track { animation: none; }
  .gradient-text { animation: none; }
}
