/* ==========================================================================
   Karan Puri — portfolio
   Ported from the Claude Design prototype (Karan Puri Portfolio.dc.html).
   Values below are carried over verbatim from the prototype's inline styles.
   ========================================================================== */

:root {
  --ink:        #0a0a0c;  /* page black            */
  --bone:       #eceae6;  /* light text / about bg */
  --paper:      #f3f2ef;  /* work section bg       */
  --char:       #141416;  /* dark text on paper    */
  --muted:      #6c6a66;
  --muted-dark: #8d8a85;
  --body:       #3a3936;
  --body-soft:  #4b4a47;
  --accent:     #7fb2ff;  /* link hover / selection */
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
}

/* ---------- base ---------- */

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--mono);
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
::selection { background: var(--accent); color: var(--ink); }

img, video { display: block; }

/* Keyboard focus only — no visible ring for mouse users. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

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

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes caret  { 0%,49% { opacity: 1; } 50%,100% { opacity: 0; } }
@keyframes floaty { 0%,100% { transform: translateY(0) rotate(var(--r,0deg)); } 50% { transform: translateY(-7px) rotate(var(--r,0deg)); } }
@keyframes breathe { 0%,100% { transform: scale(1.01); } 50% { transform: scale(1.06); } }
@keyframes grain  { 0% { transform: translate(0,0); } 25% { transform: translate(-2%,1%); } 50% { transform: translate(1%,-2%); } 75% { transform: translate(-1%,-1%); } 100% { transform: translate(0,0); } }
@keyframes drift  { 0%,100% { opacity: .5; transform: translate3d(0,0,0) scale(1); } 50% { opacity: .85; transform: translate3d(3%,-4%,0) scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; }
}

/* ---------- film grain ---------- */

.grain {
  position: fixed;
  inset: -15%;
  left: 4px;
  top: 68px;
  z-index: 50;
  pointer-events: none;
  opacity: .22;
  background-image: url(assets/grain.png);
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* ---------- nav ---------- */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 28px);
  font-size: clamp(10px, 2.6vw, 11px);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted-dark);
  backdrop-filter: blur(10px);
  background: linear-gradient(#0a0a0cdd, #0a0a0c00);
}

.nav__brand { color: var(--bone); letter-spacing: .24em; }

.nav__links {
  display: flex;
  gap: clamp(12px, 3.4vw, 22px);
  align-items: center;
}

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

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 110px clamp(18px, 5vw, 24px) 84px;
  background: var(--ink);
}

.hero__still,
.hero__video {
  position: absolute;
  inset: 0;
  filter: saturate(.4) blur(4px);
  animation: breathe 26s ease-in-out infinite;
}

.hero__still {
  background-image: url(assets/opt/hero-frame.jpg);
  background-size: cover;
  background-position: 50% 38%;
  opacity: .44;
}

.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  opacity: 0;                      /* fades to .44 once it actually plays */
  transition: opacity 1.2s ease;
  pointer-events: none;
}
.hero__video.is-playing { opacity: .44; }

.hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(#0a0a0ce6, #0a0a0c94 45%, #0a0a0cf2);
}

.hero__blob {
  position: absolute;
  border-radius: 50%;
  animation: drift 14s ease-in-out infinite;
}
.hero__blob--a {
  left: 8%; top: 22%; width: 46vw; height: 46vw;
  background: radial-gradient(circle, #ffffff14, transparent 65%);
  filter: blur(40px);
}
.hero__blob--b {
  right: 4%; bottom: 8%; width: 40vw; height: 40vw;
  background: radial-gradient(circle, #ffffff0f, transparent 65%);
  filter: blur(50px);
  animation-duration: 18s;
  animation-direction: reverse;
}
.hero__blob--c {
  left: 38%; top: 8%; width: 26vw; height: 26vw;
  background: radial-gradient(circle, #ffffff0d, transparent 68%);
  filter: blur(40px);
  animation-duration: 22s;
}

.hero__content {
  position: relative;
  text-align: center;
  max-width: 820px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 4vw, 30px);
}

.hero__eyebrow {
  font-size: 11px;
  letter-spacing: .34em;
  color: #a29e98;
  text-transform: uppercase;
}

.hero__title {
  margin: 0;
  font-size: clamp(38px, 8.4vw, 104px);
  line-height: .92;
  letter-spacing: -.03em;
  font-weight: 500;
  text-transform: lowercase;
  color: #f0e6e6;
  text-shadow: 0 0 46px #99000059;
}

.hero__lede {
  margin: 0;
  font-size: clamp(13px, 1.5vw, 17px);
  line-height: 1.7;
  color: #d6d2cb;
  max-width: 46ch;
  text-wrap: pretty;
}
.hero__plus { color: #c1303c; }

.hero__scroll {
  position: absolute;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--muted-dark);
  text-transform: uppercase;
}

/* ---------- stickers ---------- */

.stickers {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}
.stickers[hidden] { display: none; }

.sticker {
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 14px;
  font-family: var(--mono);
  font-size: 17px;
  cursor: pointer;
  color: var(--bone);
}

/* floating variant (wide hero) */
.stickers .sticker {
  position: absolute;
  pointer-events: auto;
  animation: floaty 6s ease-in-out infinite;
}

/* inline variant (narrow hero) */
.stickers-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.stickers-row[hidden] { display: none; }
.stickers-row .sticker { position: relative; }

.sticker__img {
  display: block;
  width: 100%;
  height: 100%;
  opacity: .82;
}

.sticker__pop {
  position: absolute;
  text-align: left;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid #ffffff26;
  background: #0f0f13f2;
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bone);
  pointer-events: none;
}

.sticker-note {
  width: 100%;
  max-width: 400px;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid #ffffff26;
  background: #0f0f13f2;
  text-align: left;
  font-size: 10px;
  line-height: 1.65;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--bone);
}
.sticker-note[hidden] { display: none; }

.caret { animation: caret 1s steps(1) infinite; }

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

.work {
  background: var(--paper);
  color: var(--char);
  padding: clamp(64px, 9vw, 132px) clamp(20px, 5vw, 72px);
}

.work__inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.work__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #14141622;
  padding-bottom: 22px;
}

.display {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5.4vw, 64px);
  line-height: 1;
  letter-spacing: -.02em;
  font-weight: 400;
}

.work__count {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.tabs { display: flex; flex-wrap: wrap; gap: 10px; }

.tab {
  padding: 9px 16px;
  border: 1px solid #14141630;
  border-radius: 999px;
  background: transparent;
  color: var(--body-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all .18s ease;
}
.tab:hover { border-color: #14141660; }
.tab.is-active {
  background: var(--char);
  color: var(--paper);
  border-color: var(--char);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: clamp(18px, 2.5vw, 30px);
  container-type: inline-size;
}

/* The Featured tab shows 4 projects, so in the 3-column layout the last one is
   left alone on row 2, hanging off the left edge. Drop it into the middle column
   so it reads as centred. Scoped to the width where 3 columns actually form:
   below that the grid is 1 or 2 columns and there is no orphan to fix. */
@container (min-width: 940px) {
  .cards > .card:last-child:nth-child(3n + 1) { grid-column: 2; }
}

.card {
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  font-family: var(--mono);
  color: var(--char);
  background: #ffffff;
  border: 1px solid #14141618;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px -24px #14141666;
  border-color: #14141640;
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  border-bottom: 1px solid #14141614;
  overflow: hidden;
}
.card__img { position: absolute; inset: 0; }

.slot {
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  background: #ffffffdd;
  padding: 5px 9px;
  border-radius: 2px;
}

.card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 18px 20px;
}

.card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.card__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 4.8vw, 24px);
  font-weight: 400;
  letter-spacing: -.01em;
}

.card__plus { font-size: 11px; color: var(--muted); }

.card__tags {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.card__blurb {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--body-soft);
  text-wrap: pretty;
}

/* ---------- about ---------- */

.about {
  background: var(--bone);
  color: var(--char);
  padding: clamp(64px, 9vw, 132px) clamp(20px, 5vw, 72px);
  border-top: 1px solid #14141618;
}

.about__inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.about__figure { margin: 0; display: flex; flex-direction: column; gap: 12px; }

.about__frame {
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #d9d6d1;
  border: 1px solid #14141618;
}
.about__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 40% 36%;
  filter: saturate(.95) contrast(1.03);
}

.about__body { display: flex; flex-direction: column; gap: 26px; }

.about__p {
  margin: 0;
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.75;
  color: var(--body);
  text-wrap: pretty;
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 20px;
  border-top: 1px solid #14141626;
  padding-top: 24px;
}
.facts__item { display: flex; flex-direction: column; gap: 6px; }
.facts dt {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}
.facts dd { margin: 0; font-size: 13px; line-height: 1.5; }

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

.foot {
  background: var(--ink);
  color: var(--muted-dark);
  padding: clamp(48px, 7vw, 96px) clamp(20px, 5vw, 72px);
  scroll-margin-top: 0;
}

.foot__inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  align-items: flex-end;
  justify-content: space-between;
}

.foot__left { display: flex; flex-direction: column; gap: 14px; }

.foot__email {
  font-family: var(--serif);
  font-size: clamp(24px, 5.6vw, 54px);
  color: var(--bone);
  letter-spacing: -.02em;
  word-break: break-word;
}

.foot__note {
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}

/* ---------- project modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: clamp(12px, 4vw, 56px);
  background: #0a0a0cd9;
  backdrop-filter: blur(6px);
  overflow-y: auto;
  animation: fadeIn .22s ease;
}
.modal[hidden] { display: none; }

.sheet {
  position: relative;
  width: 100%;
  max-width: 840px;
  background: var(--paper);
  color: var(--char);
  border: 1px solid #14141626;
  animation: riseIn .28s cubic-bezier(.2, .8, .2, 1);
}

.sheet__close {
  position: sticky;
  z-index: 3;
  float: right;
  top: 14px;
  margin: 14px 14px -50px 0;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid #14141626;
  background: #ffffff;
  color: var(--char);
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
}
.sheet__close:hover {
  background: var(--char);
  color: var(--paper);
  border-color: var(--char);
}

.sheet__media {
  position: relative;
  aspect-ratio: 21 / 9;
  display: grid;
  place-items: center;
  border-bottom: 1px solid #14141618;
  overflow: hidden;
}
.sheet__img { position: absolute; inset: 0; }
.sheet__media .slot { padding: 6px 10px; border-radius: 0; }

.sheet__body {
  display: flex;
  flex-direction: column;
  gap: clamp(24px, 3.4vw, 40px);
  padding: clamp(24px, 4vw, 52px);
}

.sheet__head { display: flex; flex-direction: column; gap: 14px; }

.sheet__kicker {
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.sheet__title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(32px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: -.02em;
  font-weight: 400;
}

.sheet__blurb {
  margin: 0;
  font-size: clamp(14px, 1.6vw, 18px);
  line-height: 1.7;
  color: var(--body);
  max-width: 58ch;
  text-wrap: pretty;
}

.sheet__role {
  margin: 0;
  display: flex;
  gap: 14px;
  align-items: baseline;
  border-top: 1px solid #14141626;
  border-bottom: 1px solid #14141626;
  padding: 20px 0;
}
.sheet__role dt {
  font-size: 10px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  flex: none;
}
.sheet__role dd { margin: 0; font-size: 13px; line-height: 1.5; }

.sheet__sections {
  display: flex;
  flex-direction: column;
  gap: clamp(22px, 3vw, 34px);
}
.sheet__section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}
.sheet__section h3 {
  margin: 0;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
}
.sheet__section p {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--body);
  max-width: 66ch;
  text-wrap: pretty;
}

.sheet__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  border-top: 1px solid #14141626;
  padding-top: 24px;
}

.btn-primary {
  padding: 12px 20px;
  background: var(--char);
  color: var(--paper);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
/* beats the global a:hover */
.sheet__foot a.btn-primary:hover { background: #990000; color: #ffffff; }

.btn-ghost {
  padding: 12px 20px;
  border: 1px solid #14141626;
  background: transparent;
  color: var(--body-soft);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-ghost:hover { border-color: var(--char); color: var(--char); }
