/* Labs — visual system ported from p2.akhilpaul.in.
   Linked only from /labs so the akhilpaul.in homepage keeps its own styles.
   Type matches p2: General Sans for display, Geist for UI and body.
   p2 is a dark theme: ink on #12100e. It does not switch with prefers-color-scheme. */

@font-face {
  font-family: "General Sans";
  src: url("../fonts/general-sans-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "General Sans";
  src: url("../fonts/general-sans-400i.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "General Sans";
  src: url("../fonts/general-sans-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "General Sans";
  src: url("../fonts/general-sans-500i.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "General Sans";
  src: url("../fonts/general-sans-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Geist";
  src: url("../fonts/geist-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #12100e;
  --bg-2: #191612;
  --surface: #1e1a16;
  --ink: #f6f1e7;
  --muted: #cbbfae;
  --soft: #a89884;
  --line: rgba(246, 241, 231, 0.14);
  --signal: #ff4d2a;
  --paper: #f3ecdf;
  --paper-ink: #1a1612;
  --display: "General Sans", sans-serif;
  --sans: "Geist", sans-serif;
  --nav-h: 76px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: auto; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  letter-spacing: -0.011em;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
::selection { background: var(--signal); color: #fff8f4; }

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 2000;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  border-radius: 8px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 3px;
}

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

html.js:not(.reduced) [data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.85s cubic-bezier(.16, 1, .3, 1), transform 0.85s cubic-bezier(.16, 1, .3, 1);
}
html.js:not(.reduced) [data-reveal].is-in { opacity: 1; transform: none; }

html.js:not(.reduced) .line > span {
  animation: lineIn 1.05s cubic-bezier(.16, 1, .3, 1) both;
}
.line:nth-child(2) > span { animation-delay: .08s; }
.line:nth-child(3) > span { animation-delay: .16s; }
@keyframes lineIn {
  from { transform: translateY(110%); }
  to { transform: none; }
}
.line { display: block; overflow: hidden; }
.line > span { display: block; padding-bottom: 0.08em; }

/* ── cursor (p2) ── */
.cursor { display: none; }
@media (hover: hover) and (pointer: fine) {
  html.has-cursor, html.has-cursor * { cursor: none !important; }
  html.has-cursor .cursor { display: block; }
}
html.kbd, html.kbd * { cursor: auto !important; }
html.kbd .cursor { display: none !important; }

.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 400;
  border-radius: 50%;
}
.cursor-dot {
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  background: var(--signal);
}
.cursor-ring {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(246, 241, 231, 0.7);
  display: grid;
  place-items: center;
  transition: width .35s cubic-bezier(.22,1,.36,1), height .35s cubic-bezier(.22,1,.36,1), margin .35s cubic-bezier(.22,1,.36,1), background .35s, border-color .35s;
}
.cursor.is-hot .cursor-ring {
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  background: var(--signal);
  border-color: transparent;
}
.cursor-label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1a120f;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity .25s, transform .25s;
}
.cursor.is-hot .cursor-label { opacity: 1; transform: none; }

/* ── nav (p2) ── */
.site-nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 120;
  width: min(1120px, calc(100% - 28px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 8px 7px 12px;
  background: rgba(18, 16, 14, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.nav-links { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  text-decoration: none;
  color: var(--muted);
  font-size: 14.5px;
  padding: 8px 12px;
  border-radius: 999px;
}
.nav-links a:hover,
.nav-links a[aria-current="page"],
.nav-links a[aria-current="true"] { color: var(--ink); background: rgba(246, 241, 231, 0.08); }
.nav-cta {
  text-decoration: none;
  background: var(--ink);
  color: #16130f;
  font-weight: 500;
  font-size: 14.5px;
  padding: 10px 16px;
  border-radius: 999px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.nav-cta:hover { background: #fff; }
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: transparent;
  place-items: center;
  gap: 5px;
  padding: 0;
}
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  position: relative;
  transition: transform .3s, opacity .3s;
}
.nav-toggle span::before, .nav-toggle span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after { top: 5px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); }

.mobile-nav {
  position: fixed;
  inset: 0;
  z-index: 110;
  background: rgba(14, 12, 10, 0.96);
  padding: 110px 28px 40px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}
.mobile-nav[hidden] { display: none; }
.mobile-nav a {
  font-family: var(--display);
  font-size: clamp(2.6rem, 12vw, 4.2rem);
  line-height: 0.96;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--ink);
}
.mobile-nav a em { font-style: italic; color: var(--signal); }
.mobile-nav a[aria-current="page"] { font-style: italic; color: var(--signal); }

/* ── layout (p2) ── */
.wrap { width: min(1120px, calc(100% - 48px)); margin: 0 auto; }
.section { padding: clamp(76px, 10vw, 128px) 0; scroll-margin-top: 84px; }
.kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--soft);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.kicker i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  display: inline-block;
  box-shadow: 0 0 0 0 rgba(255, 77, 42, 0.6);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(255, 77, 42, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 77, 42, 0); }
}
.display {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.45rem, 6.5vw, 5.9rem);
  line-height: 0.96;
  letter-spacing: -0.048em;
  margin: 0;
}
.display em, h2 em, .lede em { font-style: italic; font-weight: 500; }
.display em { color: var(--signal); }
h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.15rem, 4.2vw, 3.7rem);
  line-height: 1.02;
  letter-spacing: -0.042em;
  margin: 0;
}
.lede {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 46ch;
  margin: 18px 0 0;
}
.section-head {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 28px;
  align-items: end;
  margin-bottom: 36px;
}
.section-head p { margin: 0; color: var(--muted); max-width: 42ch; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 15px;
  transition: transform .35s cubic-bezier(.22,1,.36,1), background .2s, border-color .2s;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--ink); color: #16130f; }
.btn-primary:hover { background: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: rgba(246,241,231,.4); background: rgba(246,241,231,.04); }

/* ── hero atmosphere (p2 orbs, shorter than the homepage hero) ── */
.labs-hero {
  position: relative;
  padding: 148px 0 12px;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.orb {
  position: absolute;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  filter: blur(0);
}
.orb-a {
  background: radial-gradient(circle, rgba(255, 77, 42, 0.28), transparent 68%);
  top: -18vw;
  right: -8vw;
  animation: drift 16s ease-in-out infinite;
}
.orb-b {
  background: radial-gradient(circle, rgba(232, 196, 150, 0.14), transparent 70%);
  bottom: -22vw;
  left: -12vw;
  animation: drift 20s ease-in-out infinite reverse;
}
@keyframes drift {
  50% { transform: translate3d(3%, -2%, 0) scale(1.06); }
}
.labs-hero-copy { position: relative; z-index: 1; }

.labs-log { padding-top: clamp(36px, 5vw, 64px); }

.edit-note {
  margin: 0 0 22px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px dashed rgba(255, 77, 42, 0.7);
  background: rgba(255, 77, 42, 0.08);
  color: var(--ink);
  font-size: 0.98rem;
}
.edit-note strong { color: var(--signal); font-weight: 500; }
.edit-note[hidden] { display: none; }

/* ── filters ── */
.lab-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0 0 18px;
}
.lab-filters[hidden] { display: none; }
.lab-filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lab-filter-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--soft);
  margin-right: 4px;
}
.chip {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  cursor: pointer;
  transition: background .2s, border-color .2s, color .2s;
}
.chip:hover { border-color: rgba(246, 241, 231, 0.4); }
.chip[aria-pressed="true"] {
  background: var(--ink);
  color: #16130f;
  border-color: transparent;
}

.lab-statusline {
  margin: 0 0 16px;
  color: var(--soft);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── cards (p2 work cards) ── */
.work-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  perspective: 1200px;
}
.lab-grid { align-items: start; }
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  isolation: isolate;
  transform-style: preserve-3d;
  will-change: transform;
}
.lab-card[hidden] { display: none; }
.card-media { position: relative; overflow: hidden; aspect-ratio: 16/10; background: #0d0b09; }
.card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform .8s cubic-bezier(.22,1,.36,1);
}
.card:hover { border-color: rgba(255, 77, 42, 0.65); }
.card:hover .card-media img { transform: scale(1.08); }
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 40%), rgba(255, 77, 42, 0.34), transparent 46%);
  opacity: 0;
  transition: opacity .35s;
  pointer-events: none;
  z-index: 2;
}
.card:hover::after { opacity: 1; }
.pill {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 16, 14, 0.8);
  border: 1px solid rgba(246, 241, 231, 0.18);
  font-size: 12px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(8px);
}
.pill.gold { background: #e7c27a; color: #1a1612; border-color: transparent; font-weight: 500; }
.pill.status-exploring {
  background: rgba(255, 77, 42, 0.16);
  color: #ffb5a4;
  border-color: transparent;
}
.pill.status-shipped {
  background: #e7c27a;
  color: #1a1612;
  border-color: transparent;
  font-weight: 500;
}
.pill.status-paused {
  background: rgba(18, 16, 14, 0.55);
  color: var(--soft);
}
.card-body { padding: 20px 22px 22px; display: flex; flex-direction: column; align-items: flex-start; flex: 1; }
.lab-kicker-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.lab-kicker-row .pill { position: static; }
.eyebrow { margin: 0; color: var(--soft); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; }
.card h3 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(1.7rem, 2vw, 2.15rem);
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 8px 0 10px;
}
.card p { margin: 0; color: var(--muted); }
.lab-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.lab-tag {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--soft);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.lab-tag:hover,
.lab-tag[aria-pressed="true"] { color: var(--ink); border-color: rgba(246, 241, 231, 0.4); }
.lab-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: auto; padding-top: 16px; }
.more {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  font-size: 14.5px;
  text-decoration: none;
  position: relative;
  z-index: 3;
}
.more svg { width: 16px; height: 16px; transition: transform .3s; }
a.more:hover svg,
.lab-card:hover .more svg { transform: translateX(5px); }
.more.is-placeholder { color: var(--soft); cursor: default; }
.more.is-placeholder svg { opacity: 0.45; }

.lab-empty {
  margin: 8px 0 0;
  padding: 28px 22px;
  border-radius: 22px;
  border: 1px dashed rgba(255, 77, 42, 0.55);
  color: var(--muted);
  background: rgba(255, 77, 42, 0.06);
}
.lab-empty[hidden] { display: none; }

/* ── case study ── */
.case-hero {
  position: relative;
  display: block;
  padding: 124px 0 8px;
}
.case-hero-media {
  position: relative;
  width: min(1120px, calc(100% - 48px));
  margin: 4px auto 28px;
  aspect-ratio: 16 / 10;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0d0b09;
}
.case-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}
.case-hero-copy,
.case-read { width: min(720px, calc(100% - 48px)); margin: 0 auto; position: relative; z-index: 2; }
.case-hero > .case-hero-copy:first-child { width: min(1120px, calc(100% - 48px)); }
.case-hero h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.3rem, 5.6vw, 5.15rem);
  line-height: 0.96;
  letter-spacing: -0.046em;
  margin: 0;
}
.case-hero h1 em { font-style: italic; color: var(--signal); }
.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-size: 14.5px;
}
.back svg { width: 16px; height: 16px; }
.back:hover { color: #fff; }
.case-read { margin-bottom: 80px; }
.case-read section { padding: 40px 0 8px; border-top: 1px solid var(--line); }
.case-read h2 { font-size: clamp(2rem, 4vw, 3.15rem); margin: 0 0 16px; }
.case-read .prose p,
.case-read li { color: var(--muted); font-size: 1.05rem; line-height: 1.7; }
.case-read .prose p { margin: 0 0 14px; }
.case-figure,
.case-strip {
  margin: 6px 0 20px;
  background: #0e0c0a;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.case-figure img,
.case-strip img { width: 100%; height: auto; display: block; background: #0d0b09; }
.case-strip-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  background: rgba(246, 241, 231, 0.14);
}
.case-strip-row img { aspect-ratio: 16 / 10; object-fit: cover; height: auto; }
.case-figure figcaption,
.case-strip figcaption {
  padding: 12px 14px 14px;
  color: var(--muted);
  font-size: 0.9rem;
  background: var(--surface);
}
.case-read ul { margin: 0; padding: 0 0 0 1.15em; }
.case-read li { margin: 12px 0; }
.case-read li strong,
.idea h3 { color: var(--ink); font-weight: 500; }
.ideas-note {
  margin: -4px 0 8px;
  color: var(--soft);
  font-size: 0.98rem;
}
.idea { padding: 16px 0 4px; }
.idea h3 {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-size: 1.12rem;
  letter-spacing: -0.02em;
}
.idea p { margin: 0; }
.visit {
  margin-top: 12px;
  padding: 36px 0 8px;
  border-top: 1px solid var(--line);
}
.btn-visit { min-height: 56px; padding: 0 22px; font-size: 16px; }
.case-miss { padding: 140px 0 80px; }
.case-miss h1 {
  font-family: var(--display);
  font-weight: 500;
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  letter-spacing: -0.046em;
  margin: 12px 0;
}

/* ── footer (p2) ── */
.footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 28px;
}
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; color: var(--soft); font-size: 14px; }
.footer a { color: var(--muted); text-decoration: none; }
.footer nav { display: flex; gap: 16px; flex-wrap: wrap; }

@media (max-width: 980px) {
  .section-head { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .line { overflow: visible; }
  html.js:not(.reduced) .line > span { animation: none; transform: none; }
  .nav-links, .site-nav .nav-cta { display: none; }
  .nav-toggle { display: grid; }
  .work-grid { grid-template-columns: 1fr; }
  .wrap { width: min(1120px, calc(100% - 32px)); }
  .labs-hero { padding-top: 112px; }
  .case-hero { padding-top: 104px; }
  .case-hero > .case-hero-copy:first-child,
  .case-hero-media,
  .case-hero-copy { width: min(720px, calc(100% - 32px)); }
  .case-read { width: min(720px, calc(100% - 32px)); }
  .btn-visit { width: 100%; }
}
@media (max-width: 560px) {
  .card-body { padding: 18px 16px 18px; }
  .case-strip-row { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html.js [data-reveal], html.js .line > span { opacity: 1; transform: none; }
}

@media (scripting: none) {
  [data-reveal], .line > span { opacity: 1 !important; transform: none !important; }
}
