/* ============================================================
   Dhananjay Mishra — portfolio
   Concept: "systems that run while you sleep"
   Terminal-amber accent · ink-blue dark / cool-paper light
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --font-display: "Bricolage Grotesque", "Arial Black", sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

:root[data-theme="dark"] {
  --bg: #0b0e14;
  --surface: #10141d;
  --text: #eae6da;
  --muted: #8b90a1;
  --accent: #ffb224;
  --accent-ink: #1a1205;   /* text on accent surfaces */
  --line: rgba(234, 230, 218, 0.14);
  --portrait-wash: rgba(255, 178, 36, 0.5);
  --grain-opacity: 0.05;
  --header-bg: rgba(11, 14, 20, 0.72);
}

:root[data-theme="light"] {
  --bg: #f2f2ef;
  --surface: #e9e9e3;
  --text: #171a21;
  --muted: #5c6070;
  --accent: #9a5b00;
  --accent-ink: #fdf6ea;
  --line: rgba(23, 26, 33, 0.16);
  --portrait-wash: rgba(154, 91, 0, 0.35);
  --grain-opacity: 0.035;
  --header-bg: rgba(242, 242, 239, 0.78);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
ul { list-style: none; }
a { color: inherit; text-decoration: none; }

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

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

/* ---------- header ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1.25rem, 4vw, 3rem);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  border-bottom: 1px solid transparent;
}

.site-header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom-color: var(--line);
}

.monogram {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.cursor-blink {
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.header-nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
}

.header-nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color 0.2s ease;
}

.header-nav a:hover { color: var(--accent); }

.theme-toggle {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }

:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 0 clamp(1.25rem, 5vw, 5rem) clamp(4.5rem, 10vh, 7rem);
}

#stream {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* transparent-cutout portrait anchored to the hero floor,
   with a faint amber glow behind the figure */
.hero-portrait {
  position: absolute;
  right: clamp(0rem, 2vw, 2.5rem);
  bottom: 0;
  width: min(52vw, 720px);
  height: 94%;
  z-index: 1;
  background: radial-gradient(ellipse 62% 48% at 52% 62%, var(--portrait-wash), transparent 72%);
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  filter: grayscale(1) contrast(1.08) brightness(1.02);
  /* dissolve the crop line where the figure meets the hero floor */
  -webkit-mask-image: linear-gradient(to bottom, #000 90%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 90%, transparent 100%);
}

:root[data-theme="light"] .hero-portrait img {
  filter: grayscale(1) contrast(1.04) brightness(1.06);
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 1400px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before { content: "// "; }

.hero-eyebrow { margin-bottom: 1.25rem; }

.hero-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3.2rem, 11.5vw, 10rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 1.5rem;
}

.hero-name .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em; /* keep descenders inside the clip */
  margin-bottom: -0.06em;
}

.hero-name .ch {
  display: inline-block;
  transform: translateY(115%);
  opacity: 0;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.5s ease;
}

.hero-name .ch.in {
  transform: translateY(0);
  opacity: 1;
}

.hero-sub {
  max-width: 34rem;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--muted);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.4rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.scroll-cue {
  position: absolute;
  bottom: 1.5rem;
  right: clamp(1.25rem, 5vw, 5rem);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.cue-line {
  width: 56px;
  height: 1px;
  background: var(--muted);
  transform-origin: left;
  animation: cue 2.2s ease-in-out infinite;
}

@keyframes cue {
  0%, 100% { transform: scaleX(0.3); opacity: 0.4; }
  50% { transform: scaleX(1); opacity: 1; }
}

/* ---------- sections (shared) ---------- */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(5rem, 14vh, 9rem) clamp(1.25rem, 5vw, 5rem) 0;
}

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 5.5vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 1rem 0 3rem;
}

/* scroll reveals — hidden state only applies once JS tags <body> with .fx,
   so content stays visible if scripts ever fail */
.reveal {
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.fx .reveal {
  opacity: 0;
  transform: translateY(28px);
}

.fx .reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------- stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  padding-top: 2.5rem;
}

.stat { display: flex; flex-direction: column; gap: 0.5rem; }

.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 7vw, 5.5rem);
  line-height: 1;
}

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

.stat-key {
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.stat-key::before { content: "= "; color: var(--accent); }

/* ---------- stack ---------- */
.stack-list { border-bottom: 1px solid var(--line); }

.stack-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 2fr auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: 2.25rem 0;
  border-top: 1px solid var(--line);
}

.stack-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1;
  transition: color 0.25s ease, transform 0.25s ease;
}

.stack-row:hover .stack-name {
  color: var(--accent);
  transform: translateX(6px);
}

.stack-desc { color: var(--muted); max-width: 34rem; }

.stack-tag {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.toolbox {
  margin-top: 2.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 2;
  color: var(--muted);
  max-width: 46rem;
}

.toolbox-label {
  display: block;
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.toolbox-label::before { content: "// "; }

/* experience reuses the stack-row language at a quieter scale */
.xp .stack-name { font-size: clamp(1.3rem, 2.4vw, 1.9rem); }

/* ---------- work ---------- */
.work-list { border-bottom: 1px solid var(--line); }

.work-row { border-top: 1px solid var(--line); }

.work-link {
  display: block;
  padding: 2.5rem 1rem;
  margin: 0 -1rem;
  transition: background-color 0.25s ease;
}

.work-link:hover { background: var(--surface); }

.work-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.work-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.4vw, 2.6rem);
  line-height: 1.05;
  transition: color 0.25s ease;
}

.work-link:hover .work-name { color: var(--accent); }

.work-tag {
  font-size: 0.75rem;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.work-pitch {
  color: var(--muted);
  max-width: 40rem;
  margin: 0.75rem 0 1rem;
}

.work-stack {
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

/* ---------- contact ---------- */
.contact { padding-bottom: clamp(5rem, 14vh, 8rem); }

.contact-note {
  max-width: 34rem;
  color: var(--muted);
  font-size: 1.05rem;
  margin: -1rem 0 2.25rem;
}

/* IBM Plex Sans is only loaded at 400/500 — real bold would be faux */
.contact-note strong {
  color: var(--accent);
  font-weight: 500;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0 0 2.5rem;
}

.btn-resume {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1rem 1.75rem;
  border-radius: 4px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-resume:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px -8px var(--accent);
}

.btn-resume svg { transition: transform 0.2s ease; }
.btn-resume:hover svg { transform: translate(2px, -2px); }

.btn-wa {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1rem 1.75rem;
  border-radius: 4px;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-wa:hover {
  background: var(--accent);
  color: var(--accent-ink);
  transform: translateY(-2px);
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 1.75rem;
}

.socials a {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.2rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.socials a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- hover tooltips (reveal email / number) ---------- */
[data-tip] { position: relative; }

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.65rem);
  transform: translate(-50%, 4px);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: none;   /* .socials links are uppercase — the address must not be */
  white-space: nowrap;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.3rem 0.6rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 6;
}

[data-tip]:hover::after,
[data-tip]:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 5vw, 5rem) 3.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-status { display: inline-flex; align-items: center; gap: 0.5rem; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ---------- signature: system log ticker ---------- */
.syslog {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  max-width: min(92vw, 480px);
  padding: 0.5rem 0.85rem;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 0.7rem;
  pointer-events: none;
  overflow: hidden;
}

.syslog-prefix {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.08em;
}

.syslog-line {
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.syslog-line.tick {
  animation: logtick 0.35s ease;
}

@keyframes logtick {
  from { transform: translateY(0.9em); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- grain ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: var(--grain-opacity);
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- responsive ---------- */

/* laptops / small desktops: keep the figure clear of the headline */
@media (max-width: 1180px) {
  .hero-portrait {
    width: min(48vw, 560px);
    height: 88%;
  }
}

/* tablets */
@media (max-width: 860px) {
  .hero-portrait {
    width: min(72vw, 480px);
    right: 0;
    height: 78%;
    opacity: 0.55;
  }

  .hero-portrait img { object-position: bottom right; }

  .hero { padding-bottom: clamp(3.5rem, 8vh, 5rem); }

  .stats-grid { grid-template-columns: 1fr; gap: 2.5rem; }

  .stack-row { grid-template-columns: 1fr; gap: 0.6rem; }

  .work-head { flex-direction: column; gap: 0.4rem; }

  .syslog { display: none; }
}

/* phones */
@media (max-width: 640px) {
  .site-header { padding: 0.85rem 1.25rem; }

  .header-nav { gap: 1.1rem; }

  .hero-portrait { opacity: 0.42; width: min(88vw, 420px); }

  .hero-sub { font-size: 1rem; }

  .scroll-cue { display: none; }

  .section-title { margin-bottom: 2.25rem; }

  .stat-value { font-size: clamp(2.6rem, 13vw, 3.4rem); }

  .work-link { padding: 1.9rem 0.75rem; margin: 0 -0.75rem; }

  .toolbox { font-size: 0.75rem; }

  .contact-actions { flex-direction: column; }

  .btn-resume, .btn-wa { justify-content: center; }

  .socials { gap: 1.25rem; }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 2.5rem;
  }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  .hero-name .ch {
    transform: none;
    opacity: 1;
    transition: none;
  }

  .fx .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .cue-line, .status-dot, .cursor-blink { animation: none; }

  .syslog-line.tick { animation: none; }

  .btn-resume, .btn-wa, .stack-name, .work-link { transition: none; }
}
