/* ==========================================================================
   Abhijit Deshpande — shared stylesheet (design "B: field journal")
   Fonts are self-hosted from assets/fonts (SIL Open Font License, see OFL-*.txt).
   No third-party requests are made by this stylesheet.
   Colours follow the visitor's light or dark setting (prefers-color-scheme).
   ========================================================================== */

@font-face { font-family: 'DM Sans'; src: url('fonts/dm-sans-roman.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('fonts/playfair-display-roman.woff2') format('woff2'); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('fonts/playfair-display-italic.woff2') format('woff2'); font-weight: 400 600; font-style: italic; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('fonts/dm-mono-400.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'DM Mono'; src: url('fonts/dm-mono-500.woff2') format('woff2'); font-weight: 500; font-style: normal; font-display: swap; }

/* ---------- Design tokens ---------- */
:root {
  color-scheme: light dark;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --serif: 'Playfair Display', Georgia, 'Times New Roman', serif;
  --mono: 'DM Mono', ui-monospace, Menlo, Consolas, monospace;
  --bg: #f1f4f3;
  --surface: #ffffff;
  --side: #e5ecea;
  --ink: #13212a;
  --muted: #4c5b63;
  --line: #d6dedd;
  --accent: #1b6670;
  --accent-soft: #dcebea;
  --mark-bg: #fff2b3;
  --mark-ink: #3b3200;
  --sidebar-w: 272px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1a1f;
    --surface: #15232a;
    --side: #12201f;
    --ink: #e3ebed;
    --muted: #9cb0b7;
    --line: #25373f;
    --accent: #62bcc5;
    --accent-soft: #163238;
    --mark-bg: #4a4016;
    --mark-ink: #fff3c4;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans); }
a { color: inherit; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 600; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; }
code, pre { font-family: var(--mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
main:focus, h1[tabindex]:focus, .prose h2[tabindex]:focus { outline: none; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -80px; background: var(--ink); color: var(--bg); padding: 10px 14px; z-index: 100; text-decoration: none; }
.skip-link:focus { top: 12px; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.col { min-width: 0; display: flex; flex-direction: column; }
.col > main { flex: 1; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 28px; }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; background: var(--side); border-right: 1px solid var(--line); padding: 28px 22px 22px; }
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-id { display: flex; gap: 12px; align-items: center; text-decoration: none; }
.side-id img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.side-id strong { display: block; font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.2; }
.side-id span span { display: block; font-size: 13px; line-height: 1.4; color: var(--muted); }
.side-close { display: none; min-width: 44px; min-height: 44px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; font: inherit; cursor: pointer; align-items: center; justify-content: center; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.sidenav > ul > li { margin: 2px 0; }
.sidenav a { display: flex; align-items: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; text-decoration: none; font-size: 15px; }
.sidenav a:hover { background: var(--accent-soft); }
.sidenav a.active-section { background: var(--surface); font-weight: 600; box-shadow: inset 0 0 0 1px var(--line); }
.sidenav a[aria-current="page"] { font-weight: 600; }
.sidenav .count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 400; }
.sidenav .count:empty { display: none; }
.sidenav ul ul { margin: 4px 0 6px 18px; padding-left: 12px; border-left: 1px solid var(--line); }
.sidenav ul ul a { font-size: 14px; min-height: 40px; color: var(--muted); font-weight: 400; }
.sidenav ul ul a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.sidenav .grp { font-size: 12px; color: var(--muted); padding: 10px 12px 2px; }
.sidenav .stat { margin-left: auto; padding-left: 8px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.sidenav ol.toc { list-style: none; margin: 2px 0 8px 10px; padding: 0 0 0 10px; border-left: 2px solid var(--accent-soft); }
.toc button { all: unset; box-sizing: border-box; display: block; width: 100%; cursor: pointer; font-size: 13px; line-height: 1.35; padding: 7px 8px; min-height: 32px; border-radius: 6px; color: var(--muted); }
.toc button:hover { background: var(--accent-soft); color: var(--ink); }
.toc button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.toc button.here { color: var(--accent); font-weight: 600; }
.side-foot { margin-top: auto; display: grid; gap: 10px; }
.side-mark-link { display: inline-flex; width: 44px; height: 44px; align-items: center; border-radius: 10px; }
.side-mark-link img { width: 36px; height: 36px; border-radius: 9px; }
.side-links { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.side-links a { color: var(--muted); display: inline-flex; align-items: center; min-height: 32px; }
.scrim { display: none; }

/* ---------- Mobile top bar and breadcrumb ---------- */
.topbar { display: none; position: sticky; top: 0; z-index: 30; background: var(--bg); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 64px; max-width: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 16px; }
.brand img { width: 34px; height: 34px; border-radius: 8px; }
.where { font-size: 14px; color: var(--muted); padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); white-space: nowrap; margin-right: auto; }
.menu-btn { display: none; min-height: 44px; padding: 0 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; border-radius: 6px; cursor: pointer; margin-left: auto; }
.where + .menu-btn { margin-left: 0; }
.crumbbar { border-bottom: 1px solid var(--line); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 12px 0; font-size: 14px; color: var(--muted); }
.crumbs li { display: flex; align-items: center; gap: 6px; }
.crumbs li + li::before { content: "/"; color: var(--line); font-weight: 600; }
.crumbs a { color: var(--accent); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); }

/* ---------- Page structure ---------- */
.view { padding: 44px 0 56px; }
.page-h1 { font-family: var(--serif); font-size: clamp(34px, 5vw, 52px); letter-spacing: -.02em; margin-bottom: .3em; }
.intro, .lead { font-size: 19px; color: var(--muted); max-width: 660px; }
.cap { font-size: 14px; color: var(--muted); margin: 0 0 8px; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.section-h { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin: 52px 0 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.section-h h2 { font-family: var(--serif); font-size: 21px; margin: 0; }
.group-h { font-family: var(--serif); font-size: 23px; margin: 40px 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.more, .text-link, .inline-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.more, .text-link { font-size: 15px; }
.more:hover, .text-link:hover, .inline-link:hover { text-decoration: underline; }
.inline-link { text-decoration: underline; text-underline-offset: 2px; font-weight: inherit; }
.backlink { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--accent); text-decoration: none; font-weight: 500; font-size: 15px; margin-bottom: 8px; }
.backlink:hover { text-decoration: underline; }
.small-note { font-size: 14px; color: var(--muted); }
.button { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 8px; background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600; font-size: 16px; }
.button:hover { background: var(--accent); color: var(--surface); }

/* ---------- Lists: projects and notes ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.row h2, .row h3 { font-family: var(--serif); font-size: 19px; margin: 0 0 4px; }
.row h2 a, .row h3 a { text-decoration: none; }
.row h2 a:hover, .row h3 a:hover { color: var(--accent); text-decoration: underline; }
.row p { margin: 0; color: var(--muted); font-size: 16px; }
.row .meta { font-size: 14px; color: var(--muted); white-space: nowrap; text-align: right; }
.row .tags { display: block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.status { display: inline-block; font-size: 13px; font-weight: 600; line-height: 1.5; padding: 2px 9px; border-radius: 999px; }
.status-live { background: var(--accent-soft); color: var(--accent); }
.status-draft { background: var(--surface); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.status-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 24px 0 4px; font-size: 14px; color: var(--muted); }
.status-legend .status { margin-left: 8px; }
.status-legend .status:first-child { margin-left: 0; }
.draft-row .meta { font-weight: 600; }

/* ---------- Home ---------- */
.greet { font-family: var(--serif); font-size: clamp(28px, 3.6vw, 40px); line-height: 1.3; max-width: 760px; margin-bottom: .5em; font-weight: 400; }
.tagline { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--accent); margin-bottom: 1.6em; }
.feature { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; }
.feature img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 22%; }
.feature div { padding: 26px; align-self: center; }
.feature { align-items: stretch; }
.feature small { color: var(--muted); font-size: 14px; }
.feature h2 { font-family: var(--serif); font-size: 28px; margin: 8px 0 10px; }
.feature:hover h2 { color: var(--accent); }
.feature .more { display: inline-block; margin-top: 4px; }
.facets { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 36px; }
.facet { padding: 22px 0; border-bottom: 1px solid var(--line); }
.facet h3 { font-family: var(--serif); font-size: 20px; margin-bottom: .35em; }
.facet p { color: var(--muted); font-size: 16px; margin-bottom: .6em; }
.statement { margin: 56px 0 0; padding: 8px 0 8px 24px; border-left: 3px solid var(--accent); }
.statement blockquote { margin: 0 0 .6em; font-family: var(--serif); font-size: clamp(22px, 3vw, 30px); line-height: 1.35; }
.statement .small-note { margin: 0; }

/* ---------- Project pages and long articles ---------- */
.article-head { max-width: 760px; }
.detail-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 1em; color: var(--muted); font-size: 15px; }
.detail-summary { font-size: 19px; color: var(--muted); max-width: 660px; }
.project-facts { display: grid; gap: 18px; margin: 28px 0; max-width: 700px; }
.project-facts dt { font-weight: 600; margin-bottom: 2px; }
.project-facts dd { margin: 0; color: var(--muted); }
.detail-meta { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 20px 0; }
.detail-meta li { font-size: 14px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.detail-links { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 8px; }
.detail-links a { color: var(--accent); font-weight: 500; }
.note-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin: 26px 0 8px; }
.note-cta-end { margin-top: 40px; }
.prose { max-width: 680px; }
.prose h2 { font-family: var(--serif); font-size: 27px; margin: 1.8em 0 .5em; letter-spacing: -.01em; }
.prose h3 { font-size: 18px; margin: 1.6em 0 .4em; }
.prose a { color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .4em 0; }
.prose li::marker { color: var(--accent); }
.prose code { font-size: .9em; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; padding: .05em .35em; }
.prose pre { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; font-size: 14px; line-height: 1.55; margin: 0 0 1.2em; }
.prose pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.note-footer { margin-top: 40px; }
.photo { margin: 28px 0; }
.photo img { border-radius: 6px; width: 100%; }
.photo-dashboard { max-width: 560px; }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 24px 0; align-items: start; }
.photo-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.photo-grid figure { margin: 0; }
.photo-grid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 4px; }
.photo-grid.tall img { aspect-ratio: 3 / 4; }
.pano { margin: 34px 0; overflow-x: auto; }
.pano img { min-width: 900px; width: 100%; border-radius: 6px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin: 26px 0; padding: 16px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts dt { font-size: 13px; color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.route { list-style: none; padding: 0; margin: 28px 0; display: flex; flex-wrap: wrap; }
.route li { flex: 1 1 120px; padding: 12px 14px 12px 0; border-top: 3px solid var(--accent); margin-right: 6px; }
.route b { display: block; }
.route span { font-size: 14px; color: var(--muted); }
.toc-m { display: none; margin: 0 0 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); max-width: 680px; }
.toc-m summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; padding: 0 14px; font-weight: 600; font-size: 15px; }
.toc-m ol { list-style: none; margin: 0; padding: 0 8px 10px; }
.toc-m .toc button { font-size: 15px; min-height: 44px; display: flex; align-items: center; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); max-width: 760px; }
.pager[hidden] { display: none; }
.pager a { text-decoration: none; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); min-height: 44px; }
.pager a:hover { border-color: var(--accent); }
.pager small { display: block; color: var(--muted); font-size: 13px; }
.pager .next { text-align: right; grid-column: 2; }

/* ---------- Draft pages (kept off the public lists until published) ---------- */
.draft-banner { background: var(--surface); border: 1px dashed var(--muted); border-radius: 8px; padding: 12px 16px; font-size: 15px; color: var(--muted); margin: 0 0 28px; max-width: 760px; }
mark { background: var(--mark-bg); color: var(--mark-ink); padding: 0 .2em; border-radius: 2px; }
.todo { font-style: italic; color: var(--muted); }

/* ---------- Now ---------- */
.now-list { list-style: none; padding: 0; margin: 20px 0 0; max-width: 720px; }
.now-list li { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 0 8px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.now-index { font-family: var(--mono); font-size: 13px; color: var(--muted); padding-top: 5px; }
.now-list h2 { font-family: var(--serif); font-size: 19px; margin: 0 0 4px; }
.now-list p { margin: 0; color: var(--muted); }
.updated { font-size: 14px; color: var(--muted); margin: 18px 0 0; }

/* ---------- About ---------- */
.about-intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.about-intro .lead { margin-bottom: 1em; }
.photo-profile { margin: 0; }
.photo-profile img { aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 20%; border-radius: 6px; }
.about-section { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 40px; align-items: start; padding: 36px 0; border-top: 1px solid var(--line); margin-top: 36px; }
.about-section h2 { font-family: var(--serif); font-size: 26px; margin-bottom: .4em; }
.about-section p a:not(.text-link) { color: var(--accent); }
.about-section--text { grid-template-columns: minmax(0, 1fr); }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.photo-pair figure, .photo-single { margin: 0; }
.photo-pair img, .photo-single img { width: 100%; border-radius: 6px; }
.subheading { font-size: 17px; margin: 1.6em 0 .5em; }
.interest-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.interest-list li { font-size: 14px; padding: 3px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.social-list { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-bottom: 1em; }
.social-list a { color: var(--accent); font-weight: 500; }
.about-links { padding-top: 20px; border-top: 1px solid var(--line); max-width: 680px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 26px 0 30px; font-size: 14px; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-left: auto; }
.site-footer a { color: var(--muted); }

/* ---------- Tablet and phone ---------- */
@media (max-width: 900px) {
  .layout { display: block; }
  .topbar { display: block; }
  .js .menu-btn { display: inline-flex; align-items: center; }
  .sidebar { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); }
  .js .sidebar { display: none; }
  .js.drawer-open .sidebar { display: flex; position: fixed; z-index: 55; top: 0; left: 0; bottom: 0; width: min(330px, 88vw); height: auto; overflow-y: auto; border-right: 1px solid var(--line); border-bottom: 0; box-shadow: 0 0 40px rgba(0, 0, 0, .25); }
  .js.drawer-open .scrim { display: block; position: fixed; inset: 0; z-index: 54; background: rgba(10, 20, 25, .45); }
  .js.drawer-open .side-close { display: inline-flex; }
  .toc-m { display: block; }
  .feature, .about-intro, .about-section { grid-template-columns: 1fr; }
  .about-section { gap: 24px; }
}
@media (max-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding: 0 18px; }
  .view { padding-top: 28px; }
  .facets { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .row .meta { text-align: left; white-space: normal; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-footer .footer-links { margin-left: 0; }
}
@media (max-width: 420px) {
  .brand span { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  .view { animation: fade .18s ease-out; }
  @keyframes fade { from { opacity: .4; } to { opacity: 1; } }
  html { scroll-behavior: smooth; }
}
@media print {
  .sidebar, .topbar, .crumbbar, .pager, .toc-m, .skip-link { display: none !important; }
  .layout { display: block; }
  body { background: #fff; color: #000; }
}
