/* ============================================================
   Dr Ganesh Sanap — personal site
   Warm editorial theme, light + dark, responsive
   ============================================================ */

:root {
  --bg: #f8f4ee;
  --bg-soft: #f1e9df;
  --ink: #1d1a17;
  --muted: #6b6157;
  --accent: #b04a24;
  --accent-ink: #fff8f3;
  --accent-soft: #f2dbcf;
  --card: #fffdfa;
  --line: rgba(29, 26, 23, 0.12);
  --shadow-sm: 0 2px 10px -4px rgba(60, 40, 25, 0.25);
  --shadow-lg: 0 28px 60px -28px rgba(60, 40, 25, 0.45);
  --radius: 20px;
  --radius-lg: 28px;
  --maxw: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="dark"] {
  --bg: #14100d;
  --bg-soft: #1b1612;
  --ink: #f4ece3;
  --muted: #b3a597;
  --accent: #e8825a;
  --accent-ink: #1a0f0a;
  --accent-soft: #3a2419;
  --card: #1f1915;
  --line: rgba(244, 236, 227, 0.14);
  --shadow-sm: 0 2px 10px -4px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 30px 70px -30px rgba(0, 0, 0, 0.8);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  letter-spacing: -0.01em;
  overflow-x: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

h1,
h2,
h3 {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.6rem, 6.2vw, 4.4rem);
}

h2 {
  font-size: clamp(1.9rem, 3.6vw, 2.7rem);
}

h3 {
  font-size: 1.25rem;
  letter-spacing: -0.015em;
}

p {
  margin: 0 0 1em;
}

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--accent);
}

img {
  max-width: 100%;
  display: block;
}

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.86em;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.12em 0.4em;
}

.container {
  width: min(100% - 2.5rem, var(--maxw));
  margin-inline: auto;
}

/* ---------- ambient background ---------- */

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
  animation: drift 26s var(--ease) infinite alternate;
}

.orb-1 {
  width: 46vw;
  height: 46vw;
  top: -14vw;
  left: -10vw;
  background: radial-gradient(circle at 30% 30%, #e8a27f, transparent 68%);
}

.orb-2 {
  width: 40vw;
  height: 40vw;
  top: 22vh;
  right: -14vw;
  background: radial-gradient(circle at 60% 40%, #d9c08f, transparent 70%);
  animation-delay: -8s;
}

.orb-3 {
  width: 34vw;
  height: 34vw;
  bottom: -16vw;
  left: 24vw;
  background: radial-gradient(circle at 50% 50%, #b9c8a8, transparent 72%);
  animation-delay: -16s;
}

html[data-theme="dark"] .orb {
  opacity: 0.28;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(3vw, 4vh, 0) scale(1.12);
  }
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.site-header.is-stuck {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 74px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: "Fraunces", Georgia, serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  box-shadow: var(--shadow-sm);
}

.brand-name {
  font-size: 0.98rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  font-size: 0.93rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s, background-color 0.2s;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
  color: var(--ink);
  background: var(--bg-soft);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.3s var(--ease), background-color 0.2s;
}

.theme-toggle:hover {
  transform: rotate(-18deg);
  background: var(--bg-soft);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ---------- hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: clamp(2rem, 6vw, 5rem);
  padding-block: clamp(2.5rem, 7vh, 5rem);
  min-height: min(86vh, 780px);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
}

.accent {
  color: var(--accent);
  font-style: italic;
}

.lede {
  max-width: 34ch;
  font-size: clamp(1.05rem, 1.6vw, 1.2rem);
  color: var(--muted);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.8rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease),
    background-color 0.2s, color 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 14px 30px -14px color-mix(in srgb, var(--accent) 70%, transparent);
}

.btn-primary:hover {
  box-shadow: 0 20px 38px -14px color-mix(in srgb, var(--accent) 75%, transparent);
}

.btn-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--bg-soft);
}

.hero-photo {
  position: relative;
  justify-self: center;
  width: min(100%, 348px);
  display: grid;
  justify-items: center;
}

/* The portrait is a transparent-background cutout at 452x1424 (1:3.15).
   The frame follows that exact ratio so the photo is never cropped or
   letterboxed, and no rounded corners clip the head or feet. */
.photo-frame {
  position: relative;
  display: grid;
  place-items: end center;
  height: clamp(420px, 66vh, 680px);
  aspect-ratio: 452 / 1424;
  overflow: visible;
}

.photo-frame::before {
  content: "";
  position: absolute;
  inset: 4% -26% 2% -26%;
  z-index: 0;
  border-radius: 50% / 44%;
  background: radial-gradient(
    ellipse at 50% 30%,
    color-mix(in srgb, var(--accent-soft) 92%, transparent) 0%,
    color-mix(in srgb, var(--accent-soft) 45%, transparent) 42%,
    transparent 72%
  );
  filter: blur(6px);
  pointer-events: none;
}

.photo-frame::after {
  content: "";
  position: absolute;
  bottom: 4%;
  left: 50%;
  width: 58%;
  height: 22px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(60, 40, 25, 0.28),
    transparent 68%
  );
  filter: blur(6px);
  pointer-events: none;
}

html[data-theme="dark"] .photo-frame::after {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55), transparent 68%);
}

.photo-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom center;
  z-index: 1;
  filter: drop-shadow(0 16px 22px rgba(60, 40, 25, 0.22));
  transition: transform 0.8s var(--ease), filter 0.8s var(--ease);
}

.photo-frame:hover img {
  transform: translateY(-4px) scale(1.02);
}

.hero-card {
  position: absolute;
  left: -1.2rem;
  bottom: 2.2rem;
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow-lg);
  animation: float 7s ease-in-out infinite;
}

.hero-card strong {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1rem;
}

.hero-card span {
  font-size: 0.78rem;
  color: var(--muted);
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-9px);
  }
}

/* ---------- sections ---------- */

.section {
  padding-block: clamp(3.5rem, 8vh, 6rem);
}

.section-title {
  position: relative;
  padding-bottom: 0.9rem;
  margin-bottom: 2rem;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 56px;
  height: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.section-sub {
  margin-top: -1.2rem;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  padding: clamp(1.4rem, 3vw, 2rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}

.about-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 1.2rem;
}

.about-grid .card p:last-child {
  margin-bottom: 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip-list li {
  padding: 0.42rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-soft);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
}

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.2rem;
}

.work-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 1rem;
  border-radius: 14px;
  background: var(--accent-soft);
  font-size: 1.25rem;
}

.work-card p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.gallery-item {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-soft);
  cursor: zoom-in;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.gallery-item:hover img {
  transform: scale(1.06);
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 2.4rem 1.5rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.contact-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--accent-soft) 55%, var(--card)),
    var(--card) 70%
  );
}

.contact-card p {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.15rem, 2.2vw, 1.5rem);
}

/* ---------- lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 2rem;
  background: rgba(12, 9, 7, 0.86);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s var(--ease), visibility 0.3s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: min(92vw, 900px);
  max-height: 86vh;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding-block: 2rem;
  margin-top: 3rem;
}

.site-footer p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- reveal ---------- */

.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  will-change: opacity, transform;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: left;
    padding-block: 2.5rem 3.5rem;
    min-height: 0;
  }

  .hero-photo {
    order: -1;
    width: min(74vw, 300px);
  }

  .photo-frame {
    height: clamp(300px, 44vh, 430px);
  }

  .about-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    font-size: 16px;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    inset: 74px 1.25rem auto 1.25rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
    padding: 0.9rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.25s var(--ease), transform 0.25s var(--ease),
      visibility 0.25s;
  }

  .nav-links.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
  }

  .nav-links a {
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
  }

  .theme-toggle {
    margin: 0.4rem 0 0;
    width: 100%;
    border-radius: 12px;
  }

  .hero-card {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .js .reveal {
    opacity: 1;
    transform: none;
  }
}

@media print {
  .site-header,
  .bg-orbs,
  .nav-toggle,
  .theme-toggle,
  .hero-cta {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
