/* ---------- Colors (change the accent here) ---------- */
:root {
  --bg: #F3F2EE;
  --tile: #FFFFFF;
  --ink: #111111;
  --muted: #5C5B57;
  --line: #DAD8D2;
  --accent: #FF5A1F;      /* try #D4FF3A, #8FD3FF or #C9B6FF */
  --on-accent: #111111;
}
/* Dark mode: the site starts light. Visitors switch to dark
   with the theme button, and their choice is remembered. */
:root[data-theme="dark"] {
  --bg: #0E0E0E;
  --tile: #171717;
  --ink: #F2F1EC;
  --muted: #A3A19B;
  --line: #2C2C2C;
  color-scheme: dark;
}
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}
a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
::selection { background: var(--accent); color: var(--on-accent); }

.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

.wrap { max-width: 1200px; margin: 0 auto; padding: 16px 40px 40px; }

/* ---------- Hover effects ---------- */
/* Underline that draws in from the left */
.u {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding-bottom: 2px;
  transition: background-size .25s ease;
}
a:hover .u { background-size: 100% 1px; }

/* Arrows nudge in their direction */
.arr { display: inline-block; transition: transform .2s ease; }
a:hover .arr.r  { transform: translateX(4px); }
a:hover .arr.ne { transform: translate(3px, -3px); }
a:hover .arr.dn { transform: translateY(3px); }

/* Press effect on anything clickable */
a.tile:active, .btn:active, .theme-btn:active { transform: scale(.985); }

/* ---------- Header ---------- */
/* Frosted glass header that stays at the top while you scroll */
html { scroll-padding-top: 96px; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 68%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.6);
  backdrop-filter: blur(16px) saturate(1.6);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .2s ease;
}
.site-header.scrolled { border-bottom-color: var(--line); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header { background: var(--bg); }
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 16px 40px;
  display: flex; flex-wrap: wrap; align-items: center;
  justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; background: var(--ink); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 500;
  transition: background-color .25s ease, color .25s ease;
}
.brand:hover .logo { background: var(--accent); color: var(--on-accent); }
.brand-name { font-weight: 600; font-size: 16px; }
nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
nav a { padding: 12px 14px; font-size: 15px; }
nav .btn {
  padding: 11px 16px; margin-left: 8px; border: 1px solid var(--ink); font-weight: 500;
  transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
nav .btn:hover { background: var(--ink); color: var(--bg); }

/* Theme switch button */
.theme-btn {
  width: 44px; height: 44px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: inherit;
  border: 1px solid var(--line); cursor: pointer;
  transition: border-color .2s ease, transform .15s ease;
}
.theme-btn:hover { border-color: var(--ink); }
.theme-btn svg { transition: transform .4s ease; }
.theme-btn:hover svg { transform: rotate(45deg); }
.theme-btn[hidden] { display: none; }
.icon-sun { display: none; }
.icon-moon { display: block; }

/* ---------- Square grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.tile {
  position: relative;
  background: var(--tile);
  padding: 28px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 20px;
  transition: box-shadow .25s ease, transform .15s ease;
}
/* Hover: thin frame + small accent square in the corner */
.tile::after {
  content: ""; position: absolute; top: 14px; right: 14px;
  width: 8px; height: 8px; background: var(--accent);
  transform: scale(0); transition: transform .25s ease;
}
.tile:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.tile:hover::after { transform: scale(1); }
.tile.accent::after { background: var(--on-accent); }
.tile.inverse:hover { box-shadow: inset 0 0 0 1px var(--accent); }

.sq { aspect-ratio: 1 / 1; }
.wq { aspect-ratio: 2 / 1; }
.span2 { grid-column: span 2; grid-row: span 2; }
.wide { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.inverse { background: var(--ink); color: var(--bg); }
.accent { background: var(--accent); color: var(--on-accent); }

/* Hero */
.hero { padding: 40px; gap: 32px; }
.hero .stack { gap: 24px; }
.hero h1 {
  font-size: clamp(44px, 6.5vw, 92px); font-weight: 600;
  line-height: 0.95; letter-spacing: -0.045em;
}
.hero p { max-width: 460px; font-size: 18px; line-height: 1.5; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 12px; border: 1px solid var(--ink);
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  transition: background-color .2s ease, color .2s ease;
}
.chip:hover { background: var(--ink); color: var(--bg); }

.big { font-size: 26px; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }
.bigger { font-size: 34px; font-weight: 600; line-height: 1.05; letter-spacing: -0.03em; }
.small { font-size: 15px; line-height: 1.45; }
.dot { width: 14px; height: 14px; background: var(--accent); animation: blink 2.4s steps(1) infinite; }

/* Pixel pattern: hover a pixel to light it up */
.pixels { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 3px; width: 64%; }
.pixels i {
  display: block; aspect-ratio: 1 / 1; background: var(--line);
  transition: background-color .4s ease, transform .2s ease;
}
.pixels i.a { background: var(--ink); }
.pixels i.b { background: var(--accent); animation: blink 2.4s steps(1) infinite; }
.pixels i:hover { background: var(--accent); transform: scale(1.2); transition-duration: .05s; }

@keyframes blink { 50% { opacity: .3; } }

/* Section headings */
.section-head {
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: baseline; gap: 16px; padding: 72px 0 20px;
}
.section-head h2 { font-size: 32px; font-weight: 600; letter-spacing: -0.02em; }

/* Project cards */
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.num { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: var(--muted); }
.tag {
  padding: 6px 10px; border: 1px solid var(--line);
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.card h3 { font-size: 22px; font-weight: 600; line-height: 1.2; letter-spacing: -0.015em; }
.card .link { font-size: 15px; font-weight: 500; padding-top: 6px; align-self: flex-start; }

/* Experience cards
   The two cards share rows (subgrid), so the title, place and each
   bullet start at the same height in both cards. 7 rows = top line,
   title, place, 4 bullets. If a job gets more bullets, raise the 7. */
.bento .xp {
  display: grid; grid-row: span 7; grid-template-rows: subgrid;
  row-gap: 0; align-content: start;
}
.xp .stack, .xp .xp-list { display: contents; }
.xp .card-top { margin-bottom: 28px; }
.xp h3 { margin-bottom: 6px; }
.xp h3 + p { margin-bottom: 22px; }
.xp-list li {
  list-style: none; position: relative; padding-left: 20px; margin-bottom: 22px;
  font-size: 15px; line-height: 1.75;
}
.xp-list li:last-child { margin-bottom: 0; }
.xp-list li::before {             /* small accent square, matching the site */
  content: ""; position: absolute; left: 0; top: 10px;
  width: 6px; height: 6px; background: var(--accent);
}

/* Project cards: text starts at the top so titles line up side by side */
.proj { justify-content: flex-start; }
.proj .card-top { margin-bottom: 28px; }

/* "All projects on GitHub" strip under the project cards */
.archive { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px 32px; padding: 24px 28px; }
.archive .bigger { font-size: 26px; flex: 1; }

/* Lists (Now + Contact) */
.row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 16px; padding: 14px 0; border-top: 1px solid var(--line);
}
.row:last-child { border-bottom: 1px solid var(--line); }
.row span:first-child { font-size: 17px; font-weight: 500; }
.row .mono { white-space: nowrap; letter-spacing: 0; }
.about-text { font-size: 19px; line-height: 1.5; letter-spacing: -0.01em; }

/* Contact */
#contact { margin-top: 72px; }
.contact-head { padding: 40px; gap: 24px; }
.contact-head h2 {
  font-size: clamp(48px, 6vw, 84px); font-weight: 600;
  line-height: 0.95; letter-spacing: -0.045em;
}
.contact-links { padding: 28px 40px; justify-content: center; gap: 0; }
.contact-link {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line);
}
.contact-link:last-child { border-bottom: 0; }
.contact-link .label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.contact-link .value { font-size: 18px; font-weight: 500; word-break: break-word; }
.contact-link .arr { font-size: 20px; }

/* Footer */
footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px;
  padding-top: 32px; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--muted);
}

/* ---------- Scroll-in animation (only when the script turns it on) ---------- */
.fx .tile, .fx .section-head { opacity: 0; translate: 0 16px; }
.fx .in {
  opacity: 1; translate: 0 0;
  transition: opacity .6s ease var(--d, 0ms), translate .6s ease var(--d, 0ms);
}
.fx .done { opacity: 1; translate: 0 0; }

/* ---------- Soft dot cursor + click ring (mouse only) ---------- */
.cursor {
  position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none;
  width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transition: opacity .2s ease, width .25s ease, height .25s ease, margin .25s ease,
              background-color .25s ease, box-shadow .25s ease, scale .15s ease;
}
.cursor.on { opacity: 1; }
.cursor.hover {
  width: 38px; height: 38px; margin: -19px 0 0 -19px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.cursor.press { scale: .75; }
.ripple {
  position: fixed; z-index: 9998; pointer-events: none;
  width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  animation: ripple .55s ease-out forwards;
}
@keyframes ripple {
  from { transform: scale(.2); opacity: .9; }
  to   { transform: scale(1.5); opacity: 0; }
}

/* ---------- Soft light that follows the mouse inside each square ---------- */
.tile::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%),
              color-mix(in srgb, var(--accent) 13%, transparent), transparent 70%);
  opacity: 0; transition: opacity .3s ease;
}
.tile:hover::before { opacity: 1; }
.tile.accent::before {
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%),
              rgba(255, 255, 255, .35), transparent 70%);
}
.tile > * { position: relative; z-index: 1; }

/* ---------- Frosted glass ---------- */
.glass {
  background: color-mix(in srgb, var(--tile) 58%, transparent);
  -webkit-backdrop-filter: blur(10px) saturate(1.6);
  backdrop-filter: blur(10px) saturate(1.6);
  border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: color-mix(in srgb, var(--tile) 92%, transparent); }
}

/* Signal / noise square: big pixel pattern under a glass label */
.signal { overflow: hidden; justify-content: flex-end; }
.signal .pixels {
  position: absolute; inset: 28px; z-index: 0;
  width: auto; gap: 4px; align-content: start;
}
.signal .glass { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }

/* ---------- India flag ---------- */
.flag {
  display: block; width: 48px; height: 32px; flex: none;
  margin-bottom: -8px;               /* sits just above the name */
  box-shadow: 0 0 0 1px var(--line);
}
@media (max-width: 560px) { .flag { width: 39px; height: 26px; } }

/* Squares that grow with their text (no gray gaps) */
.tall { min-height: 300px; }

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* ---------- Phone ---------- */
@media (max-width: 560px) {
  .wrap { padding: 12px 16px 32px; }
  /* Two rows on phones: logo + theme button on top, the links underneath */
  html { scroll-padding-top: 128px; }
  .header-inner {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand theme" "nav nav";
    padding: 10px 16px 0; gap: 2px 8px;
  }
  .brand { grid-area: brand; }
  .theme-btn { grid-area: theme; }
  nav { grid-area: nav; margin-left: 0; flex-wrap: nowrap; justify-content: space-between; gap: 0; }
  nav a { padding: 12px 0; }
  .signal.sq { aspect-ratio: 1 / 1; }
  .tall { min-height: 0; }
  .bento { grid-template-columns: minmax(0, 1fr); }
  .span2, .wide { grid-column: span 1; grid-row: auto; }
  .sq, .wq { aspect-ratio: auto; min-height: 220px; }
  .hero, .contact-head, .contact-links { padding: 28px; }
  nav .btn { margin-left: 0; }
}

/* Respect visitors who turn off motion in their system settings */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* =====================================================================
   WRITING
   ===================================================================== */
.full { grid-column: 1 / -1; }
.section-head .more { font-size: 12px; }
.arr.l { display: inline-block; transition: transform .2s ease; }
a:hover .arr.l { transform: translateX(-4px); }

/* List of write-ups (home page + writing page) */
.list-tile { padding: 12px 28px; gap: 0; }
.list-tile:hover { box-shadow: none; }
.list-tile:hover::after, .list-tile:hover::before { opacity: 0; transform: scale(0); }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li + li { border-top: 1px solid var(--line); }
.post-row {
  position: relative;
  display: grid; grid-template-columns: 110px minmax(0, 1fr) auto 24px;
  align-items: baseline; gap: 20px; padding: 22px 0;
}
.post-row::before {               /* small accent square slides in on hover */
  content: ""; position: absolute; left: -20px; top: 50%;
  width: 8px; height: 8px; margin-top: -4px; background: var(--accent);
  transform: scale(0); transition: transform .2s ease;
}
.post-row:hover::before { transform: scale(1); }
.post-date { letter-spacing: 0; text-transform: none; }
.post-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.post-title { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; align-self: flex-start; }
.post-sum { font-size: 15px; line-height: 1.5; }
.post-row .arr { font-size: 18px; justify-self: end; }
.empty-note { padding: 28px 0; font-size: 17px; }

/* Writing page top */
.page-hero { padding: 40px; }
.page-hero h1 {
  font-size: clamp(48px, 7vw, 96px); font-weight: 600;
  line-height: 0.95; letter-spacing: -0.045em;
}
.page-hero p { max-width: 460px; font-size: 18px; line-height: 1.5; }
.count-num { font-size: clamp(64px, 8vw, 112px); font-weight: 600; line-height: .9; letter-spacing: -0.05em; }
.inverse .u-link { color: var(--bg); }

/* =====================================================================
   ARTICLE PAGE
   ===================================================================== */
.post-hero { padding: 40px; gap: 40px; min-height: 340px; }
.post-hero .back { align-self: flex-start; letter-spacing: 0.04em; }
.post-h1 {
  font-size: clamp(36px, 5.2vw, 68px); font-weight: 600;
  line-height: 1.02; letter-spacing: -0.04em; max-width: 920px;
}
.post-lead { max-width: 680px; font-size: 19px; line-height: 1.55; }
.post-meta { letter-spacing: 0.04em; }

/* Article text */
.prose {
  max-width: 700px; margin: 64px auto 80px;
  font-size: 18px; line-height: 1.75;
}
.prose > * + * { margin-top: 1.25em; }
.prose h2, .prose h3, .prose h4 { line-height: 1.25; letter-spacing: -0.02em; scroll-margin-top: 96px; }
.prose h2 { font-size: 28px; font-weight: 600; margin-top: 2.2em; display: flex; gap: 14px; align-items: baseline; }
.prose h2::before {               /* square marker, matching the site */
  content: ""; flex: none; width: 10px; height: 10px; background: var(--accent);
  transform: translateY(-3px);
}
.prose h3 { font-size: 22px; font-weight: 600; margin-top: 1.8em; }
.prose h4 { font-size: 18px; font-weight: 600; margin-top: 1.6em; }
.prose p { margin-bottom: 0; }
.prose a {
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px; text-underline-offset: 3px;
}
.prose a:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.prose strong { font-weight: 600; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li + li { margin-top: .4em; }
.prose li::marker { color: var(--accent); }
.prose blockquote {
  margin-left: 0; margin-right: 0; padding: 4px 0 4px 22px;
  border-left: 2px solid var(--ink); color: var(--muted); font-style: italic;
}
.prose hr { border: 0; height: 1px; background: var(--line); margin: 3em 0; }
.prose img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); }
.prose img + em { display: block; margin-top: 10px; font-size: 14px; color: var(--muted); }
.prose code {
  font-family: 'JetBrains Mono', monospace; font-size: .86em;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  padding: 2px 6px;
}
.prose pre {
  margin: 1.6em 0; padding: 20px 22px; overflow-x: auto;
  background: var(--tile); border: 1px solid var(--line);
  font-size: 14px; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; font-size: inherit; }
.prose div.highlight, .prose figure.highlight { margin: 1.6em 0; }
.prose div.highlight pre, .prose figure.highlight pre { margin: 0; }
.prose table {
  display: block; overflow-x: auto; border-collapse: collapse;
  font-size: 15px; line-height: 1.5;
}
.prose th, .prose td { padding: 10px 14px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-family: 'JetBrains Mono', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

/* Code colors (readable in light and dark) */
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .ch { color: var(--muted); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr, .highlight .kc, .highlight .nt { font-weight: 600; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb, .highlight .sd,
.highlight .m, .highlight .mi, .highlight .mf, .highlight .na {
  color: color-mix(in srgb, var(--accent) 70%, var(--ink));
}
.highlight .nf, .highlight .nc { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }

/* Previous / next */
.post-nav .tile { min-height: 180px; }
.post-nav .tile .bigger { font-size: 24px; line-height: 1.25; }
.post-nav .tile.right { text-align: right; align-items: flex-end; }

/* 404 */
.nf { min-height: 60vh; }

@media (max-width: 560px) {
  .list-tile { padding: 4px 20px; }
  .post-row { grid-template-columns: minmax(0, 1fr) 20px; gap: 6px 12px; padding: 18px 0; }
  .post-row .post-date { grid-column: 1 / -1; }
  .post-row .tag { display: none; }
  .post-row::before { display: none; }
  .post-title { font-size: 18px; }
  .post-hero, .page-hero { padding: 28px; min-height: 0; }
  .prose { margin: 40px auto 56px; font-size: 17px; }
  .prose h2 { font-size: 24px; }
}

/* ---------- Article images ---------- */
/* Cover image: sits right under the article title card */
.cover-tile { margin: 0; padding: 0; gap: 0; }
.cover-tile:hover { box-shadow: none; }
.cover-tile:hover::after, .cover-tile:hover::before { opacity: 0; transform: scale(0); }
.cover-tile img {
  display: block; width: 100%; height: auto;
  aspect-ratio: 21 / 9; object-fit: cover; border: 0;
}
.cover-tile figcaption { padding: 12px 28px; letter-spacing: 0.02em; text-transform: none; font-size: 12px; }

/* Side-by-side images */
.prose .gallery { margin: 2em 0; }
.gallery-grid { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gallery.cols-1 .gallery-grid { grid-template-columns: minmax(0, 1fr); }
.gallery.cols-3 .gallery-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gallery-item { display: block; overflow: hidden; border: 1px solid var(--line); }
.prose .gallery-item:hover { background: none; }
.gallery-item img {
  display: block; width: 100%; height: 100%; border: 0;
  aspect-ratio: 4 / 3; object-fit: cover;
  transition: transform .4s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }

@media (max-width: 560px) {
  .gallery .gallery-grid { grid-template-columns: minmax(0, 1fr); }
  .cover-tile img { aspect-ratio: 16 / 9; }
  .cover-tile figcaption { padding: 10px 20px; }
}
