/* ==========================================================================
   Advait personal site
   One stylesheet for every page. Edit the tokens in :root to retheme.
   ========================================================================== */

:root {
  /* Colors */
  --bg: #0E0E0E;            /* page background */
  --surface: #151515;       /* image placeholders */
  --border: #1C1C1C;        /* image borders */
  --border-hover: #333333;
  --footer-bg: #1E1E1E;     /* revealed footer */
  --footer-dot: #1A1A1A;    /* dot pattern, a shade darker than the footer */
  --text: #EDEDED;          /* all body text */
  --text-strong: #FFFFFF;
  --label: #8A8A8A;         /* small caps labels */
  --muted: #6E6E6E;         /* superscript numbers */
  --underline: #5A5A5A;     /* dotted link underline */
  --accent: #FFD60A;        /* link arrows, version tag */
  --rule: rgba(237, 237, 237, 0.14); /* header line */

  /* Type */
  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --text-size: 14px;
  --label-size: 11px;

  /* Layout */
  --gutter: 16px;           /* left/right page margin */
  --col-gap: 16px;          /* gap between the 3 columns */
  --section-gap: 36px;
  --footer-h: 290px;        /* height of the revealed footer */

  /* Widest the content may get. In the 3-column layout it's 16:10 of the
     visible window height, so on wider windows the extra width becomes
     empty side margins. */
  --content-max: 100000px;
  /* Left/right padding: the gutter, or more if the content is capped. */
  --side: max(var(--gutter), (100% - var(--content-max)) / 2);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-size);
  font-weight: 500;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0; }
img { display: block; max-width: 100%; }

/* ---------- Links ---------- */

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--text-strong); }

/* Any link with an arrow gets the dotted underline */
a.ext {
  text-decoration: underline dotted;
  text-decoration-color: var(--underline);
  text-underline-offset: 3px;
}
a.ext:hover { text-decoration-color: var(--accent); }
a.ext::after {
  content: "↗";
  color: var(--accent);
  font-size: 0.75em;
  vertical-align: super;
  line-height: 0;
  margin-left: 1px;
}

sup.num { color: var(--muted); font-size: 0.7em; margin-left: 1px; }

.fit { width: fit-content; }

/* ---------- Labels (the small gray caps) ---------- */

.label {
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label);
  margin: 0;
}

/* ---------- Page shell + footer reveal ---------- */

/* The page sits on top of a fixed footer. Its bottom margin equals the
   footer's height, so scrolling to the end slides the page up and
   uncovers the footer, as if it was always there. */
.page {
  position: relative;
  z-index: 1;
  background: var(--bg);
  margin-bottom: var(--footer-h);
  padding: 20px var(--side) 48px;
  min-height: 100vh;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px 24px;
  padding-bottom: 14px;
  border-bottom: 0.5px solid var(--rule);
}
.site-header .name { font-size: 15px; font-weight: 600; }
.site-header .loc { display: none; }  /* only shown in the 3-column layout */

/* Close (×) on project pages: back to home, pinned to the right edge */
.site-header .close {
  margin-left: auto;
  align-self: center;
  display: flex;
  padding: 4px;
  margin-right: -4px;       /* bigger tap target, icon still on the content edge */
  color: var(--text-strong);
  transition: color 0.15s;
}
.site-header .close:hover { color: var(--accent); }
.site-header .close:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

/* ---------- Home: intro ---------- */

.intro {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.about {
  max-width: 600px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lists {
  display: flex;
  gap: 40px;
}

.list { display: flex; flex-direction: column; gap: 2px; }
.list .label { margin-bottom: 14px; }

/* ---------- Home: project grid ---------- */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px var(--col-gap);
  align-items: start;      /* cards line up at the top; heights can differ */
}

.card { display: flex; flex-direction: column; gap: 12px; }
.card .meta { display: flex; flex-direction: column; gap: 2px; }

.thumb {
  aspect-ratio: auto;      /* real images keep their own height */
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.3s;
}
.thumb img { width: 100%; height: auto; }
.thumb.placeholder { aspect-ratio: 16 / 10; }  /* empty slots keep a default shape */
.card:hover .thumb { border-color: var(--border-hover); transform: translateY(-2px); }

/* Placeholder look for any image box without an image yet */
.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4A4A4A;
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ---------- Project page ---------- */


.media {
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
}
.media img { width: 100%; height: 100%; object-fit: cover; }
.ratio-cover { aspect-ratio: 16 / 8; }
.ratio-wide { aspect-ratio: 16 / 9; }
.ratio-photo { aspect-ratio: 4 / 3; }
.ratio-auto img { height: auto; }  /* image keeps its own shape, no crop */

.overview {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.overview .summary {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.overview h1 { margin: 0; font-size: var(--text-size); font-weight: 600; }
.title-block { display: flex; flex-direction: column; gap: 2px; }
.outbound { display: flex; flex-wrap: wrap; gap: 24px; }

.details {
  margin: 0;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px 16px;
  align-content: start;
}
.details dt { padding-top: 3px; }
.details dd { margin: 0; }

.case {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.case-text {
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.figures-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
figure { margin: 0; display: flex; flex-direction: column; gap: 8px; }

/* ---------- Footer ---------- */

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  height: var(--footer-h);
  padding: 44px var(--side) 0;
  background-color: var(--footer-bg);
  background-image: radial-gradient(circle, var(--footer-dot) 1px, transparent 1.5px);
  background-size: 14px 14px;
}

/* Scrolling LED band along the bottom of the footer, drawn on a canvas
   by js/ticker.js. 4 dots tall at a 5px pitch. */
.ticker {
  position: absolute;
  left: var(--side);
  right: var(--side);
  bottom: 20px;
  height: 20px;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.ticker canvas { display: block; width: 100%; height: 100%; }

.footer-inner { display: flex; flex-direction: column; gap: 32px; }
.footer-block { display: flex; flex-direction: column; gap: 12px; }
.footer-row { display: flex; align-items: center; gap: 16px; }

.version {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0 10px;
}

button.version {
  background: transparent;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

/* ---------- Neofetch panel (shelved: see shelved/fetch.js) ---------- */

/* Panels float just above the version tag, over the bottom of the page,
   so the footer itself can stay short. */
.fetch {
  position: fixed;
  z-index: 5;
  left: var(--side);
  bottom: calc(var(--footer-h) - 36px);
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding: 20px 24px;
  background: var(--bg);
  border: 1px solid #2A2A2A;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--text);
  max-width: calc(100vw - 2 * var(--gutter));
}
.fetch[hidden] { display: none; }
.fetch-logo {
  margin: 0;
  font: inherit;
  line-height: 1.2;
  color: var(--accent);
}
.fetch-info { display: flex; flex-direction: column; }
.fetch-line { white-space: nowrap; }
.fetch-key { color: var(--accent); }
.fetch-k { display: inline-block; min-width: 76px; }
.fetch-rule { color: #3A3A3A; }
.fetch-blocks { display: flex; margin-top: 10px; }
.fetch-blocks span { width: 22px; height: 12px; }

/* Line-by-line print */
.fetch .fetch-line,
.fetch .fetch-logo { opacity: 0; transform: translateY(2px); transition: opacity 0.12s, transform 0.12s; }
.fetch .on { opacity: 1; transform: none; }

/* ---------- Changelog panel (js/changelog.js) ---------- */

button.updated {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: var(--underline);
  text-underline-offset: 3px;
}
button.updated:hover,
button.updated[aria-expanded="true"] { text-decoration-color: var(--accent); }
button.updated:focus-visible { outline: 1px dashed var(--accent); outline-offset: 3px; }

.changelog {
  position: fixed;
  z-index: 5;
  left: var(--side);
  bottom: calc(var(--footer-h) - 36px);
  width: 440px;
  max-width: calc(100vw - 2 * var(--gutter));
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg);
  border: 1px solid #2A2A2A;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
}
.changelog[hidden] { display: none; }
.log-entry { display: flex; flex-direction: column; gap: 2px; }
.log-head { display: flex; gap: 12px; align-items: baseline; }
.log-plus { color: var(--muted); }

/* ---------- Layout: 1 column by default, 3 columns on wide screens ----------
   On wide screens the page is three uniform columns from header to footer:
     header   Advait          | CS Student @ Purdue | West Lafayette, IN
     intro    About           | Experience          | Links
     grid     project         | project             | project
     footer   version, date   | GitHub, LinkedIn    | Let's build...
   `display: contents` lets nested wrappers drop their children straight
   into the shared grid, so everything lines up on the same column edges. */

@media (min-width: 900px) {
  :root {
    --footer-h: 186px;
    --gutter: 8px;          /* tighter side margins in the 3-column layout */
    --content-max: max(160vh, 884px);  /* 16:10 of the window; never narrower than the 3-column breakpoint */
  }

  .site-header,
  .intro,
  .grid,
  .footer-inner,
  .overview {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--col-gap);
  }

  .site-header { row-gap: 0; }
  .site-header > * { grid-row: 1; }  /* one line, even where the × shares a track */
  .site-header .loc { display: block; }

  .intro { row-gap: 0; align-items: start; }
  .about { max-width: none; }
  .lists { display: contents; }

  .grid { row-gap: 24px; }

  /* Masonry (js/masonry.js): three independent column stacks */
  .grid.masonry { row-gap: 0; }
  .grid-col { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

  .footer-inner { row-gap: 0; align-items: start; }
  .footer-block { display: contents; }

  .overview { row-gap: 0; }
  .overview .summary { grid-column: 1 / span 2; max-width: 640px; }

  /* Header, intro and footer use a finer 12-track grid (4 tracks per
     column) so About can reach 1/4 into column 2 and the middle items can
     start halfway into column 2. Its edges still match the 3-column grid. */
  .site-header,
  .intro,
  .footer-inner { grid-template-columns: repeat(12, minmax(0, 1fr)); }

  .site-header .name { grid-column: 1 / span 4; }
  .site-header .pos  { grid-column: 7 / span 2; white-space: nowrap; }
  .site-header .loc  { grid-column: 9 / span 4; }
  .site-header .close { grid-column: -2 / -1; grid-row: 1; justify-self: end; margin-left: 0; }

  .about { grid-column: 1 / span 5; }
  .lists > .list:first-child { grid-column: 7 / span 2; }
  .lists > .list:last-child  { grid-column: 9 / span 4; }

  .footer-row                { grid-column: 1 / span 6; }
  .footer-block > .list      { grid-column: 7 / span 2; }
  .footer-inner > .list      { grid-column: 9 / span 4; }

}

/* Narrow 3-column content: not enough room for the position and the
   location side by side, so drop the location and let the position run.
   Measured on the content itself (not the window), since the 16:10 cap can
   make content narrower than the window. */
.page { container-type: inline-size; }
@container (max-width: 1343px) {
  .site-header .loc { display: none; }
  .site-header .pos { grid-column: 7 / -1; }
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  :root { --gutter: 14px; }
  .figures-2 { grid-template-columns: minmax(0, 1fr); }
  .details { grid-template-columns: 100px minmax(0, 1fr); }
  .fetch { right: var(--gutter); flex-direction: column; gap: 12px; padding: 16px; overflow-x: auto; }
  .fetch-logo { display: none; }
  .changelog { right: var(--gutter); width: auto; padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---------- Project page extras ----------
   Each project page mixes these blocks differently:
   Samsung = overview only, RL = paper + figure + citation,
   Ludix = pipeline + demo video, Sentinel = actions + video + one-liner,
   StageSense = overview only, Avery Dennison = full case study. */

/* Plain result sentence under the media (no styled stat callout) */
.note { max-width: 640px; }

/* Video slot: a 16:9 box until a real <video> or embed goes in */
.video { aspect-ratio: 16 / 9; }
.video video,
.video iframe { display: block; width: 100%; height: 100%; border: 0; }

/* Ludix pipeline: numbered stages in a row, thin rule on top of each */
.pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px var(--col-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.stage {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 0.5px solid var(--rule);
}
@media (min-width: 640px) {
  .pipeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 900px) {
  .pipeline { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* RL citation block with a copy button */
.cite-wrap { position: relative; max-width: 860px; }
.cite {
  margin: 0;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--text);
  white-space: pre;
  overflow-x: auto;
}
.copy {
  position: absolute;
  top: 10px;
  right: 12px;
  background: var(--surface);
  border: none;
  padding: 2px 4px;
  cursor: pointer;
  text-decoration: underline dotted;
  text-decoration-color: var(--underline);
  text-underline-offset: 3px;
}
.copy:hover { color: var(--text); text-decoration-color: var(--accent); }
.copy:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

/* ==========================================================================
   Project page layout (body.project-page), modeled on joseph.cv:
   sticky header; title pinned in column 1 while the content scrolls in
   columns 2-3; description in two text columns; details in a row; boxed
   link rows with a chevron; captions in small caps under media.
   ========================================================================== */

.project-page .site-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  padding-top: 20px;
  margin-top: -20px;
}

.project { display: flex; flex-direction: column; gap: 32px; }
.project-title { display: flex; flex-direction: column; gap: 2px; }
.project-title h1 { margin: 0; font-size: var(--text-size); font-weight: 600; }
.project-body { display: flex; flex-direction: column; gap: 40px; min-width: 0; }

.desc { display: flex; flex-direction: column; gap: 16px; }

/* Details: label above value, side by side */
.meta-row {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px var(--col-gap);
}
.meta-row > div { display: flex; flex-direction: column; gap: 4px; }
.meta-row dd { margin: 0; }

/* Boxed link rows with a chevron */
.link-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px var(--col-gap);
}
.link-row,
.drop > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #151515;
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: var(--label-size);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--label);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.link-row::after,
.drop > summary::after {
  content: "›";
  font-size: 16px;
  line-height: 1;
  color: var(--muted);
  transition: transform 0.15s, color 0.15s;
}
.link-row:hover,
.drop > summary:hover { border-color: var(--border-hover); color: var(--text); }
.link-row:hover::after { color: var(--accent); transform: translateX(2px); }
.link-row:focus-visible,
.drop > summary:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }

/* Dropdown: a link row that opens */
.drop > summary { list-style: none; }
.drop > summary::-webkit-details-marker { display: none; }
.drop[open] > summary { color: var(--text); border-color: var(--border-hover); }
.drop[open] > summary::after { transform: rotate(90deg); color: var(--accent); }
.drop-body { padding-top: 8px; }
.drop .cite-wrap { max-width: none; }

/* Sub-sections inside the body (Avery Dennison, StageSense) */
.sub { display: flex; flex-direction: column; gap: 16px; }
.sub h2 { margin: 0; font-size: var(--text-size); font-weight: 600; }
.sub > p { max-width: 640px; }

@media (min-width: 900px) {
  .project {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: var(--col-gap);
    align-items: start;
  }
  .project-title { grid-column: 1; position: sticky; top: 72px; }
  .project-body { grid-column: 2 / span 2; }
  .desc { display: block; column-count: 2; column-gap: var(--col-gap); }
  .desc p + p { margin-top: 16px; }
  .meta-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .link-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- RoboCup page: two-round split + robot architecture ---------- */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px var(--col-gap);
}
.split > .sub { gap: 12px; }

.arch {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.arch-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #151515;
  border: 1px solid var(--border);
}
.arch-box ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.arch-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px 8px;
  text-align: center;
}
.arch-link .arrow { color: var(--accent); font-size: 18px; line-height: 1; }

@media (min-width: 640px) {
  .arch { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: stretch; }
}
@media (min-width: 900px) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Small-caps section labels inside sub-sections keep label size */
.sub h2.label { font-size: var(--label-size); font-weight: 400; }
