/* ============================================================
   Kartika Madania — Portfolio
   ============================================================ */

:root {
  --bg: #07070d;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef0f6;
  --muted: #9aa0b4;
  --gold: #dcaf6a;
  --champagne: #f0e2c2;
  --copper: #cd8460;
  --grad: linear-gradient(100deg, var(--gold), var(--champagne) 55%, var(--copper));
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --radius: 18px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(220, 175, 106, 0.35); }

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

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- ambient layers ---------- */

.progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60;
  background: transparent;
}
.progress span {
  display: block; height: 100%; width: 0;
  background: var(--grad);
}

body::before {
  /* static aurora backdrop */
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(52% 44% at 18% -6%, rgba(220, 175, 106, 0.13), transparent 60%),
    radial-gradient(44% 38% at 92% 4%, rgba(240, 226, 194, 0.07), transparent 60%),
    radial-gradient(50% 42% at 78% 96%, rgba(205, 132, 96, 0.08), transparent 60%);
}

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

.hero {
  display: flex; flex-direction: column;
  align-items: center;
  text-align: center;
  padding: clamp(88px, 12vh, 128px) 24px 0;
  position: relative;
}
.hero-inner { max-width: 780px; position: relative; z-index: 1; }

.avatar {
  position: relative;
  width: 150px; height: 150px;
  margin: 0 auto 26px;
}
.avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  object-fit: cover;
  position: relative; z-index: 1;
  border: 4px solid var(--bg);
}
.avatar-ring {
  position: absolute; inset: -5px;
  border-radius: 50%;
  background: conic-gradient(from var(--ring-angle, 0deg),
    var(--gold), var(--champagne), var(--copper), var(--gold));
  animation: spin-ring 7s linear infinite;
}
@property --ring-angle {
  syntax: "<angle>"; initial-value: 0deg; inherits: false;
}
@keyframes spin-ring {
  to { --ring-angle: 360deg; }
}
.avatar-badge {
  position: absolute; right: 2px; bottom: 6px; z-index: 2;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  font-size: 21px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  backdrop-filter: blur(8px);
  animation: wave 2.6s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0); }
  65%, 75%, 85% { transform: rotate(16deg); }
  70%, 80% { transform: rotate(-8deg); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7.6vw, 5.2rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.hero-sub {
  font-size: clamp(1rem, 1.7vw, 1.15rem);
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 22px;
}
.hero-sub strong { color: var(--text); font-weight: 600; }

/* ---------- work ---------- */

.work {
  max-width: 1120px;
  margin: 0 auto;
  /* 42px + hero-sub's 22px margin = 64px above the divider, matching the 64px below it */
  padding: 42px 24px 40px;
  position: relative; z-index: 1;
}

.end-mark {
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  padding: 60px 24px 48px;
}

/* labeled divider — hairlines flank the section label */
.section-head {
  display: flex; align-items: center; gap: 22px;
  margin-bottom: 64px;
}
.section-head::before,
.section-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.eyebrow {
  font-family: var(--font-body);
  font-size: 13px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

.projects { display: flex; flex-direction: column; gap: 110px; }

/* Each project varies: layout archetype + its own accent (--pa, set per article).
   Default archetype: full-width statement, caption below-left. */
.project { --pa: var(--gold); display: block; }
.project .shot { margin-bottom: 30px; }

/* split — image and caption side by side */
.project--split {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.project--split .shot { margin-bottom: 0; }
.project--flip .shot { order: 2; }
.project--flip .project-info { order: 1; }


/* screenshot in a browser frame */
.shot { display: block; perspective: 1100px; }
.shot-frame {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.18s ease-out, border-color 0.3s, box-shadow 0.3s;
  will-change: transform;
}
.shot:hover .shot-frame {
  border-color: color-mix(in srgb, var(--pa) 50%, transparent);
  box-shadow: 0 30px 80px color-mix(in srgb, var(--pa) 20%, transparent);
}
.shot-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid var(--border);
}
.shot-bar i {
  width: 10px; height: 10px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}
.shot-bar i:nth-child(1) { background: #ff5f57; }
.shot-bar i:nth-child(2) { background: #febc2e; }
.shot-bar i:nth-child(3) { background: #28c840; }
.shot-bar b {
  margin-left: 10px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11.5px; font-weight: 400;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.25);
  padding: 3px 12px;
  border-radius: 6px;
}
.shot-frame img {
  aspect-ratio: 16 / 10;
  object-fit: cover; object-position: top;
  transition: transform 0.5s ease;
}
.shot:hover .shot-frame img { transform: scale(1.03); }

.project-info { max-width: 640px; }

.project-info h3 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.4vw, 2.4rem);
  font-weight: 600; letter-spacing: -0.005em;
  line-height: 1.1;
  margin-bottom: 12px;
}
/* per-project accent signature under the title */
.project-info h3::after {
  content: "";
  display: block;
  width: 36px; height: 2px;
  border-radius: 1px;
  background: var(--pa);
  margin-top: 12px;
}
.project-info p {
  color: var(--muted);
  font-size: 15.5px;
  max-width: 62ch;
  margin-bottom: 22px;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background 0.25s, border-color 0.25s, transform 0.25s;
}
.btn:hover {
  background: color-mix(in srgb, var(--pa) 15%, transparent);
  border-color: color-mix(in srgb, var(--pa) 50%, transparent);
  transform: translateY(-2px);
}
.btn span { transition: transform 0.25s; }
.btn:hover span { transform: translate(2px, -2px); }

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

.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  padding: 5vh 4vw;
  background: rgba(5, 5, 10, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: lb-in 0.25s ease;
}
.lightbox[hidden] { display: none; }
@keyframes lb-in { from { opacity: 0; } }
.lightbox img {
  max-width: min(1200px, 92vw);
  max-height: 78vh;
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.7);
}
.lightbox-close {
  position: absolute; top: 22px; right: 26px;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.14); }
.lightbox-open {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600;
  padding: 11px 22px;
  border-radius: 999px;
  background: var(--grad);
  color: #0b0b14;
}

/* ---------- reveal on scroll ---------- */

/* hidden state only applies when JS is running (html.js set inline in <head>) */
.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  transition-delay: calc(var(--d, 0) * 90ms);
}
.js .reveal.in { opacity: 1; transform: none; }

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

@media (max-width: 860px) {
  /* splits collapse to the stacked layout on mobile */
  .project--split { display: block; }
  .project .shot { margin-bottom: 22px; }
  .projects { gap: 72px; }
  .hero { padding-top: 64px; }
  .avatar { width: 124px; height: 124px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .avatar-ring, .avatar-badge { animation: none; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .shot-frame { transform: none !important; }
}
