/* Ledger-page portfolio. The layout borrows from a shopkeeper's khata book:
   a ruled page, a red double margin rule, entries in rows. */

:root {
  --paper: #eef1f7;
  --paper-2: #e3e8f2;
  --card: #f8f9fc;
  --ink: #141a2e;
  --muted: #4b5470;              /* 6.6:1 on paper, 7.1:1 on card */
  --line: #c4cbdc;               /* decorative rules only, never text */
  --indigo: #3a33b5;             /* 8.0:1 on paper */
  --indigo-d: #2b258f;
  --margin-red: #c4504d;         /* the margin rule; decorative */
  --red-ink: #a63c39;            /* red for small text: 5.6:1 on paper */
  --live: #1f7a4d;
  --navy: #0c1426;
  --gold: #e9bf6a;

  --rule: rgba(58, 51, 181, .055);
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .08 0 0 0 0 .1 0 0 0 0 .18 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --text: "Source Serif 4", Georgia, "Times New Roman", serif;

  --margin-w: 190px;
  --gutter: 56px;
  --radius: 12px;
  --ease: cubic-bezier(.2, .8, .25, 1);

  color-scheme: only light;
}

/* Light mode only. "only light" (here and in the meta tag) stops browsers from
   auto-darkening the page and keeps scrollbars, video controls, the dialog and
   form controls light. The dark-scheme block at the end of this file repeats
   the light values for extensions and browsers that ignore it. */
html, body { color-scheme: only light; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(to bottom, transparent 0 31px, var(--rule) 31px 32px),
    var(--grain);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(58, 51, 181, .2); color: var(--ink); }
/* the tilted hero screens can poke out by a pixel or two; clip, don't scroll */
main { overflow-x: clip; }
img, video { max-width: 100%; display: block; }
p, li, dd { text-wrap: pretty; }
a { color: var(--indigo); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--indigo-d); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* Buttons: one radius, one height scale, one lift-and-press motion ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1.2;
  border-radius: var(--radius); border: 2px solid var(--indigo);
  background: var(--indigo); color: #fff;
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease),
              transform .18s var(--ease), box-shadow .18s var(--ease);
}
.btn:hover {
  background: var(--indigo-d); border-color: var(--indigo-d); color: #fff;
  transform: translateY(-2px); box-shadow: 0 12px 22px -14px rgba(43, 37, 143, .8);
}
.btn--ghost { background: var(--card); color: var(--indigo); }
.btn--ghost:hover { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn--small { min-height: 40px; padding: 0 16px; font-size: .94rem; }
.btn:active, .play:active { transform: translateY(0); box-shadow: none; transition-duration: .06s; }
.textlink {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 4px;
  font-family: var(--display); font-weight: 600;
}
.textlink span { transition: transform .18s var(--ease); }
.textlink:hover span { transform: translateX(3px); }

/* Top bar ----------------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(238, 241, 247, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar__in { display: flex; align-items: center; gap: 28px; min-height: 64px; }
.bar__name { font-family: var(--display); font-weight: 800; font-size: 1.1rem; color: var(--ink); text-decoration: none; letter-spacing: -.01em; margin-right: auto; white-space: nowrap; }
.bar__name:hover { color: var(--ink); }
.bar__nav { display: flex; gap: 22px; font-family: var(--display); font-weight: 600; font-size: .95rem; }
.bar__nav a { color: var(--muted); text-decoration: none; padding: 6px 0; border-bottom: 2px solid transparent; transition: color .18s, border-color .18s; }
.bar__nav a:hover, .bar__nav a[aria-current] { color: var(--ink); border-bottom-color: var(--margin-red); }

/* Hero -------------------------------------------------------------------- */
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 48px; align-items: center; padding-block: clamp(44px, 7vw, 96px) clamp(48px, 7vw, 88px); }
.hero__tag {
  display: inline-flex; align-items: center; gap: 9px; margin: 0 0 26px; padding: 6px 14px 6px 11px;
  font-family: var(--display); font-weight: 600; font-size: .9rem; line-height: 1.3;
  color: var(--ink); text-decoration: none; background: var(--card);
  border: 1px solid var(--line); border-radius: 999px;
  transition: border-color .18s, color .18s;
}
.hero__tag:hover { color: var(--ink); border-color: var(--indigo); }
.hero__dot { position: relative; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--live); }
.hero h1 {
  font-family: var(--display); font-weight: 800; letter-spacing: -.035em; line-height: .96;
  font-size: clamp(2.9rem, 8.4vw, 6.4rem); margin: 0 0 28px; text-wrap: balance;
}
.hero__lead { font-size: clamp(1.2rem, 2.2vw, 1.55rem); line-height: 1.42; max-width: 32ch; margin: 0 0 18px; text-wrap: pretty; }
.hero__meta { color: var(--muted); max-width: 46ch; margin: 0 0 32px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; }

.fan { position: relative; aspect-ratio: 1 / 1.12; width: min(100%, 440px); justify-self: end; }
.fan img {
  position: absolute; width: 50%; height: auto; border-radius: 22px; background: var(--navy);
  box-shadow: 0 18px 40px -14px rgba(12, 20, 38, .55); border: 1px solid rgba(12, 20, 38, .5);
}
.fan__a { left: 0; top: 14%; transform: rotate(-7deg); }
.fan__b { right: 0; top: 18%; transform: rotate(7deg); }
.fan__c { left: 25%; top: 0; z-index: 2; }
@media (prefers-reduced-motion: no-preference) {
  .fan img { animation: settle .9s var(--ease) both; }
  .fan__a { --r: -7deg; animation-delay: .05s; }
  .fan__b { --r: 7deg; animation-delay: .15s; }
  .fan__c { --r: 0deg; animation-delay: .25s; }
  @keyframes settle { from { opacity: 0; transform: translateY(28px) rotate(0deg); } to { opacity: 1; transform: translateY(0) rotate(var(--r)); } }
  .hero__dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--live); animation: pulse 2.4s ease-out infinite; }
  @keyframes pulse { from { transform: scale(1); opacity: .5; } to { transform: scale(2.8); opacity: 0; } }
}

/* Ledger entries: margin column + one continuous red double rule ---------- */
.entry {
  position: relative;
  display: grid; grid-template-columns: var(--margin-w) minmax(0, 1fr); column-gap: var(--gutter);
  padding-block: 56px 64px; border-top: 1px solid var(--ink);
}
.entry::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(var(--margin-w) + var(--gutter) / 2 - 2px);
  border-left: 4px double var(--margin-red); opacity: .8; pointer-events: none;
}
.entry__margin {
  font-family: var(--display); font-weight: 800; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.01em; margin: 0;
  align-self: start; position: sticky; top: 92px; text-wrap: balance;
}
.entry__body { min-width: 0; max-width: 820px; }
.entry__body > p { max-width: 66ch; }
.entry__body > :first-child { margin-top: 0; }
.big { font-size: 1.3rem; line-height: 1.5; }
.note { color: var(--muted); font-size: .98rem; font-style: italic; max-width: 66ch; }

/* How I work: ruled definition list */
.ruled { margin: 28px 0 0; border-top: 1px solid var(--line); }
.ruled > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 8px 32px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.ruled dt { font-family: var(--display); font-weight: 600; line-height: 1.35; }
.ruled dd { margin: 0; color: var(--muted); }

/* Project ----------------------------------------------------------------- */
.project__title { font-family: var(--display); font-weight: 800; letter-spacing: -.03em; line-height: 1; font-size: clamp(2.2rem, 5vw, 3.4rem); margin: 0 0 22px; text-wrap: balance; }

/* Store row: Indus (live), Google Play (muted while under review), website */
.store { margin: 28px 0 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 12px 14px; }
.store .play { max-width: 100%; }
.store .store__site { min-height: 60px; }
.play {
  display: inline-flex; align-items: center; gap: 12px; min-height: 60px; padding: 10px 18px 10px 14px;
  border-radius: var(--radius); border: 2px solid var(--navy); background: var(--navy); color: #fff;
  text-decoration: none; line-height: 1.1; -webkit-tap-highlight-color: transparent;
  transition: transform .18s var(--ease), box-shadow .18s var(--ease);
}
.play:hover { color: #fff; transform: translateY(-2px); box-shadow: 0 12px 24px -14px rgba(12, 20, 38, .8); }
.play__icon { flex: none; }
.play__text { display: flex; flex-direction: column; }
.play__small { font-family: var(--display); font-weight: 600; font-size: .78rem; opacity: .85; }
.play__name { font-family: var(--display); font-weight: 800; font-size: 1.3rem; letter-spacing: -.01em; }
.play__badge {
  font-family: var(--display); font-weight: 600; font-size: .8rem; line-height: 1.3; padding: 4px 10px; border-radius: 999px;
  background: var(--gold); color: var(--navy); margin-left: 4px; white-space: nowrap;
}
.play--off, .play--off:hover, .play--off:active {
  background: var(--paper-2); color: var(--muted); border: 2px dashed var(--line);
  cursor: not-allowed; transform: none; box-shadow: none;
}
.play--off .play__icon { filter: grayscale(1); opacity: .55; }
.play--off .play__badge { background: var(--card); border: 1px solid var(--muted); color: var(--ink); }

/* 3 x 2 grid; the dividers only draw between cells (the website cell can be hidden) */
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 28px 0 0; border: 1px solid var(--ink); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.facts > div { padding: 12px 16px; border-right: 1px solid var(--line); border-top: 1px solid var(--line); margin: 0 -1px -1px 0; }
.facts > div:nth-child(-n+3) { border-top: 0; }
.facts dt { font-family: var(--display); font-size: .85rem; color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; font-weight: 600; line-height: 1.35; }
.facts dd a { overflow-wrap: anywhere; }

.principles {
  list-style: none; margin: 0; padding: 0; counter-reset: p;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--ink); border-radius: var(--radius); background: var(--card); overflow: hidden;
}
.principles li { counter-increment: p; padding: 18px 20px 20px; border-right: 1px solid var(--line); }
.principles li:last-child { border-right: 0; }
.principles li::before {
  content: "0" counter(p); display: block; margin-bottom: 8px;
  font-family: var(--display); font-weight: 600; font-size: .8rem; letter-spacing: .08em; color: var(--red-ink);
}
.principles h5 { font-family: var(--display); font-weight: 800; font-size: 1.08rem; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 6px; }
.principles p { margin: 0; color: var(--muted); font-size: .98rem; line-height: 1.55; }

.role { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 48px 0 0; }
.role h4, .sub { font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; line-height: 1.3; margin: 0 0 12px; }
.role ul { margin: 0; padding-left: 1.2em; }
.role li { margin-bottom: 6px; }
.role li::marker { color: var(--red-ink); }
.role p { margin: 0; }
.sub { margin-top: 48px; }
.sub + .note { margin-top: -4px; }

.video { margin: 0; }
.video video, .video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); background: var(--navy); box-shadow: 0 18px 40px -22px rgba(12, 20, 38, .7); }
.video figcaption { color: var(--muted); font-size: .95rem; margin-top: 10px; }

.strip {
  list-style: none; margin: 18px 0 0; padding: 4px 4px 18px; display: flex; gap: 16px; overflow-x: auto;
  scroll-snap-type: x proximity; scroll-padding-inline: 4px; overscroll-behavior-x: contain;
  scrollbar-color: var(--indigo) var(--paper-2);
}
.strip li { flex: 0 0 min(218px, 62vw); scroll-snap-align: start; }
.strip button { all: unset; display: block; cursor: zoom-in; width: 100%; -webkit-tap-highlight-color: transparent; }
.strip button:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; border-radius: 16px; }
.strip img { width: 100%; height: auto; aspect-ratio: 480 / 853; border-radius: 16px; background: var(--navy); box-shadow: 0 12px 28px -14px rgba(12, 20, 38, .6); transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.strip button:hover img { transform: translateY(-4px); box-shadow: 0 18px 32px -16px rgba(12, 20, 38, .7); }
.strip span { display: block; margin-top: 10px; font-family: var(--display); font-weight: 600; font-size: .92rem; line-height: 1.3; }

/* Tables as ledgers */
.tablewrap { overflow-x: auto; margin-top: 16px; }
.ledger { width: 100%; border-collapse: collapse; font-size: 1rem; }
.ledger th, .ledger td { text-align: left; vertical-align: top; padding: 13px 16px 13px 0; border-bottom: 1px solid var(--line); line-height: 1.5; }
.ledger td:last-child { padding-right: 0; }
.ledger thead th { font-family: var(--display); font-size: .88rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--ink); padding-top: 4px; }
.ledger tbody th { font-family: var(--display); font-weight: 600; width: 26%; min-width: 150px; }
.ledger--edu tbody th { width: auto; font-size: 1.1rem; }
.ledger--edu td:first-child { white-space: nowrap; width: 20%; }
.ledger--edu td:last-child { white-space: nowrap; color: var(--muted); font-size: .94rem; }
.ledger--edu .inst { display: block; font-family: var(--text); font-weight: 400; color: var(--muted); font-size: 1rem; }

/* Contact ----------------------------------------------------------------- */
.mail { margin: 22px 0 12px; font-family: var(--display); font-weight: 800; letter-spacing: -.02em; font-size: clamp(1.5rem, 4.4vw, 2.6rem); line-height: 1.1; overflow-wrap: anywhere; }
.mail a { text-decoration-thickness: 2px; text-underline-offset: 6px; }
.mail a:hover { text-decoration-thickness: 3px; }
.contact { list-style: none; padding: 0; margin: 0 0 28px; }
.contact li { padding: 4px 0; }
.contact .k { display: inline-block; min-width: 6.5em; font-family: var(--display); font-weight: 600; color: var(--muted); }
[hidden] { display: none !important; }

.foot { border-top: 1px solid var(--ink); padding-block: 26px 48px; color: var(--muted); font-size: .94rem; }
.foot p { margin: 0; }

/* Lightbox ---------------------------------------------------------------- */
.lightbox { border: 0; padding: 16px; background: var(--navy); color: #fff; border-radius: 18px; width: min(560px, 94vw); max-height: 94vh; max-height: 94dvh; overflow: auto; overscroll-behavior: contain; }
.lightbox::backdrop { background: rgba(12, 20, 38, .82); }
.lightbox img { width: 100%; max-height: 72vh; max-height: 72dvh; object-fit: contain; border-radius: 10px; margin-inline: auto; touch-action: pan-y pinch-zoom; }
.lightbox p { margin: 12px 4px 4px; font-size: .98rem; line-height: 1.5; }
.lightbox__bar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.lb-btn {
  min-width: 44px; min-height: 44px; padding: 0 16px;
  font-family: var(--display); font-weight: 600; font-size: 1rem; color: #fff;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; cursor: pointer;
  transition: background-color .18s;
}
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-btn:focus-visible { outline-color: var(--gold); }
.lb-btn--close { margin-left: auto; }
.lb-count { margin-left: 4px; font-family: var(--display); font-weight: 600; font-size: .9rem; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .lightbox[open] { animation: lb-in .22s var(--ease); }
  .lightbox[open]::backdrop { animation: fade .22s ease-out; }
  @keyframes lb-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
  @keyframes fade { from { opacity: 0; } }
}

/* Responsive -------------------------------------------------------------- */
@media (max-width: 960px) {
  :root { --margin-w: 150px; --gutter: 40px; }
  .hero { grid-template-columns: 1fr; }
  .fan { justify-self: start; width: min(100%, 380px); }
}
@media (max-width: 860px) {
  .principles { grid-template-columns: 1fr; }
  .principles li { border-right: 0; border-bottom: 1px solid var(--line); }
  .principles li:last-child { border-bottom: 0; }
}
@media (max-width: 760px) {
  body { font-size: 1.02rem; }
  .bar__in { flex-wrap: wrap; gap: 6px 16px; padding-block: 10px; }
  .bar__nav {
    order: 3; flex: 1 0 100%; overflow-x: auto; gap: 18px; padding: 0 28px 2px 0; scrollbar-width: none;
    /* fade the right edge so the row reads as scrollable */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .bar__nav::-webkit-scrollbar { display: none; }
  .bar__nav a { white-space: nowrap; }
  html { scroll-padding-top: 112px; }
  .entry { grid-template-columns: 1fr; padding-block: 36px 48px; }
  .entry::before { display: none; }
  .entry__margin { position: static; border-bottom: 4px double var(--margin-red); padding: 0 0 8px; margin-bottom: 22px; }
  .big { font-size: 1.2rem; }
  .ruled > div { grid-template-columns: 1fr; gap: 2px; }
  .role { grid-template-columns: 1fr; gap: 24px; }
  .facts { grid-template-columns: 1fr; }
  .facts > div, .facts > div:nth-child(-n+3) { border-right: 0; border-top: 1px solid var(--line); margin: 0; }
  .facts > div:first-child { border-top: 0; }
  .ledger thead { display: none; }
  .ledger, .ledger tbody, .ledger tr, .ledger th, .ledger td { display: block; width: 100% !important; }
  .ledger tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  .ledger th, .ledger td { border: 0; padding: 2px 0; }
  .ledger tbody th { min-width: 0; }
  .ledger--edu td:first-child { color: var(--muted); font-size: .94rem; }
  .ledger--edu td:last-child { white-space: normal; padding-top: 4px; }
  .ledger--edu td:last-child::before { content: "Status: "; }
}
@media (max-width: 640px) {
  .store { flex-direction: column; gap: 12px; }
  .store .play, .store .store__site { width: 100%; min-height: 62px; }
  .store .play { display: flex; padding: 10px 16px; }
  .play__text { white-space: nowrap; }
  .play__badge { margin-left: auto; }
  .lightbox { padding: 12px; }
}
/* Small phones: tighten the pills so the status badge still fits on the same line */
@media (max-width: 380px) {
  .bar__in { column-gap: 10px; }
  .bar__name { font-size: 1rem; }
  .bar .btn--small { min-height: 38px; padding: 0 12px; font-size: .9rem; }
  .store .play { gap: 10px; padding-inline: 12px; }
  .play__badge { font-size: .74rem; padding: 3px 8px; }
  .lb-btn { padding: 0 12px; }
}
/* Very narrow phones: scale the store labels down so every pill keeps one line */
@media (max-width: 340px) {
  .store .play { gap: 8px; padding-inline: 10px; }
  .play__icon { width: 24px; height: 24px; }
  .play__name { font-size: 1.12rem; }
  .play__badge { padding: 3px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Light-mode lock: the same light values again under a dark system setting.
   It sits last so it wins over anything above; keep it identical to :root. */
@media (prefers-color-scheme: dark) {
  :root, :root:not([data-theme="light"]), :root[data-theme="dark"] {
    --paper: #eef1f7;
    --paper-2: #e3e8f2;
    --card: #f8f9fc;
    --ink: #141a2e;
    --muted: #4b5470;
    --line: #c4cbdc;
    --indigo: #3a33b5;
    --indigo-d: #2b258f;
    --margin-red: #c4504d;
    --red-ink: #a63c39;
    --live: #1f7a4d;
    --navy: #0c1426;
    --gold: #e9bf6a;
    --rule: rgba(58, 51, 181, .055);
    color-scheme: only light;
  }
  html { background-color: #eef1f7; color-scheme: only light; }
  body { background-color: #eef1f7; color: #141a2e; color-scheme: only light; }
  .bar { background: rgba(238, 241, 247, .92); border-bottom-color: #c4cbdc; }
  .facts, .principles, .hero__tag { background: #f8f9fc; }
  .ledger, .ledger th, .ledger td { color: #141a2e; background-color: transparent; }
  .lightbox { background: #0c1426; color: #fff; }
  input, textarea, select, button, video, svg { color-scheme: only light; }
}
