/* Ankur Mishra — Portfolio
   Palette + type mirror the PDF portfolio:
   orange #FCB041, ink #000000, white pages, Stolzl → Lexend,
   Source Code Pro name blocks, Bree Serif "Get in touch.", Freight italic → Source Serif labels. */

:root {
  --orange: #fcb041; /* matches the portrait photo background exactly */
  --ink: #000000;
  --paper: #ffffff;
  --muted: #5b5657;
  --rule: #d1d3d4;

  --f-head: "Lexend", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "Source Code Pro", ui-monospace, Menlo, monospace;
  --f-slab: "Bree Serif", Georgia, serif;
  --f-label: "Source Serif 4", Georgia, serif;
  --f-body: "Fira Sans", "Helvetica Neue", Arial, sans-serif;

  --gutter: clamp(16px, 4.5vw, 72px);
  --max: 1320px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

/* Project cards: each project scrolls normally, then pins once its end reaches
   the bottom of the screen while the next project slides up over it.
   --stick (set in script.js) = screen height minus card height (0 if shorter).
   Cards only stack within their section (.project-stack), so the section pages
   and About scroll normally. */
.project { position: sticky; top: var(--stick, 0px); }
.cover, .divider, .about { position: relative; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-head);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }

/* ---------- Shared bits ---------- */

.name-block { margin: 0; font-family: var(--f-mono); font-weight: 600; line-height: 1; }
.name-block span {
  display: table;
  background: var(--ink);
  color: var(--orange);
  padding: .12em .22em .1em;
  margin-bottom: .08em;
}

.contact { text-align: right; font-family: var(--f-body); font-size: 14px; line-height: 1.6; }
.contact h2 { font-family: var(--f-slab); font-weight: 400; font-size: 22px; margin: 0 0 .7em; }
.contact a { text-decoration: none; }
.contact a:hover { text-decoration: underline; text-underline-offset: 3px; }
.contact p { margin: 0; }

.tracked {
  font-family: var(--f-mono);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: .28em;
  text-transform: uppercase;
}

.vertical { writing-mode: vertical-rl; transform: rotate(180deg); }

/* ---------- Nav ---------- */

.nav {
  position: fixed;
  top: 16px;
  right: var(--gutter);
  z-index: 50;
  display: flex;
  gap: 2px;
  background: var(--orange);   /* yellow block behind the tabs */
  padding: 6px;
  transition: background .25s;
}
/* over the white project pages the panel turns white (set in script.js) */
.nav.on-light, .nav.on-light .nav-menu { background: var(--paper); }
.nav.on-light a { color: var(--paper); }
.nav.on-light a:hover, .nav.on-light a:focus-visible { color: var(--ink); }

.nav-tabs { display: flex; gap: 2px; }

/* AM mark: its own small panel, pinned top-left in line with "Hello,".
   Same look as the favicon; appears once the name block scrolls away. */
.nav.nav-brand {
  right: auto;
  left: var(--gutter);
  transition: background .25s, opacity .25s, transform .25s, visibility 0s;
}
.nav .nav-logo {
  background: var(--ink);
  color: var(--orange);
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 8px 10px;
  line-height: normal;
  cursor: default;
  user-select: none;
  transition: color .2s;
}
.nav.on-light .nav-logo { color: var(--paper); }   /* white like the other tabs over white pages */
.nav.nav-brand.is-hidden { transform: translateY(-8px); }

/* Back-to-top button: same panel + tab as the nav, pinned bottom right */
.nav.to-top {
  top: auto;
  bottom: 16px;
  transition: background .25s, opacity .25s, transform .25s, visibility 0s;
}
.nav.to-top a {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  letter-spacing: 0;
}
.nav.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: background .25s, opacity .25s, transform .25s, visibility 0s .25s;
}
.nav a {
  background: var(--ink);
  color: var(--orange);
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .08em;
  text-decoration: none;
  padding: 8px 12px;
  transition: background .2s, color .2s;
}
.nav a:hover, .nav a:focus-visible { background: var(--orange); color: var(--ink); outline: 2px solid var(--ink); outline-offset: -2px; }

/* Work dropdown: section shortcuts, styled like the name blocks */
.nav-work { position: relative; display: flex; }
/* gap after "Work" = the tab's left padding (minus the letter-spacing trailing the k) */
.nav-work > a { display: inline-flex; align-items: center; gap: calc(12px - .08em); }
.nav-work > a span { font-size: 12px; line-height: 1; letter-spacing: 0; }
.nav-menu {
  position: absolute;
  top: 100%;
  left: -6px;
  padding: 8px 6px 6px;        /* yellow backing; top padding bridges the hover gap */
  background: var(--orange);
  transition: background .25s;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: max-content;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .18s, transform .18s, visibility 0s .18s;
}
.nav-menu a { white-space: nowrap; display: flex; gap: 10px; padding: 10px 14px; }
.nav-menu a span { opacity: .6; }
.nav-work:hover .nav-menu,
.nav-work:has(:focus-visible) .nav-menu,
.nav-work.open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity .18s, transform .18s;
}

/* ---------- Cover ---------- */

.cover {
  min-height: 100vh;
  min-height: 100svh;
  background: var(--orange);
  padding: calc(var(--gutter) + 40px) var(--gutter) var(--gutter);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto 1fr;
  gap: 24px;
}
.cover .name-block { font-size: clamp(32px, 4.4vw, 56px); }
.cover .contact { align-self: start; }
.cover-title {
  grid-column: 1;
  align-self: end;
  margin: 0;
  font-weight: 700;
  /* "Portfolio" is ~4.3em long when set vertically; fit it under the name block */
  font-size: clamp(56px, calc((100svh - 500px) / 4.3), 230px);
  line-height: .78;
  letter-spacing: -.01em;
}
.cover-meta {
  grid-column: 2;
  align-self: end;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 20px;
}
.cover-meta .line { width: 1px; height: 120px; background: var(--ink); }
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: var(--gutter);
  transform: translateX(-50%);
  text-decoration: none;
}

/* ---------- Section dividers ---------- */

.divider {
  background: var(--orange);
  min-height: 70vh;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  padding: var(--gutter);
  padding-top: max(var(--gutter), 96px);   /* clear the fixed AM + nav panels */
}
.divider-num { font-family: var(--f-mono); font-weight: 600; font-size: clamp(24px, 3vw, 40px); }
.divider h2 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(56px, 11vh, 140px);
  line-height: .85;
}
.divider-side { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; gap: 48px; }

/* index of the section's projects, in the empty left side of the divider */
.divider-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.divider-index a {
  display: inline-flex;
  align-items: baseline;
  gap: 16px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: clamp(18px, 1.9vw, 26px);
  line-height: 1.25;
  padding: 2px 8px 2px 0;
  transition: background .18s, color .18s, padding .18s;
}
.divider-index a span {
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .12em;
  min-width: 5.2em;
}
.divider-index a:hover, .divider-index a:focus-visible {
  background: var(--ink);
  color: var(--orange);
  padding-left: 8px;
  outline: none;
}

/* ---------- Projects ---------- */

.project {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(64px, 9vw, 128px) var(--gutter);
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 5vw, 80px);
  min-height: 100vh;           /* each project fills the screen on its own */
  min-height: 100svh;
  align-content: center;
  background: var(--paper);
  /* full-bleed white card so it fully covers the project underneath */
  box-shadow: 0 0 0 100vmax var(--paper);
  clip-path: inset(0 -100vmax);
}
/* hairline along the top edge of each card, so the overlap reads as it slides in */
.project::before {
  content: '';
  position: absolute;
  top: 0;
  left: calc(50% - 50vw);       /* exactly screen-wide, without widening the page */
  right: calc(50% - 50vw);
  height: 1px;
  background: var(--rule);
}
.project.flip { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
/* projects whose screens need more room: gallery takes two thirds of the width */
.project.flip.wide-gallery { grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); }
.project.flip .project-text { order: 2; }
.project.flip .gallery { order: 1; }

.project-text { align-self: start; position: sticky; top: 80px; }
/* when the text runs longer than the images, the gallery is the one that
   sticks, so the images travel down alongside the text (class set in script.js) */
.project.gallery-follows .project-text { position: static; }
.project.gallery-follows .gallery { align-self: start; position: sticky; top: 80px; }
.project h3 { font-weight: 700; font-size: clamp(28px, 3vw, 40px); line-height: 1.1; margin: 0 0 28px; }
.label { font-family: var(--f-label); font-style: italic; font-size: 14px; color: var(--muted); margin: 0 0 4px; }
.goal { font-weight: 600; font-size: clamp(17px, 1.45vw, 20px); line-height: 1.3; letter-spacing: .02em; margin: 0 0 28px; }
.summary { font-size: 15px; line-height: 1.75; letter-spacing: .03em; margin: 0 0 32px; }

.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 32px; margin: 0; }
.meta dt { font-weight: 700; font-size: 11px; letter-spacing: .2em; text-transform: uppercase; margin-bottom: 6px; }
.meta dd { margin: 0; font-size: 14px; line-height: 1.6; letter-spacing: .02em; }
.meta a { text-underline-offset: 3px; }

.folio {
  display: flex;
  gap: 2.4em;
  margin-bottom: 28px;
}

/* Images are never cropped: each row's figures grow in proportion to their
   aspect ratio (--r, set in script.js), so every image in a row shares one height. */
.gallery { display: flex; flex-direction: column; gap: 16px; align-self: start; }
.gallery figure { margin: 0; min-width: 0; }
.gallery .row { display: flex; gap: 16px; align-items: flex-start; }
.gallery .row figure { flex: var(--r, 1) 1 0; }
.gallery button {
  all: unset;
  display: block;
  width: 100%;
  cursor: zoom-in;
  overflow: hidden;
  background: #f3f3f3;
}
.gallery button:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; }
.gallery img { width: 100%; transition: transform .6s cubic-bezier(.2,.7,.2,1); }
.gallery button:hover img { transform: scale(1.025); }

/* ---------- About ---------- */

.about {
  background: var(--orange);
  padding: clamp(80px, 10vw, 140px) var(--gutter) var(--gutter);
}
.about-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}
.tag {
  display: inline-block;
  border: 1.5px solid var(--ink);
  padding: 8px 16px;
  margin-bottom: 48px;
}
.about .name-block { font-size: clamp(44px, 6vw, 80px); margin-bottom: 40px; }
.bio { font-family: var(--f-body); font-weight: 300; font-size: 18px; line-height: 1.6; letter-spacing: .02em; max-width: 52ch; }
.bio p { margin: 0 0 1.2em; }
.portrait img { width: min(100%, 520px); margin: 0 auto; }
.about .contact { max-width: var(--max); margin: 64px auto 0; }

/* ---------- Back cover ---------- */

.back {
  background: var(--orange);
  border-top: 1px solid rgba(0,0,0,.25);
  padding: 28px var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.back .line { flex: 1; height: 1px; background: var(--ink); min-width: 40px; }
.copyright {
  flex-basis: calc(100% + 56px);   /* span the footer's extra right padding (kept for the Top button) */
  margin: 4px -56px 0 0;           /* so the line centres on the page, not the footer */
  text-align: center;
  font-family: var(--f-body);
  font-size: 11px;
  letter-spacing: .02em;
  opacity: .7;
}
.back { padding-right: calc(var(--gutter) + 56px); }   /* room for the fixed Top button */

/* ---------- Lightbox ---------- */

.lightbox {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: 94vw;
  max-height: 94vh;
}
.lightbox::backdrop { background: rgba(0,0,0,.92); }
.lightbox img { max-width: 94vw; max-height: 88vh; width: auto; margin: 0 auto; }
.lightbox-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--orange);
  color: var(--ink);
  border: 0;
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: 14px;
  padding: 8px 12px;
  cursor: pointer;
}

/* ---------- Reveal ---------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity .8s ease, transform .8s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .gallery img { transition: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  /* phones/tablets: plain scrolling, no stacking */
  .project { position: relative; top: auto; }
  .project { min-height: 0; }
  .project, .project.flip, .project.flip.wide-gallery { grid-template-columns: 1fr; }
  .project.flip .project-text { order: 0; }
  .project-text, .project.gallery-follows .gallery { position: static; }
  .about-inner { grid-template-columns: 1fr; }
  .portrait { order: -1; }
}

@media (max-width: 640px) {
  .nav { top: 12px; right: 16px; }
  .nav.nav-brand { left: 16px; right: auto; }
  .copyright { padding: 0 52px; }   /* wrap clear of the Top button, still centred */
  .nav.to-top { top: auto; bottom: 12px; }
  .nav a { padding: 7px 9px; font-size: 12px; }
  .nav-work > a { gap: calc(9px - .08em); }
  .cover { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr auto; padding-top: 72px; }
  .cover .contact { text-align: left; }
  .cover-title { writing-mode: horizontal-tb; transform: none; font-size: 19.5vw; line-height: .9; }
  .cover-meta { grid-column: 1; justify-self: start; }
  .cover-meta .vertical { writing-mode: horizontal-tb; transform: none; }
  .cover-meta .line { width: 48px; height: 1px; }
  .scroll-hint { display: none; }
  .divider { grid-template-columns: 1fr; gap: 24px; min-height: 60vh; }
  .divider h2 { writing-mode: horizontal-tb; transform: none; font-size: 15vw; }
  .divider-side { gap: 32px; }
  .divider-index a span { min-width: 4.6em; }
  .gallery .row { flex-direction: column; }
  .gallery .row figure { flex: none; width: 100%; }
  .meta { grid-template-columns: 1fr; }
  .about .contact { text-align: left; }
}

/* ---------- Screenshot shield ----------
   Black screen shown while a screenshot shortcut is held or the page loses
   focus (screenshot tools, app switchers). Toggled from script.js. */
.shield {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: #000;
  display: none;
  place-items: center;
}
.shield p {
  color: var(--orange);
  font-family: var(--f-mono);
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  padding: 0 24px;
}
html.shielded .shield { display: grid; }

/* no long-press save / drag-out on project images */
.gallery img, .portrait img, .lightbox img {
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  user-select: none;
}
