@charset "UTF-8";
/* =========================================================================
   sohamdeshpande.in
   Dark and warm by default. Light is the same warmth inverted.
   Single column, serif body, nothing between the reader and the writing.
   ====================================================================== */

/* -------------------------------------------------------------- fonts  */
/* Self-hosted. No third-party request, no privacy leak.
   Roman + UI sans are preloaded; italic and mono are declared here but the
   browser only fetches them if a page actually renders a glyph in them.   */

@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("../fonts/newsreader-italic.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

/* ------------------------------------------------------------- tokens  */

:root {
  /* warm near-black — never blue-black */
  --bg:            #14110F;
  --bg-elevated:   #1C1814;
  --bg-code:       #1A1613;

  /* warm off-white — never pure white, it glares in the dark */
  --text:          #EDE4D7;
  --text-muted:    #A2968A;
  --text-faint:    #6E645B;

  /* ember accent — links, rules, marks */
  --accent:        #E0A458;
  --accent-hover:  #F0BC7A;
  --accent-deep:   #B5613C;

  --rule:          #2A241E;
  --selection:     #3A2E22;

  /* Derived, not a new colour: --text mixed into --bg at the lowest ratio
     that still clears WCAG AA (4.5:1) for small text. The locked --text-faint
     measures 3.26:1 on --bg, which is fine for a rule or a separator but not
     for a date, a caption or a tag, so those use this instead. */
  --text-quiet:    #8B857D; /* fallback for browsers without color-mix */
  --text-quiet:    color-mix(in srgb, var(--text) 55%, var(--bg)); /* 5.16:1 */

  /* type */
  /* Every multi-word family is quoted. "Source Serif 4" MUST be: an unquoted
     family name is a sequence of CSS identifiers, and "4" is not a valid
     identifier, which makes the whole font-family declaration invalid and
     silently drops the page to the browser's default serif. */
  --serif: "Newsreader", "Iowan Old Style", "Source Serif 4", Georgia, Cambria, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --size-body:  clamp(1.0625rem, 1.0rem + 0.30vw, 1.1875rem); /* 17 → 19px */
  --leading:    1.75;
  --measure:    41rem;   /* ~656px, about 68 characters at this size */
  --measure-wide: 52rem;

  --gutter:     1.25rem;
  --rhythm:     1.65em;

  --radius:     3px;
  --focus:      var(--accent);

  color-scheme: dark;
}

/* Light is the same warmth inverted — warm paper, warm ink, same ember.
   Dark is the default and the identity, unconditionally: the system's
   preference is deliberately NOT consulted. A reader whose laptop is set to
   light would otherwise never see what this site actually looks like. The
   toggle is the only thing that changes it, and it remembers. */
:root[data-theme="light"] {
  --bg:          #F7F2EA;
  --bg-elevated: #FFFBF4;
  --bg-code:     #F0E9DE;
  --text:        #221D18;
  --text-muted:  #5E544A;
  --text-faint:  #8A7E71;
  --accent:      #9A5A1E;
  --accent-hover:#7A4614;
  --accent-deep: #B5613C;
  --rule:        #E2D8C8;
  --selection:   #EEDCC0;
  --text-quiet:  #6D6862;
  --text-quiet:  color-mix(in srgb, var(--text) 65%, var(--bg)); /* 4.98:1 */
  color-scheme: light;
}

/* -------------------------------------------------------------- reset  */

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-size: var(--size-body);
  line-height: var(--leading);
  font-weight: 400;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: oldstyle-nums;
}

::selection { background: var(--selection); color: var(--text); }

img, svg, video { max-width: 100%; height: auto; display: block; }

/* ------------------------------------------------------------- layout  */

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--wide { max-width: var(--measure-wide); }

.site {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.site-main { flex: 1 0 auto; }

/* --------------------------------------------------------------- skip  */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--bg-elevated);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.875rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ------------------------------------------------------------- header  */
/* Chrome recedes. Small, muted, never sticky.                            */

.site-header {
  padding-block: 2.25rem 1.5rem;
}

.site-header__inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-title {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
}
.site-title a { color: var(--text); text-decoration: none; background: none; }
.site-title a:hover { color: var(--accent); }

.site-nav ul {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}
.site-nav a {
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  padding-block: 0.15rem;
}
.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav [aria-current="page"] { color: var(--accent); }

/* ------------------------------------------------------- theme toggle  */

.theme-toggle {
  appearance: none;
  background: none;
  border: 0;
  padding: 0.25rem;
  margin: 0;
  cursor: pointer;
  color: var(--text-quiet);
  line-height: 0;
  border-radius: var(--radius);
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 1rem; height: 1rem; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* ---------------------------------------------------------- typography */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.011em;
  text-wrap: balance;
  margin: 2.4em 0 0.6em;
  color: var(--text);
}
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.35rem); margin-top: 0; letter-spacing: -0.018em; }
h2 { font-size: clamp(1.35rem, 1.2rem + 0.7vw, 1.6rem); }
h3 { font-size: clamp(1.15rem, 1.08rem + 0.35vw, 1.3rem); }
h4 { font-size: 1.0625rem; }
h5, h6 { font-size: 1rem; font-family: var(--sans); font-weight: 600; color: var(--text-muted); }

p { margin: 0 0 var(--rhythm); text-wrap: pretty; }

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--accent) 42%, transparent);
  transition: color 120ms ease, text-decoration-color 120ms ease;
}
a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

strong { font-weight: 600; color: var(--text); }
em { font-style: italic; }
del { color: var(--text-quiet); }
small { font-size: 0.875em; color: var(--text-muted); }

mark {
  background: var(--selection);
  color: var(--text);
  padding: 0.05em 0.2em;
  border-radius: 2px;
}

abbr[title] { text-decoration: underline dotted; cursor: help; }

hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: 3rem auto;
  width: 100%;
}

blockquote {
  margin: var(--rhythm) 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent-deep);
  color: var(--text-muted);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }
blockquote cite { display: block; font-style: normal; font-family: var(--sans); font-size: 0.8125rem; color: var(--text-quiet); margin-top: 0.5rem; }

ul, ol { margin: 0 0 var(--rhythm); padding-left: 1.4rem; }
li { margin-bottom: 0.4em; }
li > ul, li > ol { margin-top: 0.4em; margin-bottom: 0.2em; }
ul li::marker { color: var(--accent-deep); }
ol li::marker { color: var(--text-quiet); font-family: var(--sans); font-size: 0.85em; }

dl { margin: 0 0 var(--rhythm); }
dt { font-weight: 600; }
dd { margin: 0 0 0.8em; color: var(--text-muted); }

/* --------------------------------------------------------------- code  */

code, kbd, samp {
  font-family: var(--mono);
  font-size: 0.855em;
  font-variant-ligatures: none;
}

:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 0.12em 0.34em;
  color: var(--text);
  word-break: break-word;
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin: var(--rhythm) 0;
  overflow-x: auto;
  line-height: 1.6;
  font-size: 0.9375rem;
  tab-size: 2;
}
pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: 1em;
  color: var(--text);
}

kbd {
  background: var(--bg-elevated);
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: var(--radius);
  padding: 0.1em 0.35em;
  font-size: 0.8em;
}

/* ------------------------------------------------------------- tables  */

.table-wrap { overflow-x: auto; margin: var(--rhythm) 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule);
}
th {
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
tbody tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------ figures  */

figure { margin: 2rem 0; }
figure img { border-radius: var(--radius); }
figcaption {
  margin-top: 0.7rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-quiet);
  text-align: left;
}

.post-cover { margin: 0 0 2.5rem; }

/* --------------------------------------------------------------- home  */

.intro {
  margin-block: 0.5rem 3.5rem;
}
.intro__name {
  margin: 0 0 0.9rem;
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.1rem);
  letter-spacing: -0.018em;
}
.intro__bio {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02em;
}
.intro__bio a { color: var(--text-muted); text-decoration-color: color-mix(in srgb, var(--text-muted) 40%, transparent); }
.intro__bio a:hover { color: var(--accent); }

.section { margin-block: 3rem; }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
}
.section__title {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-quiet);
}
.section__more {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-decoration: none;
}
.section__more:hover { color: var(--accent); }

/* --------------------------------------------------------------- tiles */
/* The way in to /writing by theme. A collection is a tag that accumulated
   enough to be worth a door. Outlined, not filled — they introduce the
   writing rather than compete with it. */

.tiles { margin: 0 0 3rem; }
.tiles ul {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
@media (min-width: 34em) {
  .tiles ul { grid-template-columns: 1fr 1fr; }
}

/* On the home page the collections ARE the page, so they get more room and
   the handwriting is allowed to be the thing you notice. */
.tiles--home { margin-top: 2.5rem; }
.tiles--home .tile__link { padding: 1.3rem 1.35rem 1.15rem; gap: 0.45rem; }
.tiles--home .tile__name { font-size: 1.2rem; }
.tiles--home .tile__name--ink .title-ink img { max-height: 3rem; }
.tiles--home .tile__desc { font-size: 0.94rem; }

.tile__link {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  height: 100%;
  padding: 0.95rem 1.05rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 140ms ease, background-color 140ms ease;
}
.tile__link:hover {
  border-color: var(--accent-deep);
  background: var(--bg-elevated);
}

.tile__name {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}
.tile__link:hover .tile__name { color: var(--accent); }

/* A handwritten collection title sits in the same box as a typeset one. */
.tile__name--ink { display: block; }
.tile__name--ink .title-ink { max-width: 100%; }
.tile__name--ink .title-ink img { max-height: 2.2rem; }
.tile__link:hover .tile__name--ink .sketchnote__ink { background-color: var(--accent); }

.tile__desc {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-muted);
}
.tile--empty .tile__link { border-style: dashed; opacity: 0.62; }
.tile--empty .tile__n { color: var(--accent-deep); }

.tile__n {
  margin-top: auto;
  padding-top: 0.35rem;
  font-family: var(--sans);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.intro__more {
  margin: 2rem 0 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
}
.intro__more a { color: var(--text-muted); text-decoration: none; }
.intro__more a:hover { color: var(--accent); }

/* A note in the feed is an aside, not an essay. */
.post-row--note .post-row__title,
.post-row--sketchnote .post-row__title { color: var(--text-muted); }

/* --------------------------------------------------------------- chips */
/* Labels, not sections. Muted until chosen; the feed underneath stays whole. */

.chips { margin: -0.5rem 0 2rem; }
.chips ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--text-quiet);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.22rem 0.65rem;
  transition: color 120ms ease, border-color 120ms ease;
}
.chip:hover { color: var(--accent); border-color: var(--accent-deep); }
.chip--on {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.chip--on:hover { color: var(--bg); background: var(--accent-hover); border-color: var(--accent-hover); }

.chip__n {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.65;
}

/* ---------------------------------------------------------- post list  */

.post-list { list-style: none; margin: 0; padding: 0; }

.post-row { margin-bottom: 0.2rem; }

.post-row__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.5rem;
  color: var(--text);
  text-decoration: none;
}
.post-row__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: transparent;
  transition: text-decoration-color 120ms ease, color 120ms ease;
}
.post-row__link:hover .post-row__title {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.post-row__date {
  flex: none;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.post-row__summary {
  margin: 0 0 0.8rem;
  font-size: 0.94em;
  color: var(--text-muted);
}

/* --------------------------------------------------------------- post  */

.post-header { margin-bottom: 2.5rem; }
.post-title { margin: 0 0 0.75rem; }

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  font-variant-numeric: tabular-nums;
}
.post-meta .sep { color: var(--rule); }

.post-body > *:first-child { margin-top: 0; }
.post-body > *:last-child { margin-bottom: 0; }

/* Code blocks and figures may break the reading column. */
.post-body > pre,
.post-body > figure,
.post-body > .table-wrap {
  width: min(var(--measure-wide), calc(100vw - 2 * var(--gutter)));
  margin-inline: calc(50% - min(var(--measure-wide), 100vw - 2 * var(--gutter)) / 2);
}

.post-footer {
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--rule);
}

.post-tags ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.post-tags a {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--text-quiet);
  text-decoration: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.18rem 0.6rem;
}
.post-tags a:hover { color: var(--accent); border-color: var(--accent-deep); }

.post-nav {
  display: grid;
  gap: 1.25rem;
  margin-top: 2.5rem;
}
@media (min-width: 40em) {
  .post-nav { grid-template-columns: 1fr 1fr; }
  .post-nav__link--next { text-align: right; }
  .post-nav__link--next:only-child { grid-column: 2; }
}
.post-nav__link { text-decoration: none; color: var(--text); display: block; }
.post-nav__label {
  display: block;
  font-family: var(--sans);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-quiet);
  margin-bottom: 0.3rem;
}
.post-nav__title { font-size: 0.98em; line-height: 1.45; }
.post-nav__link:hover .post-nav__title { color: var(--accent); }

/* --------------------------------------------------------------- work  */
/* The one professional page. Same palette, same fonts, same column — the
   restraint is in the spacing and in what is absent, not in a second skin. */

.work {
  --rhythm: 1.15em;
}

.work__header { margin-bottom: 2rem; }

.work__standfirst {
  margin: 0.75rem 0 0;
  color: var(--text-muted);
  font-size: 1.02em;
  max-width: 34rem;
}

/* Sections sit closer together than in an essay, and each one announces
   itself with a rule rather than with size. */
.work .post-body h2 {
  margin: 2.6em 0 0.9em;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-quiet);
}
.work .post-body h2:first-child { margin-top: 0; }

/* A role. The line under it is scope and dates, not prose. */
.work .post-body h3 {
  margin: 1.8em 0 0.15em;
  font-size: 1.08rem;
  font-weight: 600;
}
.work .post-body h3 + p {
  margin-bottom: 0.55em;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  font-variant-numeric: tabular-nums;
}
.work .post-body h3 + p em { font-style: normal; }

.work .post-body ul { margin-bottom: 1.1em; }
.work .post-body li { margin-bottom: 0.22em; }

/* Nothing on this page pulls the eye away from the text. */
.work .post-body blockquote {
  border-left-color: var(--rule);
  font-style: normal;
  color: var(--text-muted);
}

/* -------------------------------------------------------- sketchnotes  */
/* The paper is gone. The processed asset carries the ink in its alpha
   channel; the ink itself is painted with a theme token through a mask, so
   the handwriting takes the site's own text colour — warm off-white on dark,
   warm dark on paper-light — as if drawn straight onto the page.
   The <img> underneath holds the layout box and the alt text, and is what
   shows if masking is unsupported. */

.sketchnote { margin: 2.5rem 0; }

.sketchnote__frame {
  position: relative;
  display: block;
}
.sketchnote__frame img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}
.sketchnote__ink {
  display: none;
  position: absolute;
  inset: 0;
  background-color: var(--text);
  pointer-events: none;
}

@supports (mask-image: url("i.png")) or (-webkit-mask-image: url("i.png")) {
  .sketchnote__frame img { opacity: 0; }
  .sketchnote__ink {
    display: block;
    -webkit-mask-image: var(--sketch-src);
            mask-image: var(--sketch-src);
    -webkit-mask-size: 100% 100%;
            mask-size: 100% 100%;
    -webkit-mask-repeat: no-repeat;
            mask-repeat: no-repeat;
  }
}

/* The zoom trigger wraps the frame. A real button, so it is keyboard
   reachable and announced; the cursor is the only affordance on screen. */
.sketchnote__zoom {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  border-radius: var(--radius);
}
.sketchnote__zoom:hover .sketchnote__ink { background-color: var(--accent-hover); }

/* ------------------------------------------------------------ backdrop */
/* A drawing behind the page, painted with the text colour at a few percent.
   Fixed, silent, and never in front of anything. */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--text);
  opacity: var(--backdrop-opacity, 0.05);
  -webkit-mask-image: var(--backdrop-src);
          mask-image: var(--backdrop-src);
  -webkit-mask-size: cover;
          mask-size: cover;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}

/* No mask support means no backdrop rather than a full-bleed photograph
   sitting on top of the writing. */
@supports not ((mask-image: url("i.png")) or (-webkit-mask-image: url("i.png"))) {
  .backdrop { display: none; }
}

/* -------------------------------------------------------------- motifs */
/* Soham's glyphs down both margins. The columns are sized against the WIDE
   measure, not the reading measure, so a sketchnote or code block breaking
   out to full width still clears them with the gap intact. Below the width
   where that holds, they are removed rather than squeezed. */

:root {
  --motif-gap: 3rem;          /* clear space between content and glyphs */
  --motif-opacity: 0.20;      /* bolder than the backdrop; still margin decor */
}

.motifs {
  position: fixed;
  top: 0;
  bottom: 0;
  width: calc((100vw - var(--measure-wide)) / 2 - var(--motif-gap));
  max-width: 13rem;
  z-index: -1;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-around;
  padding-block: 4rem;
  opacity: var(--motif-opacity);
}
.motifs--left  { left: 0; }
.motifs--right { right: 0; }

.motif {
  display: block;
  width: min(6.5rem, 70%);
  aspect-ratio: 1;
  background-color: var(--text);
  -webkit-mask-image: var(--sketch-src);
          mask-image: var(--sketch-src);
  -webkit-mask-size: contain;
          mask-size: contain;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
}

/* Not enough room to keep the gap honest — take them away entirely rather
   than let them creep towards the writing. */
@media (max-width: 1150px) {
  .motifs { display: none; }
}
@supports not ((mask-image: url("i.png")) or (-webkit-mask-image: url("i.png"))) {
  .motifs { display: none; }
}

/* ---------------------------------------------------------- home page  */

.intro--home {
  display: grid;
  gap: 1.75rem 2.5rem;
  align-items: start;
  margin-block: 1rem 3rem;
}
@media (min-width: 40em) {
  .intro--home { grid-template-columns: 1fr auto; }
}

.intro__statement {
  font-size: 1.06em;
  line-height: 1.65;
  max-width: 34rem;
}
.intro__statement p { margin-bottom: 0.9em; }
.intro__statement p:last-child { margin-bottom: 0; }

.intro__portrait { justify-self: start; }
.portrait { display: block; width: 8.5rem; max-width: 30vw; }
.portrait img { width: 100%; height: auto; border-radius: 0; }

/* Three chosen pieces. Deliberately not the same markup as a feed row —
   the home page showing a shorter copy of the archive was the whole
   problem with the first version. */
.highlights { margin-block: 2.5rem 2rem; }
.highlights__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}
.highlight__link {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 140ms ease, background-color 140ms ease;
}
.highlight__link:hover { border-color: var(--accent-deep); background: var(--bg-elevated); }
.highlight__title { font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.highlight__link:hover .highlight__title { color: var(--accent); }
.highlight__summary { color: var(--text-muted); font-size: 0.95rem; line-height: 1.55; }
.highlight__date {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--text-quiet);
  font-variant-numeric: tabular-nums;
}

.right-now {
  margin: 0 0 3rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  font-style: normal;
}

/* -------------------------------------------------------------- timeline */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

/* The thread. Sits behind the markers, down the middle of that column, and
   stops short at both ends so it reads as a span of time rather than a rule
   running off the page. */
.timeline::before {
  content: "";
  position: absolute;
  top: 2.2rem;
  bottom: 2.2rem;
  left: 2.25rem;
  width: 1px;
  background: var(--rule);
}
.timeline--life::before { left: 3.5rem; }

.tl {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 1.35rem;
  padding-block: 1.8rem;
  border-bottom: 1px solid var(--rule);
}
.tl:last-child { border-bottom: 0; }

.tl__mark {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 0.3rem;
  min-height: 2.6rem;
  position: relative;
  z-index: 1;
}
/* Punch the thread out behind a mark so the line does not run through it. */
.tl__mark::before {
  content: "";
  position: absolute;
  inset: -0.35rem -0.3rem;
  background: var(--bg);
  z-index: -1;
}
/* Normalise on height, not width: a wide wordmark and a square mark are
   very different shapes, and matching their widths makes the wordmark tiny. */
.tl__logo { display: inline-block; max-width: 100%; }
.tl__logo img { width: auto; max-width: 100%; max-height: 2.6rem; height: auto; border-radius: 0; }
/* The slot stays visible even when the photograph itself is dark — a black
   image on a near-black page otherwise reads as a missing file. */
.tl__photo {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  background: var(--bg-elevated);
}
.tl__dot {
  width: 0.5rem; height: 0.5rem;
  border-radius: 50%;
  background: var(--accent-deep);
  margin-top: 0.55rem;
}

.tl__period {
  margin: 0 0 0.15rem;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--text-quiet);
  font-variant-numeric: tabular-nums;
}
.tl__org { margin: 0 0 0.1rem; font-size: 1.05rem; font-weight: 600; }
.tl__role { margin: 0 0 0.25rem; font-size: 0.98rem; color: var(--text); }
.tl__where {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--text-quiet);
}
.tl__text {
  margin: 0.55rem 0 0;
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.62;
  max-width: 34rem;
}

.timeline--life .tl { grid-template-columns: 7rem 1fr; align-items: start; }
.timeline--life .tl__mark { padding-top: 0.35rem; }
.timeline--life .tl__photo { border-radius: var(--radius); }

/* A lede is the page's opening, not its body: slightly larger, and it stops
   before the measure so it reads as a statement. */
.post-body--lede {
  font-size: 1.04em;
  max-width: 36rem;
  color: var(--text);
}
.post-body--lede p:last-child { margin-bottom: 0; }

.section--timeline { margin-top: 3rem; }

/* The writing index announces itself quietly, like a section label. */
h1.section__title { margin: 0; }

@media (max-width: 30em) {
  .tl { grid-template-columns: 3.25rem 1fr; gap: 0 1rem; }
  .timeline--life .tl { grid-template-columns: 4.5rem 1fr; }
}

/* The latest piece behind a collection, shown on /writing. */
.tile__latest {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
}
.tile__latest-label {
  font-family: var(--sans);
  font-size: 0.6875rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-quiet);
}

.site-footer__contact {
  margin: 0 0 1.25rem;
  max-width: 34rem;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* ------------------------------------------------- handwritten titles  */
/* Scanned handwriting, ink-extracted, painted with a theme token — the same
   pipeline as a sketchnote applied to a title or a name. The <img> carries
   the real words as alt text, so nothing is lost to search or a screen
   reader; only the rendering is handwritten. */

.post-title--ink { margin-bottom: 0.9rem; }

.title-ink {
  /* inline-block, NOT block: the mask layer is inset:0 on this element, so a
     full-width box stretches a narrow word ("AI") across the whole column and
     clips it. Shrink-wrapping to the image keeps the mask aligned. */
  display: inline-block;
  max-width: min(100%, 30rem);
}
.title-ink img {
  width: auto;
  max-width: 100%;
  max-height: 5.5rem;
  border-radius: 0;
}
@media (max-width: 26em) {
  .title-ink img { max-height: 4rem; }
}

/* A handwritten name in the header sits on the sans baseline, so it has to
   be small and optically aligned rather than matched to the cap height. */
.wordmark {
  display: inline-block;
  vertical-align: -0.35em;
}
.wordmark img {
  width: auto;
  max-height: 1.7rem;
  border-radius: 0;
}
.site-title a:hover .wordmark .sketchnote__ink { background-color: var(--accent); }

/* ---------------------------------------------------------- lightbox  */
/* The one modal on this site. */

.lightbox {
  border: 0;
  padding: 0;
  max-width: min(94vw, 1100px);
  max-height: 94vh;
  width: auto;
  background: var(--bg);
  color: var(--text);
  overflow: auto;
  border-radius: var(--radius);
}
.lightbox::backdrop { background: rgb(0 0 0 / 0.82); }

.lightbox__figure { margin: 0; padding: 1.5rem 1.5rem 1.25rem; }
.lightbox__frame { max-height: 78vh; }
.lightbox__frame img { max-height: 78vh; width: auto; margin-inline: auto; }
.lightbox__caption {
  margin-top: 0.9rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  max-width: 44rem;
}

.lightbox__close {
  position: sticky;
  top: 0.5rem;
  left: 100%;
  appearance: none;
  background: none;
  border: 0;
  padding: 0.5rem;
  margin: 0.25rem 0.25rem -2.25rem 0;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 0;
  z-index: 1;
}
.lightbox__close:hover { color: var(--accent); }
.lightbox__close svg { width: 1.15rem; height: 1.15rem; display: block; }

/* --------------------------------------------------- sketchnote index  */

.sketch-archive { display: block; }

.sketch-entry {
  margin-bottom: 4rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--rule);
}
.sketch-entry:last-child { border-bottom: 0; }

.sketch-entry__title {
  margin: 0 0 0.2rem;
  font-size: clamp(1.15rem, 1.05rem + 0.4vw, 1.3rem);
}
.sketch-entry__title a { color: var(--text); text-decoration: none; }
.sketch-entry__title a:hover { color: var(--accent); }

.sketch-entry__date {
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  margin-bottom: 0.5rem;
}
.sketch-entry__body > *:first-child { margin-top: 0; }
.sketch-entry__body .sketchnote { margin-top: 1.25rem; }

/* --------------------------------------------------------------- notes  */
/* Short form. Posting one should feel as cheap as posting a story, so they
   render in full here rather than as a list of links to click through. */

.notes { margin-top: 1rem; }

.note {
  display: grid;
  gap: 0.15rem 1.5rem;
  padding-block: 1.6rem;
  border-bottom: 1px solid var(--rule);
}
.note:last-child { border-bottom: 0; }

.note__date {
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.note__title {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
}
.note__title a { color: var(--text); text-decoration: none; }
.note__title a:hover { color: var(--accent); }

.note__body > *:first-child { margin-top: 0; }
.note__body > *:last-child { margin-bottom: 0; }
.note__body p { margin-bottom: 0.8em; }
.note__body figure { margin: 1rem 0 0; }

@media (min-width: 46em) {
  .note { grid-template-columns: 6.5rem 1fr; }
  .note__date { padding-top: 0.35em; text-align: right; }
}

/* ---------------------------------------------------------- pagination */

.pagination {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: 3rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
}
.pagination .page-numbers {
  padding: 0.3rem 0.6rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius);
}
.pagination .page-numbers:hover { color: var(--accent); }
.pagination .page-numbers.current { color: var(--text); background: var(--bg-elevated); }

/* ------------------------------------------------------------- footer  */

.site-footer {
  margin-top: 5rem;
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 0.8125rem;
  color: var(--text-quiet);
}
.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a { color: var(--text-muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer ul {
  display: flex;
  gap: 1rem;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

/* ---------------------------------------------------------------- 404  */

.notice-page { padding-block: 3rem 5rem; }
.notice-page h1 { margin-bottom: 0.75rem; }
.notice-page p { color: var(--text-muted); }

/* ------------------------------------------------------- accessibility */

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
:focus:not(:focus-visible) { outline: none; }

.screen-reader-text {
  border: 0;
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (prefers-contrast: more) {
  :root { --text-muted: var(--text); --text-faint: var(--text); --text-quiet: var(--text); }
  a { text-decoration-color: currentColor; }
}

/* -------------------------------------------------------------- 375px  */

@media (max-width: 26em) {
  :root { --gutter: 1.1rem; --rhythm: 1.5em; }
  .site-header { padding-block: 1.75rem 1.25rem; }
  .site-header__inner { gap: 0.6rem; }
  .post-row__link { flex-direction: column; gap: 0.1rem; padding-block: 0.45rem; }
  .post-row__date { order: -1; font-size: 0.75rem; }
  .intro { margin-bottom: 2.5rem; }
  blockquote { padding-left: 1rem; }
  pre { padding: 0.85rem 0.9rem; font-size: 0.875rem; }
  th, td { padding: 0.45rem 0.5rem; }
}
