/* =========================================================
   Aviral Singh — Portfolio
   Design system: paper, ink & grid. No shadows, no gradients.
   ========================================================= */

/* ---------- Theme tokens ---------- */
:root {
  --bg: #fff8e7;          /* warm cream paper (center)   */
  --bg-gradient: radial-gradient(ellipse at center, #fff8e7 0%, #f3e7d5 100%);
  --ink: #1a1a1a;         /* near-black ink              */
  --ink-soft: #6c665b;    /* muted ink for metadata      */
  --line: #1a1a1a;        /* frame + hairlines           */
  --hair: rgba(26, 26, 26, 0.18); /* faint underlines    */

  /* fine 29px horizontal ruling */
  --grid-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='29'%3E%3Cpath d='M0 0 H40' fill='none' stroke='%23b0a89a' stroke-opacity='0.156' stroke-width='2'/%3E%3C/svg%3E");

  --frame-inset: 20px;

  --font-serif: "EB Garamond", Georgia, serif;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;

  --maxw: 720px;
}

[data-theme="dark"] {
  --bg: #181310;          /* warm near-black (center)    */
  --bg-gradient: radial-gradient(ellipse at center, #181310 0%, #0e0a07 100%);
  --ink: #ede8dc;         /* cream ink                   */
  --ink-soft: #8f877a;
  --line: #ede8dc;
  --hair: rgba(237, 232, 220, 0.2);

  --grid-img: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='29'%3E%3Cpath d='M0 0 H40' fill='none' stroke='%23b0a89a' stroke-opacity='0.052' stroke-width='2'/%3E%3C/svg%3E");
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s ease, color 0.4s ease;
}

/* ---------- Theme cross-fade (View Transitions API) ---------- */
/* Cross-fades the whole page on toggle, so the gradient + grid
   (which CSS can't tween) fade smoothly instead of snapping. */
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.55s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Layered canvas ---------- */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: var(--grid-img);
  background-size: 40px 29px;
  background-position: center;
}

/* the fixed framed border */
.frame {
  position: fixed;
  inset: var(--frame-inset);
  z-index: 100;
  pointer-events: none;
  /* border: 1px solid var(--line); */ /* commented out for now */
}

/* ---------- Theme toggle (pinned top-right) ---------- */
.toggle {
  position: fixed;
  top: calc(var(--frame-inset) + 14px);
  right: calc(var(--frame-inset) + 14px);
  z-index: 110;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.toggle__opt {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}
.toggle__opt[data-active="true"] { color: var(--ink); }
.toggle__sep {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--ink-soft);
  opacity: 0.4;
  user-select: none;
}

/* ---------- Page shell ---------- */
.wrap {
  position: relative;
  z-index: 10;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: clamp(64px, 12vh, 130px) clamp(30px, 7vw, 64px) 64px;
  transform: translateX(-10vw); /* lean the whole column left */
}

/* ---------- Links (base) ---------- */
a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hair);
  padding-bottom: 1px;
  transition: border-color 0.2s ease, color 0.2s ease;
}
a:hover { border-color: var(--ink); }

/* ---------- Intro ---------- */
.name {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(1.15rem, 3vw, 1.7rem);
  line-height: 1;
  letter-spacing: -0.01em;
  margin: 0;
}
.tagline {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  margin: 14px 0 0;
}
.social {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 24px 0 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ---------- Bio ---------- */
.bio {
  max-width: 58ch;
  margin: 30px 0 0;
  font-size: 1.02rem;
  line-height: 1.7;
}
.creds {
  max-width: 58ch;
  margin: 14px 0 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.creds strong { color: var(--ink); font-weight: 500; }

/* ---------- Back link (sub-pages) ---------- */
.back {
  margin: 0 0 26px;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}
.back .ar { color: var(--ink-soft); margin-right: 6px; }

/* ---------- Arrow / quick links ---------- */
.quick {
  margin: 22px 0 0;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.quick .ar {
  color: var(--ink-soft);
  margin-right: 6px;
}

/* ---------- Blocks (projects / honors) ---------- */
.block { margin-top: clamp(40px, 6vh, 64px); }
.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 18px;
}

/* projects list */
.projects {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.proj {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.proj__name {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.2;
}
.proj__desc {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* honors list */
.honors {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  font-size: 0.98rem;
}
.honors strong { font-weight: 500; }

/* achievements list (single column) */
.ach {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
  font-size: 1rem;
}
.ach li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}
.ach__t { flex: 0 1 auto; }
.ach__w {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.12em;
  margin-right: 2px;
}
.ach__amt {
  flex: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}

/* ---------- Writing ---------- */
.writing {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}
.write {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 6px 28px;
  align-items: baseline;
}
.write__date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.write__title {
  justify-self: start; /* shrink to text so the underline only spans the title */
  font-size: 1.05rem;
  line-height: 1.4;
}

/* ---------- Article (blog post) ---------- */
.article { max-width: 660px; }
.article__title {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0;
}
.article__meta {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 16px 0 0;
}
.article__body {
  margin-top: 36px;
  font-size: 1.08rem;
  line-height: 1.75;
}
.article__body p { margin: 0 0 1.25em; max-width: 64ch; }
.article__body h2 {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.5rem;
  line-height: 1.2;
  margin: 1.8em 0 0.5em;
}
.article__body ul { padding-left: 1.2em; margin: 0 0 1.25em; }
.article__body li { margin-bottom: 0.4em; }

/* ---------- Focus ---------- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  :root { --frame-inset: 10px; }
  body { font-size: 16px; }
  .toggle { top: calc(var(--frame-inset) + 10px); right: calc(var(--frame-inset) + 10px); }
  .wrap { padding-top: clamp(72px, 14vh, 110px); }
  .proj { gap: 2px 8px; }
  .write { grid-template-columns: 1fr; gap: 2px; }
}

/* keep the column from clipping off-screen when there isn't room to shift */
@media (max-width: 1000px) {
  .wrap { transform: none; }
}

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