/* ============================================================
   Mark Balakrishnan — personal portfolio
   Visual system: minimal editorial — neutral monochrome,
   one restrained accent.
   ============================================================ */

/* ---- Tokens : Paper (default) ---- */
:root {
  --bg:        #F2EEE5;
  --surface:   #FBF9F3;
  --surface-2: #ECE7DA;
  --ink:       #1B1714;
  --ink-soft:  #4B463D;
  --muted:     #837C70;
  --line:      #E1D9C9;
  --line-2:    #CDC2AC;
  --accent-base: #0B4228;       /* British racing green, tweakable */
  --accent:    var(--accent-base);
  --accent-ink:#FFFFFF;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Newsreader', Georgia, serif;
  --font-mono:    'Space Mono', ui-monospace, monospace;

  --maxw: 1180px;
  --pad: clamp(20px, 5vw, 64px);
  --r: 4px;

  color-scheme: light;
}

[data-theme="carbon"] {
  --bg:        #14120D;
  --surface:   #1C1A14;
  --surface-2: #23201A;
  --ink:       #F2ECDF;
  --ink-soft:  #CBC4B5;
  --muted:     #8C8576;
  --line:      #2C281F;
  --line-2:    #3B362B;
  --accent:    color-mix(in oklab, var(--accent-base) 55%, #DCEFE2);
  --accent-ink:#FFFFFF;
  color-scheme: dark;
}

/* ---- Typeface pairings (tweakable on the homepage) ---- */
[data-type="b"] {
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body:    'Source Serif 4', Georgia, serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}
[data-type="c"] {
  --font-display: 'Schibsted Grotesk', system-ui, sans-serif;
  --font-body:    'Spectral', Georgia, serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;
}
[data-type="d"] {
  --font-display: 'Syne', system-ui, sans-serif;
  --font-body:    'Literata', Georgia, serif;
  --font-mono:    'Space Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 19px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

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

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--pad);
  position: relative;
  z-index: 1;
}

/* ---- Typographic helpers ---- */
.mono {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.kicker {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: .6em;
}
.kicker::before {
  content: "";
  width: 26px; height: 1px;
  background: var(--line-2);
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.02; letter-spacing: -.02em; margin: 0; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.2) blur(10px);
  background: color-mix(in oklab, var(--bg) 80%, transparent);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
}
.monogram {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.04em;
  border-radius: var(--r);
  transition: background .3s, color .3s;
}
.brand:hover .monogram { background: var(--accent); color: var(--accent-ink); }
.brand b {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -.01em;
}
.nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav a {
  font-family: var(--font-mono);
  font-size: .73rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 0;
  transition: color .2s;
}
.nav a::after {
  content: "";
  position: absolute; left: 0; bottom: -2px;
  width: 0; height: 1.5px; background: var(--accent);
  transition: width .25s ease;
}
.nav a:hover { color: var(--ink); }
.nav a:hover::after { width: 100%; }
.nav .loc { color: var(--muted); }
@media (max-width: 620px) {
  .nav .hideable { display: none; }
}
@media (max-width: 560px) {
  .topbar .wrap { height: 58px; }
  .brand b { font-size: 14.5px; }
  .brand .monogram { width: 30px; height: 30px; font-size: 13px; }
  .nav { gap: 16px; }
  .nav a { font-size: .64rem; letter-spacing: .06em; }
}
@media (max-width: 380px) {
  .brand b { display: none; }
}

/* ============================================================
   Hero
   ============================================================ */
.hero {
  padding-top: clamp(48px, 9vw, 110px);
  padding-bottom: clamp(40px, 7vw, 80px);
  border-bottom: 1px solid var(--line);
}
.hero .eyebrow { margin-bottom: clamp(22px, 4vw, 38px); }
.hero h1 {
  font-size: clamp(2.8rem, 9vw, 6.4rem);
  letter-spacing: -.035em;
  margin: 0;
}
.hero h1 .light { font-weight: 500; color: var(--ink-soft); }
.hero .lede {
  margin-top: clamp(20px, 3vw, 30px);
  max-width: 30ch;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  line-height: 1.45;
  color: var(--ink-soft);
}
.hero .lede em { color: var(--ink); font-style: normal; font-weight: 500; }

.status {
  margin-top: clamp(26px, 4vw, 40px);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px 9px 14px;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: .76rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: border-color .25s, transform .25s;
}
.status:hover { border-color: var(--accent); transform: translateY(-1px); }
.status .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex: none;
}
.status .dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--accent);
  animation: ping 2.4s ease-out infinite;
}
.status .arrow { color: var(--muted); transition: transform .25s; }
.status:hover .arrow { transform: translateX(3px); color: var(--accent); }
@keyframes ping {
  0%   { transform: scale(.6); opacity: .9; }
  80%, 100% { transform: scale(2.1); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .status .dot::after { animation: none; }
}

/* meta strip under hero */
.hero-meta {
  margin-top: clamp(34px, 5vw, 56px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.hero-meta div {
  background: var(--surface);
  padding: 16px 18px;
}
.hero-meta dt {
  font-family: var(--font-mono);
  font-size: .66rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.hero-meta dd {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -.01em;
}
@media (max-width: 720px) {
  .hero-meta { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   Section scaffolding
   ============================================================ */
.section { padding-block: clamp(56px, 9vw, 110px); }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: clamp(34px, 5vw, 56px);
  flex-wrap: wrap;
}
.section-head h2 {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  letter-spacing: -.03em;
}
.section-head .count {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--muted);
}

/* ============================================================
   Project log
   ============================================================ */
.log { border-top: 1px solid var(--line); }

.entry {
  display: grid;
  grid-template-columns: 64px 1fr 240px;
  gap: clamp(18px, 3vw, 40px);
  align-items: center;
  padding: clamp(22px, 3vw, 34px) 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  position: relative;
  transition: background .3s ease;
}
.entry::before {
  content: "";
  position: absolute; left: calc(var(--pad) * -1); right: calc(var(--pad) * -1);
  top: 0; bottom: 0;
  background: var(--surface);
  opacity: 0;
  transition: opacity .3s ease;
  z-index: -1;
}
.entry:hover::before { opacity: 1; }

.entry .idx {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
  align-self: start;
  padding-top: 6px;
}
.entry:hover .idx { color: var(--accent); }

.entry .body { min-width: 0; }
.entry .yr {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.entry .yr .badge {
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 100px;
  padding: 1px 9px;
  font-size: .64rem;
}
.entry h3 {
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  letter-spacing: -.03em;
  line-height: 1.04;
  transition: color .25s;
}
.entry:hover h3 { color: var(--accent); }
.entry .desc {
  margin: 10px 0 14px;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.5;
  max-width: 52ch;
}
.entry .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.tag {
  font-family: var(--font-mono);
  font-size: .64rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 100px;
}
[data-theme="carbon"] .tag { background: color-mix(in oklab, var(--surface) 70%, var(--bg)); }

.entry .thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  position: relative;
}
.entry .thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), filter .4s;
  filter: saturate(.92);
}
/* Screenshot / logo thumbs: framed whole on white, no crop */
.entry .thumb.contain { background: #FFFFFF; }
.entry .thumb.contain img { object-fit: contain; padding: 16px; filter: none; }
.entry:hover .thumb.contain img { transform: scale(1.03); filter: none; }
.entry:hover .thumb img { transform: scale(1.05); filter: saturate(1.05); }
.entry .thumb .ext {
  position: absolute; top: 8px; right: 8px;
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  color: var(--ink);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .25s, transform .25s;
}
.entry:hover .thumb .ext { opacity: 1; transform: none; }

@media (max-width: 860px) {
  .entry {
    grid-template-columns: 44px 1fr;
    grid-template-areas: "idx body" "thumb thumb";
  }
  .entry .idx { grid-area: idx; }
  .entry .body { grid-area: body; }
  .entry .thumb {
    grid-area: thumb;
    aspect-ratio: 16 / 7;
    margin-top: 6px;
  }
}
@media (max-width: 480px) {
  .entry { grid-template-columns: 1fr; grid-template-areas: "idx" "body" "thumb"; }
}

/* ============================================================
   About
   ============================================================ */
.about { border-top: 1px solid var(--line); }
.about-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: clamp(34px, 6vw, 90px);
}
@media (max-width: 820px) { .about-grid { grid-template-columns: 1fr; } }

.about .prose p {
  font-size: clamp(1.15rem, 2.2vw, 1.42rem);
  line-height: 1.55;
  margin: 0 0 1.1em;
  color: var(--ink);
  text-wrap: pretty;
}
.about .prose p.sub { color: var(--ink-soft); font-size: 1.1rem; line-height: 1.6; }
.about .prose strong { font-weight: 600; }
.about .prose a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--accent) 40%, transparent); }
.about .prose a:hover { border-bottom-color: var(--accent); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  overflow: hidden;
}
.panel .ph {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex; justify-content: space-between;
}
.toolbox { list-style: none; margin: 0; padding: 8px 0; }
.toolbox li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
  padding: 9px 18px;
  font-family: var(--font-mono);
  font-size: .82rem;
}
.toolbox li span:first-child { color: var(--ink); }
.toolbox li span:last-child { color: var(--muted); font-size: .72rem; letter-spacing: .04em; text-align: right; }

.linklist { list-style: none; margin: 0; padding: 0; }
.linklist li { border-top: 1px solid var(--line); }
.linklist li:first-child { border-top: 0; }
.linklist a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  transition: background .2s, color .2s, padding-left .25s;
}
.linklist a:hover { background: var(--surface-2); color: var(--accent); padding-left: 24px; }
.linklist a .meta { font-family: var(--font-mono); font-size: .68rem; font-weight: 400; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.linklist a:hover .meta { color: var(--accent); }

/* ============================================================
   Footer
   ============================================================ */
.foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-block: clamp(48px, 7vw, 90px);
}
.foot-top {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap;
  padding-bottom: clamp(36px, 5vw, 56px);
}
.foot-mark {
  display: flex;
  flex-direction: column;
  gap: .12em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4.6vw, 2.9rem);
  letter-spacing: -.025em;
  line-height: 1.08;
}
.foot-mark .prompt { font-family: var(--font-mono); font-weight: 700; color: var(--accent); margin-right: .4em; }
.foot .social { display: flex; gap: 10px; }
.foot .social a {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  color: var(--ink);
  transition: background .25s, color .25s, transform .25s, border-color .25s;
}
.foot .social a:hover { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: translateY(-3px); }
.foot-bottom {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  font-family: var(--font-mono);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--muted);
}

/* ============================================================
   Reveal — kept as a no-op hook. Content is always visible;
   entrance motion is intentionally omitted for reliability.
   ============================================================ */
.reveal { opacity: 1; transform: none; }

/* ============================================================
   Article / detail page
   ============================================================ */
.article { padding-block: clamp(36px, 6vw, 64px) clamp(56px, 9vw, 110px); }
.crumb {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); text-decoration: none;
  margin-bottom: clamp(28px, 5vw, 48px);
  transition: color .2s, gap .2s;
}
.crumb:hover { color: var(--accent); gap: 12px; }

.art-head { max-width: 900px; }
.art-head .tags { margin-bottom: 22px; }
.art-head h1 {
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  letter-spacing: -.035em;
  line-height: 1;
}
.art-head .standfirst {
  margin-top: 22px;
  font-size: clamp(1.2rem, 2.6vw, 1.6rem);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 40ch;
}
.art-meta {
  margin-top: clamp(26px, 4vw, 40px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex; gap: 38px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: .76rem; color: var(--ink-soft);
}
.art-meta .k { display: block; color: var(--muted); font-size: .64rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 5px; }

.art-figure {
  margin: clamp(34px, 6vw, 64px) 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface);
}
.art-figure img { width: 100%; }
.art-figure.pad { padding: clamp(20px, 5vw, 56px); }
.art-figure figcaption {
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .7rem; color: var(--muted);
  letter-spacing: .04em;
}

.art-body {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 720px;
  margin-inline: auto;
}
.art-body h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: -.02em;
  margin: clamp(38px, 5vw, 56px) 0 .5em;
}
.art-body h2:first-child { margin-top: 0; }
.art-body p { margin: 0 0 1.15em; text-wrap: pretty; }
.art-body p.lead { font-size: 1.3rem; line-height: 1.5; color: var(--ink); }
.art-body a { color: var(--accent); text-decoration: none; border-bottom: 1px solid color-mix(in oklab, var(--accent) 35%, transparent); }
.art-body a:hover { border-bottom-color: var(--accent); }
.art-body strong { font-weight: 600; }
.art-body ul { margin: 0 0 1.3em; padding: 0; list-style: none; }
.art-body ul li {
  position: relative;
  padding-left: 26px;
  margin-bottom: .7em;
  line-height: 1.5;
}
.art-body ul li::before {
  content: "";
  position: absolute; left: 4px; top: .72em;
  width: 7px; height: 7px;
  border: 1.5px solid var(--accent);
  transform: rotate(45deg);
}
.art-body ul ul { margin: .6em 0 .2em; }
.art-body ul ul li { color: var(--ink-soft); font-size: .96em; }
.art-body ul ul li::before { background: var(--line-2); border-color: var(--line-2); transform: none; border-radius: 50%; top: .65em; }

.callout {
  margin: clamp(30px, 5vw, 48px) 0;
  padding: clamp(22px, 4vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
}
.callout .ph { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin-bottom: 12px; }

.builtwith {
  margin-top: clamp(40px, 6vw, 64px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.builtwith .ph { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-bottom: 16px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 10px; }
.chiprow a {
  font-family: var(--font-mono); font-size: .78rem;
  border: 1px solid var(--line-2); border-radius: 100px;
  padding: 7px 14px; text-decoration: none; color: var(--ink);
  transition: border-color .2s, color .2s, background .2s;
}
.chiprow a:hover { border-color: var(--accent); color: var(--accent); }

.next-link {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-top: clamp(40px, 6vw, 70px);
  padding: clamp(22px, 4vw, 32px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none; color: inherit;
  background: var(--surface);
  transition: border-color .25s, transform .25s;
}
.next-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.next-link .k { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.next-link h3 { font-size: clamp(1.2rem, 3vw, 1.7rem); letter-spacing: -.02em; }
.next-link:hover h3 { color: var(--accent); }
.next-link .arrow { font-size: 1.6rem; color: var(--accent); flex: none; }
