/* yashdagade.com v2 — shell styles. Paradigm-inspired: white, hairlines, deep blue accent. */

:root {
  --bg: #ffffff;
  --ink: #000000;
  --ink-75: rgba(0, 0, 0, .75);
  --g100: #f6f6f6;
  --g200: #eeeeee;
  --g300: #dddddd;
  --g400: #cccccc;
  --g500: #999999;
  --g600: #666666;
  --g700: #333333;
  --accent: #1432F5;
  --accent-soft: rgba(20, 50, 245, .12);
  --accent-2: #7F93FF;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;

  --fs-ui: 12px;
  --lh-ui: 15px;
  --fs-xs: 11px;
  --lh-xs: 14px;
  --ls-ui: .02em;

  --gutter: 40px;
  --radius-pill: 14px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--mono);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  letter-spacing: var(--ls-ui);
  overflow: hidden;
}

body.page-mode { overflow: auto; }

a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

::selection { background: var(--accent); color: #fff; }

:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

.mono-xs { font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: .02em; }

/* ---------- Chrome ---------- */

.chrome-top {
  position: fixed;
  inset: 0 0 auto 0;
  height: 64px;
  z-index: 40;
  pointer-events: none;
}

.wordmark {
  position: absolute;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: 38px;
  line-height: 42px;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  pointer-events: auto;
}

/* the caret only appears while the next phrase is typing (the About page); it never shifts the centered name */
.wordmark { cursor: pointer; user-select: none; -webkit-user-select: none; }
.wordmark .wm-caret {
  position: absolute;
  right: -6px;
  top: 50%;
  width: 2px;
  height: .78em;
  transform: translateY(-46%);
  background: var(--accent);
  opacity: 0;
  transition: opacity .25s ease;
}
.wordmark.is-typing .wm-caret { opacity: 1; }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  background: var(--g200);
  font-family: var(--mono);
  font-size: var(--fs-ui);
  line-height: var(--lh-ui);
  white-space: nowrap;
  transition: background .15s ease;
  pointer-events: auto;
}
.pill:hover { background: var(--g300); }

.pill--menu {
  position: absolute;
  right: var(--gutter);
  top: 18px;
}

.pill--find {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 40;
}

.chrome-index {
  position: fixed;
  left: var(--gutter);
  bottom: 26px;
  z-index: 40;
  display: flex;
  gap: 10px;
}
.chrome-index a {
  text-decoration: none;
  color: var(--ink);
  padding: 2px 0;
  min-width: 18px;
  text-align: center;
}
.chrome-index a:hover .n { color: var(--accent); }
.chrome-index a .n { display: inline-block; min-width: 7px; }
.chrome-index a[aria-current="page"] .n { visibility: hidden; }
.chrome-index.is-off { visibility: hidden; } /* (the Build film: no row) */

.chrome-caption {
  position: fixed;
  left: var(--gutter);
  bottom: 62px;
  z-index: 30;
  max-width: 300px;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  letter-spacing: .02em;
  white-space: pre-line;
  pointer-events: none;
}
.chrome-caption .line {
  display: block;
  transition: opacity .35s ease, transform .35s var(--ease);
}
.chrome-caption.is-swapping .line { opacity: 0; transform: translateY(3px); }

.chrome-left {
  position: fixed;
  left: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 220px;
  pointer-events: none;
}
.chrome-left .controls-group { display: none; pointer-events: auto; }
.chrome-left .controls-group.is-active { display: block; animation: yd-fade-in .45s var(--ease) both; }
.chrome-left .controls-group > * + * { margin-top: 36px; }

.chrome-links {
  position: fixed;
  right: var(--gutter);
  bottom: 62px;
  z-index: 30;
  text-align: right;
}
.chrome-links .links-group { display: none; }
.chrome-links .links-group.is-active { display: block; animation: yd-fade-in .45s var(--ease) both; }
.chrome-links a {
  display: block;
  font-size: var(--fs-xs);
  line-height: 16px;
  text-decoration: none;
  color: var(--ink);
}
.chrome-links a span { border-bottom: 1px solid var(--g400); transition: border-color .15s ease, color .15s ease; }
.chrome-links a:hover span { border-color: var(--accent); color: var(--accent); }

.sound-toggle {
  position: fixed;
  right: var(--gutter);
  bottom: 22px;
  z-index: 40;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--ink);
}
.sound-toggle svg { width: 16px; height: 16px; overflow: visible; }
.sound-toggle .wave { transition: opacity .2s ease; }
.sound-toggle .x { opacity: 0; transition: opacity .2s ease; }
.sound-toggle.is-off .wave { opacity: 0; }
.sound-toggle.is-off .x { opacity: 1; }
.sound-toggle:hover { color: var(--accent); }

.hint {
  position: fixed;
  left: 50%;
  bottom: 62px;
  transform: translate(-50%, 4px);
  z-index: 35;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: #555;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .4s ease, transform .4s var(--ease);
}
.hint.is-visible { opacity: 1; transform: translate(-50%, 0); }
/* between the caption (left) and the links (right): wrap rather than run into them on mid-size windows */
@media (min-width: 1101px) and (max-width: 1360px) {
  .hint { white-space: normal; text-align: center; width: max-content; max-width: calc(100vw - 2 * 340px); }
}
/* narrow desktops/tablets: no room between caption and links, so the hint sits under the wordmark */
@media (min-width: 801px) and (max-width: 1100px) {
  .hint { bottom: auto; top: 56px; transform: translate(-50%, -4px); }
  .hint.is-visible { transform: translate(-50%, 0); }
}
.hint .dot {
  display: inline-block;
  width: 5px; height: 5px;
  margin-right: 8px;
  background: var(--accent);
  vertical-align: 1px;
  animation: yd-blink 1.1s steps(2, jump-none) infinite;
}

/* ---------- Stage & scenes ---------- */

#stage {
  position: fixed;
  inset: 0;
  z-index: 1;
}

.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s ease, visibility 0s linear .45s;
}
.scene.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity .55s ease .08s, visibility 0s;
}
.scene > canvas { position: absolute; inset: 0; display: block; }

/* ---------- Stepper (Paradigm left-middle list) ---------- */

.stepper {
  position: relative;
  padding-left: 14px;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
}
.stepper__rail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--ink);
}
.stepper__tick {
  position: absolute;
  left: -4px;
  top: 0;
  width: 9px;
  height: 1px;
  background: var(--ink);
  transition: transform .45s var(--ease);
}
.stepper__item {
  display: block;
  text-align: left;
  padding: 3.75px 0;
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: var(--ink);
  white-space: nowrap;
  transition: color .2s ease;
}
.stepper__item:hover { color: var(--accent); }
.stepper__item.is-active { color: var(--ink); }
.stepper__item .k { color: var(--g500); margin-left: 6px; opacity: 0; transition: opacity .2s ease; }
.stepper__item:hover .k { opacity: 1; }

/* ---------- Slider (Paradigm hairline slider) ---------- */

.slider { width: 173px; font-size: var(--fs-xs); line-height: var(--lh-xs); user-select: none; -webkit-user-select: none; }
.slider__label { margin-bottom: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.slider__track {
  position: relative;
  height: 17px;
  cursor: ew-resize;
  touch-action: none;
}
.slider__track::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 8px;
  height: 1px;
  background: var(--ink);
}
.slider__thumb {
  position: absolute;
  top: 3px;
  left: 0;
  width: 1px;
  height: 11px;
  background: var(--ink);
  transform: translateX(-.5px);
}
.slider__thumb::after { content: ''; position: absolute; inset: -6px -8px; }
.slider__track:hover .slider__thumb,
.slider.is-dragging .slider__thumb { background: var(--accent); }
.slider__ends { display: flex; justify-content: space-between; margin-top: 7px; color: var(--ink); }

/* ---------- Reveal card (hover a drawing → the real thing) ---------- */

.reveal-card {
  position: fixed;
  left: 0; top: 0;
  z-index: 60;
  width: 300px;
  pointer-events: none;
  opacity: 0;
  transform: translate3d(-9999px, -9999px, 0);
  transition: opacity .18s ease;
}
.reveal-card.is-visible { opacity: 1; }
.reveal-card__frame {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--ink);
  padding: 4px;
}
.reveal-card__frame::before,
.reveal-card__frame::after {
  content: '+';
  position: absolute;
  font-size: 12px;
  line-height: 12px;
  color: var(--accent);
}
.reveal-card__frame::before { left: -4px; top: -7px; }
.reveal-card__frame::after { right: -4px; bottom: -6px; }
.reveal-card img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: cover;
  background: var(--g100);
}
.reveal-card img.is-contain { object-fit: contain; background: var(--bg); }
/* caption bar is part of the card (opaque), so it never lands on scene text */
.reveal-card__meta {
  margin-top: 0;
  padding: 5px 6px 4px;
  background: var(--bg);
  border: 1px solid var(--ink);
  border-top: 0;
  font-size: 12px;
  line-height: 15px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.reveal-card__meta .t { color: var(--ink); }
.reveal-card__meta .m { color: #555; text-align: right; }

[data-reveal] { cursor: crosshair; }

/* ---------- Overlays: Find palette, menu, shortcuts ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  background: rgba(246, 246, 246, .72);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .22s ease, visibility 0s linear .22s;
}
.overlay.is-open { opacity: 1; visibility: visible; transition: opacity .22s ease, visibility 0s; }

.palette {
  width: min(490px, calc(100vw - 32px));
  background: var(--bg);
  border-radius: var(--radius-pill);
  padding: 20px 12px 14px;
  transform: translateY(6px) scale(.99);
  transition: transform .28s var(--ease);
}
.overlay.is-open .palette { transform: none; }

.palette__input {
  display: flex;
  align-items: center;
  padding: 0 8px 18px;
  white-space: nowrap;
}
.palette__input .prefix { color: var(--ink); }
.palette__input .typed { color: var(--ink); }
.palette__input .cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 1px;
  background: var(--ink);
  animation: yd-blink 1.05s steps(2, jump-none) infinite;
}
.palette__input input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
}

.palette__list { list-style: none; margin: 0; padding: 0; max-height: min(52vh, 420px); overflow: auto; }
.palette__list li a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--ink);
}
.palette__list li a .p { color: var(--ink); }
.palette__list li.is-selected a { background: var(--g200); }
.palette__list li .grp {
  display: block;
  padding: 12px 8px 4px;
  color: var(--g500);
  font-size: var(--fs-xs);
}
.palette__list li:first-child .grp { padding-top: 0; }
.palette__empty { padding: 5px 8px; color: var(--g500); }

.palette__foot {
  display: flex;
  justify-content: space-between;
  padding: 18px 8px 0;
}
.palette__foot .l { display: flex; gap: 14px; }

.overlay__close {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
}

.shortcuts { width: min(420px, calc(100vw - 32px)); }
.shortcuts dl { display: grid; grid-template-columns: 90px 1fr; gap: 7px 12px; margin: 0; padding: 0 8px; }
.shortcuts dt { color: var(--ink); }
.shortcuts dd { margin: 0; color: var(--g600); }
.shortcuts h3 { font: inherit; margin: 0 0 16px; padding: 0 8px; }

/* Menu [M] */
.menu-panel {
  position: fixed;
  right: var(--gutter);
  top: 56px;
  width: 280px;
  background: var(--bg);
  border-radius: var(--radius-pill);
  padding: 18px 20px 16px;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 20px;
  letter-spacing: 0;
  transform: translateY(-4px);
  transition: transform .28s var(--ease);
}
#menu { place-items: start end; }
#menu.is-open .menu-panel { transform: none; }
.menu-panel a { display: block; text-decoration: none; color: var(--ink); padding: 3px 0; }
.menu-panel a:hover { color: var(--accent); }
.menu-panel .indent { padding-left: 16px; }
.menu-panel .indent .k { font-family: var(--mono); font-size: var(--fs-xs); color: var(--g500); margin-right: 8px; }
.menu-panel .sep { height: 1px; background: var(--g300); margin: 12px 0; }
.menu-panel .small { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.menu-panel .small a { padding: 0; }
.menu-panel a.quiet { color: #555; font-size: 15px; }
.menu-panel .page-links { display: none; }
.menu-panel .page-links .k {
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  color: #555;
  margin-bottom: 6px;
}
.menu-panel .credit {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  line-height: var(--lh-xs);
  letter-spacing: .02em;
  color: var(--g600);
}
.menu-panel .credit a { display: inline; padding: 0; color: var(--g600); border-bottom: 1px solid var(--g400); }
.menu-panel .credit a:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Page mode (About / Press) ---------- */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 120px 24px 140px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  letter-spacing: 0;
}
.page h1 { font-weight: 400; font-size: 28px; line-height: 1.2; letter-spacing: -.02em; margin: 0 0 28px; }
.page p { margin: 0 0 18px; }
.page a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--g400); transition: border-color .15s, color .15s; }
.page a:hover { color: var(--accent); border-color: var(--accent); }
.page .label { font-family: var(--mono); font-size: var(--fs-xs); line-height: var(--lh-xs); letter-spacing: .02em; color: var(--g600); margin: 44px 0 12px; }
.page ul.plain { list-style: none; margin: 0; padding: 0; }
.page ul.plain li { padding: 10px 0; border-top: 1px solid var(--g200); display: grid; grid-template-columns: 1fr auto; gap: 16px; }
.page ul.plain li:last-child { border-bottom: 1px solid var(--g200); }
.page ul.plain .meta { font-family: var(--mono); font-size: var(--fs-xs); color: var(--g600); letter-spacing: .02em; white-space: nowrap; padding-top: 5px; }
.page ul.plain .desc { display: block; font-size: 15px; color: var(--g600); line-height: 1.45; margin-top: 2px; }
.page ul.plain .desc a { color: var(--g600); }
.page .portrait { float: right; width: 150px; margin: 6px 0 16px 28px; filter: grayscale(1) contrast(1.05); border: 1px solid var(--ink); padding: 3px; transition: filter .4s ease; }
.page .portrait:hover { filter: none; }

body.page-mode .chrome-top { position: fixed; background: linear-gradient(#fff 70%, rgba(255,255,255,0)); pointer-events: none; }
body.page-mode::after {
  content: '';
  position: fixed;
  inset: auto 0 0 0;
  height: 76px;
  background: linear-gradient(rgba(255,255,255,0), #fff 60%);
  pointer-events: none;
  z-index: 20;
}

/* ---------- Animations ---------- */

@keyframes yd-fade-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes yd-blink { 0% { opacity: 1; } 100% { opacity: 0; } }

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

@media (max-width: 800px) {
  :root { --gutter: 16px; }
  .wordmark { font-size: 28px; line-height: 32px; top: 16px; }
  .wordmark.is-long { font-size: 22px; top: 19px; }
  .pill--menu { top: 16px; }
  .chrome-left {
    top: auto;
    bottom: 104px;
    transform: none;
    width: auto;
    right: var(--gutter);
  }
  .chrome-left .controls-group { display: none; }
  .chrome-left .controls-group.is-active { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
  .chrome-left .controls-group > * + * { margin-top: 0; }
  .stepper { display: none; }
  .chrome-caption { bottom: 58px; max-width: 70vw; }
  /* scene links move into the [M] menu on phones ("On this page") */
  .chrome-links { bottom: 58px; }
  .chrome-links .links-group.is-active { display: none; }
  .menu-panel .page-links { display: block; }
  .pill--find { bottom: 18px; left: auto; right: 56px; transform: none; }
  .chrome-index { bottom: 24px; gap: 6px; }
  .sound-toggle { bottom: 18px; }
  .reveal-card { width: 220px; }
  /* phones: the top is the context headline's, so hints sit low, above the controls (bottom set by core) */
  .hint { bottom: 190px; left: 16px; right: auto; transform: translateY(4px); max-width: calc(100vw - 32px);
          white-space: normal; background: rgba(255, 255, 255, .94); padding: 3px 6px; margin-left: -6px; }
  .hint.is-visible { transform: none; }
  .page { padding-top: 90px; font-size: 17px; }
  .page .portrait { width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- Context headline (api.headline): big, persistent "what am I looking at" text ---------- */
.chrome-headline {
  position: fixed;
  left: 0; right: 0; top: 0;
  z-index: 25;
  pointer-events: none;
}
.headline-group {
  display: none;
  position: absolute;
  top: 74px;
  left: 50%;
  transform: translateX(-50%);
  width: min(960px, calc(100vw - 560px));
  text-align: center;
  font-family: var(--serif);
  color: var(--ink);
  letter-spacing: 0;
}
.headline-group.is-active.has-text { display: block; }
.headline-group .hl-title {
  margin: 0;
  font-size: clamp(22px, 2.05vw, 31px);
  line-height: 1.24;
  letter-spacing: -.016em;
  font-weight: 400;
}
.headline-group .hl-sub {
  margin: 10px auto 0;
  max-width: 860px;
  font-size: clamp(15.5px, 1.27vw, 19px);
  line-height: 1.42;
  color: #3a3a3a;
}
.headline-group .katex { font-size: 1em; }
.headline-group .hl-in { display: inline-block; animation: yd-hl-in .55s var(--ease) both; }
@keyframes yd-hl-in { from { opacity: 0; transform: translateY(5px); filter: blur(2px); } to { opacity: 1; transform: none; filter: none; } }
@media (max-width: 1100px) {
  .headline-group { width: calc(100vw - 520px); min-width: 420px; }
}
@media (max-width: 800px) {
  .headline-group { top: 58px; left: 16px; right: 16px; width: auto; min-width: 0; transform: none; text-align: left; }
  .headline-group .hl-title { font-size: 19px; line-height: 1.27; }
  .headline-group .hl-sub { font-size: 14.5px; margin-top: 6px; }
}

/* [M] → [X] stays crisp above the menu overlay */
body.menu-open .chrome-top { z-index: 90; }

/* ---------- Math (KaTeX via Site.tex / api.tex) ---------- */
.katex { font-size: 1.08em; color: inherit; line-height: 1.2; }
.tex-block .katex-display { margin: 0; text-align: left; }
.tex-block .katex-display > .katex { text-align: left; }
