/* ============================================================
   Pranitha Andra — Portfolio
   Minimal, image-forward, restrained motion.
   ============================================================ */

:root {
  --bg: #faf7f2;
  --bg-2: #f2ede4;
  --ink: #1c1a17;
  --muted: #6f675b;
  --faint: rgba(28, 26, 23, 0.10);
  --faint-2: rgba(28, 26, 23, 0.05);
  --accent: #b6543a;
  --accent-soft: rgba(182, 84, 58, 0.12);

  --display: "Syne", "Trebuchet MS", Georgia, sans-serif;
  --serif: var(--display);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --maxw: 1240px;
  --gutter: clamp(20px, 5vw, 64px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; text-decoration: none; }

::selection { background: var(--accent-soft); }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

.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;
}

/* Category pages have no hero, so clear the fixed nav */
.workpage { padding-top: clamp(96px, 13vw, 150px); }

/* Ink cursor trail (drawn above content, below the project viewer) */
.ink-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 95;
}
/* In spark mode the trail must render above the open project viewer (z-index 100) */
.ink-canvas--spark { z-index: 110; }

/* ---------- Nav ---------- */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--gutter);
  transition: background 0.4s var(--ease), box-shadow 0.4s var(--ease), padding 0.4s var(--ease);
}
.nav.scrolled {
  background: rgba(250, 247, 242, 0.82);
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  box-shadow: 0 1px 0 var(--faint);
  padding-block: 12px;
}
.nav__brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  transition: color 0.25s var(--ease);
}
.nav__brand:hover,
.nav__brand[aria-current="page"] { color: var(--accent); }
.nav__links {
  display: flex;
  gap: clamp(16px, 3vw, 36px);
  align-items: center;
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav__links a { position: relative; padding: 4px 0; color: var(--muted); transition: color 0.25s var(--ease); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav__links a[aria-current="page"] { color: var(--ink); }
.nav__links a[aria-current="page"]::after { transform: scaleX(1); transform-origin: left; }

/* Mobile menu button (injected by JS, hidden on desktop) */
.nav__toggle {
  display: none;
  position: relative;
  z-index: 2;
  width: 40px; height: 40px;
  margin-right: -8px;
  border: none; background: none; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav__toggle span {
  position: absolute;
  left: 9px; right: 9px; height: 1.6px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.nav__toggle span:nth-child(1) { transform: translateY(-4px); }
.nav__toggle span:nth-child(2) { transform: translateY(4px); }
.nav.open .nav__toggle span:nth-child(1) { transform: rotate(45deg); }
.nav.open .nav__toggle span:nth-child(2) { transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-block: 140px 80px;
}
.hero__banner {
  margin: 0;
  perspective: 1000px;
}
.hero__banner-tilt {
  display: inline-block;
  transition: transform 0.4s var(--ease);
  will-change: transform;
}
.hero__banner-img {
  width: min(860px, 90vw);
  height: auto;
  margin: 0 auto;
  animation: bannerFloat 6s ease-in-out infinite;
}
@keyframes bannerFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.hero__scroll {
  margin-top: clamp(40px, 8vw, 90px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.hero__scroll .line {
  width: 54px; height: 1px; background: var(--ink);
  transform-origin: left;
  animation: pull 2.4s var(--ease) infinite;
}
@keyframes pull { 0%,100% { transform: scaleX(0.4); } 50% { transform: scaleX(1); } }

/* ---------- Section ---------- */
.section { padding-block: clamp(48px, 8vw, 110px); }
.section:first-of-type { padding-top: clamp(20px, 4vw, 48px); }

/* ---------- Grid + cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(18px, 2.4vw, 34px);
}
.grid--single {
  grid-template-columns: minmax(280px, 640px);
  justify-content: center;
}
.card {
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  display: block;
}
.card__frame {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  aspect-ratio: 4 / 3;
  background: var(--bg-2);
}
.card__frame img,
.card__frame video {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.9s var(--ease), filter 0.6s var(--ease);
  will-change: transform;
}
.card:hover .card__frame img,
.card:hover .card__frame video { transform: scale(1.06); }

/* Text is hidden until hover, then revealed centered over a darkened image */
.card__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  background: rgba(20, 18, 15, 0.5);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.card:hover .card__overlay,
.card:focus-visible .card__overlay { opacity: 1; }
.card__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.1rem, 1.9vw, 1.45rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  color: #fff;
  transform: translateY(10px);
  transition: transform 0.45s var(--ease);
}
.card:hover .card__title,
.card:focus-visible .card__title { transform: none; }
.card__count {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  transform: translateY(10px);
  transition: transform 0.45s var(--ease) 0.04s;
}
.card:hover .card__count,
.card:focus-visible .card__count { transform: none; }

/* ---------- Sketchbook (home) ---------- */
.sketchbook__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 clamp(24px, 4vw, 46px);
}
.flip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 2vw, 24px);
}
.flip__stage {
  position: relative;
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  aspect-ratio: 1.81 / 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--bg-2);
  box-shadow: 0 24px 60px rgba(28, 26, 23, 0.14);
  cursor: grab;
  touch-action: pan-y;                 /* let vertical scroll through, capture horizontal swipe */
  user-select: none;
  -webkit-user-select: none;
  perspective: 1500px;                 /* depth for the page fold */
}
.flip__stage:active { cursor: grabbing; }
/* The settled page, always visible beneath any turning leaf */
.flip__base {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}
/* A turning leaf: two faces hinged on the left spine, folding in 3D */
.flip__leaf {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: left center;
  transform-style: preserve-3d;
  will-change: transform;
  pointer-events: none;
}
.flip__leaf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg-2);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.flip__leaf-front { transform: rotateY(0deg); }
.flip__leaf-back  { transform: rotateY(180deg); }   /* blank page back */
.flip__leaf-front img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.flip__leaf-shade {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(20, 18, 15, 0.4), rgba(20, 18, 15, 0) 60%);
}
.flip__leaf-back .flip__leaf-shade {
  background: linear-gradient(270deg, rgba(20, 18, 15, 0.4), rgba(20, 18, 15, 0) 60%);
}
.flip__nav {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: var(--bg);
  color: var(--ink);
  font-size: 1.5rem; line-height: 1;
  display: grid; place-items: center;
  cursor: pointer;
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease), transform 0.2s var(--ease);
}
.flip__nav:hover { background: var(--bg-2); border-color: var(--accent); color: var(--accent); }
.flip__nav:active { transform: scale(0.92); }
.flip__meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: clamp(16px, 2.5vw, 26px);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.flip__counter { color: var(--ink); font-variant-numeric: tabular-nums; }
.flip__hint { font-size: 0.72rem; }
@media (max-width: 620px) {
  .flip__hint { display: none; }
  .flip__nav { width: 40px; height: 40px; font-size: 1.3rem; }
}

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--faint);
  padding-block: clamp(50px, 8vw, 90px);
}
.footer__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
  justify-content: space-between;
}
.footer__cta {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}
.footer__cta a { border-bottom: 1px solid var(--faint); transition: border-color 0.3s var(--ease); }
.footer__cta a:hover { border-color: var(--accent); color: var(--accent); }
.footer__links { display: flex; gap: 22px; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.footer__links a { transition: color 0.25s var(--ease); }
.footer__links a:hover { color: var(--ink); }
.footer__fine { margin-top: 40px; color: var(--muted); font-size: 0.8rem; }

/* ---------- Project viewer (scrollable stack) ---------- */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(18, 16, 13, 0.94);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s var(--ease);
}
.lb.open { opacity: 1; visibility: visible; }
.lb__scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  display: flex;
  flex-direction: column;
  justify-content: safe center;   /* center when it fits, scroll from top when it doesn't */
  padding: clamp(72px, 12vh, 120px) clamp(16px, 5vw, 64px) clamp(48px, 10vh, 96px);
}
.lb__cap {
  margin: 0 auto clamp(26px, 5vh, 52px);
  text-align: center;
  color: rgba(255,255,255,0.7);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.lb__cap b { display: block; color: #fff; font-weight: 500; }
.lb__headline {
  display: block;
  max-width: 34ch;
  margin: 14px auto 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.05rem, 2.2vw, 1.5rem);
  line-height: 1.32;
  letter-spacing: normal;
  text-transform: none;
  color: #fff;
}
.lb__sub {
  display: block;
  max-width: 46ch;
  margin: 10px auto 0;
  font-size: 0.95rem;
  line-height: 1.5;
  letter-spacing: normal;
  text-transform: none;
  color: rgba(255, 255, 255, 0.6);
}
.lb__stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(18px, 4vh, 40px);
  max-width: 1100px;
  margin: 0 auto;
}
.lb__img {
  width: auto;
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.lb__img.in { opacity: 1; transform: none; }
.lb__video { width: min(100%, 1100px); height: auto; background: #000; }

/* Gallery grid variant (e.g. Theyyam concept art): whole images, masonry board */
.lb__stack--grid {
  display: block;
  column-count: 2;
  column-gap: clamp(12px, 2.4vw, 28px);
  max-width: 1180px;
  width: 100%;
}
@media (min-width: 960px) {
  .lb__stack--grid { column-count: 3; }
}
.lb__stack--grid .lb__img {
  width: 100%;
  max-height: none;
  margin: 0 0 clamp(12px, 2.4vw, 28px);
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  cursor: zoom-in;
  transition: opacity 0.6s var(--ease), transform 0.35s var(--ease);
}
.lb__stack--grid .lb__img.in:hover { transform: scale(1.015); }

/* Click-to-expand overlay for grid gallery images */
.lb__zoom {
  position: fixed;
  inset: 0;
  z-index: 130;   /* body-level: above the viewer (100) and spark canvas (110) */
  display: none;
  place-items: center;
  padding: clamp(16px, 5vw, 72px);
  background: rgba(10, 8, 6, 0.72);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  cursor: zoom-out;
}
.lb__zoom.open { display: grid; }
.lb__zoom img {
  max-width: 100%;
  max-height: 92vh;
  width: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: zoomIn 0.28s var(--ease);
}
@keyframes zoomIn {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.lb__btn {
  position: fixed;
  z-index: 2;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  width: 52px; height: 52px;
  border-radius: 50%;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 1.2rem;
  line-height: 1;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.25s var(--ease);
}
.lb__btn:hover { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.4); }
.lb__btn:active { transform: scale(0.92); }
.lb__close { top: clamp(16px, 3vw, 32px); right: clamp(16px, 3vw, 32px); }

/* ---------- About page ---------- */
.about {
  padding-block: clamp(140px, 18vw, 220px) clamp(60px, 9vw, 120px);
}
.about__lead {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  max-width: 20ch;
  margin: 0 0 clamp(40px, 6vw, 70px);
}
.about__lead em { font-style: italic; color: var(--accent); }
.about__cols {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(32px, 5vw, 64px);
}
@media (min-width: 820px) {
  .about__cols { grid-template-columns: 1.4fr 1fr; }
  /* Lift the side portrait slightly above the intro's top line */
  .about__photo { margin-top: clamp(-48px, -2.6vw, -22px); }
}
/* Side portrait: B&W-on-white subject blended into the paper background */
.about__photo {
  margin: 0;
  aspect-ratio: 4 / 5;
}
.about__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;   /* trim the white headroom so the subject sits up beside the bio */
  mix-blend-mode: multiply;
}
.about__body p { color: #3a352d; margin: 0 0 1.2em; font-size: 1.06rem; }
.about__body p:last-child { margin-bottom: 0; }
/* Focus / Based in / Connect: a tidy row beneath the introduction */
.about__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(22px, 3vw, 44px);
  margin-top: clamp(36px, 5vw, 56px);
  padding-top: clamp(30px, 4vw, 48px);
  border-top: 1px solid var(--faint);
}
.about__meta h3 {
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.about__meta ul { list-style: none; margin: 0; padding: 0; }
.about__meta li { padding: 7px 0; border-bottom: 1px solid var(--faint); font-size: 0.98rem; }
.about__meta a { transition: color 0.25s var(--ease); }
.about__meta a:hover { color: var(--accent); }
.about__banner {
  margin-top: clamp(56px, 8vw, 100px);
  aspect-ratio: 21 / 8;
  border-radius: 5px;
  overflow: hidden;
  background: var(--bg-2);
}
.about__banner img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }

/* ---------- Reveal animation ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .nav__links { gap: clamp(14px, 2.6vw, 28px); }
}

/* Mobile: collapse nav into a full-screen overlay menu */
@media (max-width: 700px) {
  .nav__toggle { display: inline-flex; }
  .nav__brand { position: relative; z-index: 2; }
  /* Use a solid bar (not backdrop-filter) on mobile: a filtered nav would
     become the containing block for the fixed menu, breaking the overlay. */
  .nav.scrolled {
    background: rgba(250, 247, 242, 0.95);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .nav__links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    align-items: center;
    justify-content: safe center;
    gap: 2px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: clamp(84px, 16vh, 130px) 24px 40px;
    text-transform: none;
    letter-spacing: 0.01em;
    background: rgba(250, 247, 242, 0.98);
    -webkit-backdrop-filter: saturate(150%) blur(16px);
    backdrop-filter: saturate(150%) blur(16px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
    z-index: 1;
  }
  .nav.open .nav__links { opacity: 1; visibility: visible; }
  .nav__links a {
    padding: 12px 0;
    font-family: var(--display);
    font-weight: 600;
    font-size: clamp(1.5rem, 7vw, 2.1rem);
    color: var(--ink);
  }
  .nav__links a::after { display: none; }
}

/* Landscape / short screens: keep the menu from overflowing off-screen */
@media (max-width: 700px) and (max-height: 520px) {
  .nav__links { padding-top: 68px; }
  .nav__links a { padding: 7px 0; font-size: 1.3rem; }
}

@media (max-width: 620px) {
  body { font-size: 16px; }
  .grid { grid-template-columns: 1fr; }
  .lb__img { max-height: 82vh; }
}

/* Touch devices have no hover, so keep the tile label visible */
@media (hover: none) {
  .card__overlay {
    opacity: 1;
    justify-content: flex-end;
    align-items: flex-start;
    text-align: left;
    padding: 16px 18px;
    gap: 4px;
    background: linear-gradient(to top, rgba(20, 18, 15, 0.72), rgba(20, 18, 15, 0) 60%);
  }
  .card__title, .card__count { transform: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .card:hover .card__frame img { transform: none; }
}
