/* Ledger-page portfolio. The layout borrows from a shopkeeper's khata book:
   a ruled page, a margin column on the left, entries in rows. */

:root {
  --paper: #eef1f7;
  --paper-2: #e3e8f2;
  --ink: #141a2e;
  --muted: #4b5470;
  --line: #c4cbdc;
  --indigo: #3a33b5;
  --indigo-d: #2b258f;
  --margin-red: #c4504d;
  --navy: #0c1426;
  --gold: #e9bf6a;

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

  --margin-w: 190px;
  --gutter: 56px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(58, 51, 181, .05) 31px 32px);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, video { max-width: 100%; display: block; }
a { color: var(--indigo); text-underline-offset: 3px; }
a:hover { color: var(--indigo-d); }
: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; z-index: 50; }
.skip:focus { left: 8px; }

/* Buttons ----------------------------------------------------------------- */
.btn {
  display: inline-block;
  font-family: var(--display); font-weight: 600; font-size: 1rem; line-height: 1;
  padding: 14px 22px; border-radius: 10px;
  background: var(--indigo); color: #fff; border: 2px solid var(--indigo);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--indigo-d); border-color: var(--indigo-d); color: #fff; }
.btn--ghost { background: transparent; color: var(--indigo); }
.btn--ghost:hover { background: var(--indigo); color: #fff; }
.btn--small { padding: 10px 16px; font-size: .94rem; }
.textlink { font-family: var(--display); font-weight: 600; padding: 14px 4px; }

/* Top bar ----------------------------------------------------------------- */
.bar { position: sticky; top: 0; z-index: 20; background: rgba(238, 241, 247, .94); backdrop-filter: blur(8px); 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__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; }
.bar__nav a:hover { 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(48px, 8vw, 104px) clamp(48px, 7vw, 88px); }
.hero h1 {
  font-family: var(--display); font-weight: 800; letter-spacing: -.035em; line-height: .96;
  font-size: clamp(3rem, 8.4vw, 6.4rem); margin: 0 0 28px; text-wrap: balance;
}
.hero__lead { font-size: clamp(1.25rem, 2.2vw, 1.6rem); line-height: 1.4; max-width: 30ch; margin: 0 0 18px; }
.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 cubic-bezier(.2, .8, .25, 1) 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)); } }
}

/* Ledger entries: margin column + body ------------------------------------ */
.entry {
  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__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; padding-right: calc(var(--gutter) / 2);
  border-right: 4px double var(--margin-red); min-height: 3.2em;
}
.entry__body { min-width: 0; max-width: 820px; }
.entry__body > p { max-width: 66ch; }
.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; }
.facts { display: flex; flex-wrap: wrap; gap: 0; margin: 28px 0 0; border: 1px solid var(--ink); border-radius: 10px; background: #f8f9fc; }
.facts > div { flex: 1 1 150px; padding: 12px 16px; border-right: 1px solid var(--line); }
.facts > div:last-child { border-right: 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; }

.role { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; margin: 36px 0 8px; }
.role h4, .sub { font-family: var(--display); font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; margin: 0 0 10px; }
.role ul { margin: 0; padding-left: 1.2em; }
.role li { margin-bottom: 6px; }
.role p { margin: 0; }
.sub { margin-top: 48px; }

.video { margin: 14px 0 0; }
.video video, .video iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 12px; 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; 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%; }
.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; }
.strip button:hover img { transform: translateY(-4px); }
.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 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: 21%; min-width: 150px; }
.ledger td:last-child { white-space: nowrap; color: var(--muted); font-size: .94rem; padding-right: 0; }
.ledger--edu tbody th { width: auto; font-size: 1.1rem; }
.ledger--edu td:first-child { white-space: nowrap; width: 20%; color: var(--ink); font-size: 1rem; }
.ledger--edu .inst { display: block; font-family: var(--text); font-weight: 400; color: var(--muted); font-size: 1rem; }

.limits { margin-top: 36px; padding: 18px 20px; border-left: 4px double var(--margin-red); background: #f8f9fc; border-radius: 0 10px 10px 0; }
.limits h4 { font-family: var(--display); font-size: 1.05rem; font-weight: 800; margin: 0 0 6px; }
.limits p { margin: 0; color: var(--muted); max-width: 70ch; }

/* Contact ----------------------------------------------------------------- */
.mail { margin: 22px 0 10px; 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; }
.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; overflow: auto; }
.lightbox::backdrop { background: rgba(12, 20, 38, .8); }
.lightbox img { width: 100%; max-height: 74vh; object-fit: contain; border-radius: 10px; margin-inline: auto; }
.lightbox p { margin: 12px 4px 4px; font-size: .98rem; line-height: 1.5; }
.lightbox__bar { display: flex; gap: 8px; margin: 0 0 12px; }
.lb-btn { 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: 8px; padding: 9px 16px; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .24); }
.lb-btn:focus-visible { outline-color: var(--gold); }
.lb-btn--close { margin-left: auto; }

/* 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: 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-bottom: 2px; }
  .bar__nav a { white-space: nowrap; }
  html { scroll-padding-top: 112px; }
  .entry { grid-template-columns: 1fr; padding-block: 36px 48px; }
  .entry__margin { position: static; border-right: 0; border-bottom: 4px double var(--margin-red); padding: 0 0 8px; margin-bottom: 22px; min-height: 0; }
  .ruled > div { grid-template-columns: 1fr; gap: 2px; }
  .role { grid-template-columns: 1fr; gap: 24px; }
  .facts > div { border-right: 0; border-bottom: 1px solid var(--line); flex-basis: 100%; }
  .facts > div:last-child { border-bottom: 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 td:last-child { white-space: normal; padding-top: 4px; }
  .ledger tbody th { min-width: 0; }
  .ledger:not(.ledger--edu) td:last-child::before { content: "Shown in: "; }
  .ledger--edu td:last-child::before { content: "Status: "; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
