/* ============================================================
   PORTFOLIO — ATISHAY JAIN
   Black, white, archive.  No grays invented on a whim.
   Type: Neue Haas Grotesk Display (via Inter Tight fallback)
         + JetBrains Mono for meta / numerals.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter+Tight:wght@300;400;500;600;700&family=JetBrains+Mono:wght@300;400;500&display=swap");

:root {
  --ink: #0a0a0a;
  --paper: #fafaf7;
  --rule: #0a0a0a;
  --muted: #6b6b66;
  --grid: 8px;
  --max: 1440px;
  --border: 0.75px;

  --font-sans: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html[data-theme="dark"] {
  --ink: #f2efe8;
  --paper: #0a0a0a;
  --rule: #f2efe8;
  --muted: #7a7a73;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
  line-height: 1.45;
  min-height: 100vh;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
  overflow-x: hidden;
}

/* ---- Grain overlay (subtle paper texture) ---- */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.9'/></svg>");
}
html[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.06; }

/* ---- Typography primitives ---- */
.mono { font-family: var(--font-mono); font-weight: 400; }
.label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.label--ink { color: var(--ink); }

.caps {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 11px;
  font-weight: 500;
}

.display {
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 0.95;
}

.rule { border: 0; border-top: var(--border) solid var(--rule); margin: 0; }

/* ---- Frame / border shell ---- */
.frame {
  position: fixed;
  inset: 16px;
  border: var(--border) solid var(--rule);
  pointer-events: none;
  z-index: 50;
}
@media (max-width: 720px) {
  .frame { inset: 10px; }
}

.corner-tick {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--rule);
}
.corner-tick.tl { top: -3.5px; left: -3.5px; }
.corner-tick.tr { top: -3.5px; right: -3.5px; }
.corner-tick.bl { bottom: -3.5px; left: -3.5px; }
.corner-tick.br { bottom: -3.5px; right: -3.5px; }

/* ---- Header / Footer meta bars ---- */
.chrome {
  position: fixed;
  left: 0;
  right: 0;
  padding: 0 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
  z-index: 60;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}
.chrome > * { pointer-events: auto; }
.chrome--top { top: 32px; }
.chrome--bot { bottom: 32px; }
@media (max-width: 720px) {
  .chrome { padding: 0 24px; font-size: 9px; }
  .chrome--top { top: 22px; }
  .chrome--bot { bottom: 22px; }
}

/* ---- Search input ---- */
.search-shell {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}
.search-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: var(--border) solid var(--rule);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(22px, 3.2vw, 32px);
  font-weight: 300;
  letter-spacing: -0.02em;
  padding: 18px 0 18px 36px;
  outline: none;
  caret-color: var(--ink);
}
.search-input::placeholder {
  color: var(--muted);
  font-weight: 300;
}
.search-caret {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 22px;
  color: var(--ink);
  pointer-events: none;
}
.search-enter-hint {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kbd {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border: var(--border) solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--ink);
  line-height: 1;
}

/* Blink cursor */
@keyframes blink { 50% { opacity: 0; } }
.blink { animation: blink 1.05s steps(2) infinite; }

/* ---- Buttons / chips ---- */
.chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 14px;
  border: var(--border) solid var(--rule);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.chip:hover { background: var(--ink); color: var(--paper); }

.btn-ghost {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  border-bottom: var(--border) solid var(--rule);
  padding-bottom: 2px;
}
.btn-ghost:hover { opacity: 0.6; }

/* ---- Response page ---- */
.response {
  max-width: 980px;
  margin: 0 auto;
  padding: 120px 44px 140px;
}
@media (max-width: 720px) { .response { padding: 96px 28px 120px; } }

.response h1 {
  font-weight: 300;
  font-size: clamp(32px, 5vw, 56px);
  letter-spacing: -0.035em;
  line-height: 1.02;
  margin: 0 0 32px;
  text-wrap: pretty;
}
.response p {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 20px;
  max-width: 66ch;
  text-wrap: pretty;
}
.response .cite {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  vertical-align: super;
  padding: 0 2px;
  cursor: pointer;
  border-bottom: var(--border) solid var(--muted);
}
.response .cite:hover { color: var(--ink); border-color: var(--ink); }

/* ---- Project card ---- */
.pcard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: var(--border) solid var(--rule);
  border-bottom: var(--border) solid var(--rule);
  margin: 40px 0;
}
.pcard + .pcard { margin-top: -1px; border-top: 0; }
.pcard__media {
  aspect-ratio: 4/3;
  background: var(--ink);
  color: var(--paper);
  position: relative;
  overflow: hidden;
  border-right: var(--border) solid var(--rule);
}
.pcard__body { padding: 28px; display: flex; flex-direction: column; }
.pcard__no {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.pcard__title {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin: 12px 0 6px;
}
.pcard__sub { font-size: 14px; color: var(--muted); margin-bottom: 20px; }
.pcard__meta { margin-top: auto; display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }

@media (max-width: 720px) {
  .pcard { grid-template-columns: 1fr; }
  .pcard__media { border-right: 0; border-bottom: var(--border) solid var(--rule); }
}

/* ---- Loading dots ---- */
@keyframes loadpulse { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }
.dot {
  display: inline-block;
  width: 6px; height: 6px;
  background: var(--ink);
  margin-right: 6px;
  animation: loadpulse 1.2s infinite;
}
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }

/* ---- Archive (PDF-style) ---- */
.archive {
  max-width: 760px;
  margin: 0 auto;
  padding: 120px 44px 140px;
}
.archive h2 {
  font-weight: 300;
  font-size: clamp(28px, 4vw, 44px);
  letter-spacing: -0.03em;
  margin: 0 0 8px;
}
.archive .page-no {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--muted);
  z-index: 60;
}

/* ---- Tweaks panel ---- */
.tweaks {
  position: fixed;
  bottom: 64px;
  right: 44px;
  z-index: 200;
  background: var(--paper);
  border: var(--border) solid var(--rule);
  min-width: 260px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tweaks__head {
  padding: 12px 14px;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: var(--border) solid var(--rule);
}
.tweaks__row {
  padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
  border-bottom: var(--border) solid var(--rule);
}
.tweaks__row:last-child { border-bottom: 0; }
.tweaks__opts { display: flex; gap: 4px; }
.tweaks__opts button {
  background: transparent;
  border: var(--border) solid var(--rule);
  color: var(--ink);
  font-family: inherit;
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 4px 8px;
  cursor: pointer;
  text-transform: uppercase;
}
.tweaks__opts button[data-active="true"] { background: var(--ink); color: var(--paper); }

/* ---- Animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.6s var(--ease) both; }

@keyframes revealLine {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.reveal-line { transform-origin: left center; animation: revealLine 0.8s var(--ease) both; }

/* ---- Utility layout ---- */
.stack-8 > * + * { margin-top: 8px; }
.stack-16 > * + * { margin-top: 16px; }
.stack-24 > * + * { margin-top: 24px; }
.stack-40 > * + * { margin-top: 40px; }

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

/* ---- Links ---- */
a { color: inherit; text-decoration: none; }
a.underline { border-bottom: var(--border) solid currentColor; padding-bottom: 1px; }
a.underline:hover { opacity: 0.6; }

/* Scrollbars slim on webkit */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }

/* Hide default focus */
button:focus-visible, input:focus-visible { outline: var(--border) dashed var(--ink); outline-offset: 4px; }
