/* Anup Bhandari — shared site styles.
   Layout: a field-book portfolio. Topographic hero, dated site record, project sheets. One column on phones, wider grids above 860px. */
:root {
  --paper: #f3f5f2;        /* survey-sheet off-white, faintly green */
  --sheet: #ffffff;
  --ink: #12252b;          /* deep river slate */
  --muted: #55676c;
  --rule: #d5ddd9;
  --river: #0b6c80;        /* glacial river blue-green */
  --river-soft: #dbeef1;
  --staff: #d88a1c;        /* levelling-staff orange, used sparingly */
  --contour: #c9d6d2;
  --on-river: #ffffff;
  --concrete: #e4e8e5;
  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --paper: #0f1a1d; --sheet: #15242a; --ink: #e5eeec; --muted: #9db0b2; --rule: #26393f;
  --river: #5cc3d4; --river-soft: #173840; --staff: #f0a640; --contour: #22363b; --on-river: #08181c; --concrete: #1d2e33; color-scheme: dark; } }
:root[data-theme="dark"] {
  --paper: #0f1a1d; --sheet: #15242a; --ink: #e5eeec; --muted: #9db0b2; --rule: #26393f;
  --river: #5cc3d4; --river-soft: #173840; --staff: #f0a640; --contour: #22363b; --on-river: #08181c; --concrete: #1d2e33; color-scheme: dark; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--f-body); font-size: 16px; line-height: 1.6; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--paper); }
img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--river); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--staff); outline-offset: 3px; border-radius: 4px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px)); }
.mono { font-family: var(--f-mono); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
h1, h2, h3 { font-family: var(--f-display); text-wrap: balance; margin: 0; }
p { margin: 0; }

/* Nav */
.nav { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 8; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.nav .wrap { display: flex; align-items: center; gap: 18px; padding-block: 12px; }
.logo { font-family: var(--f-display); font-weight: 800; font-stretch: 125%; font-size: 17px; color: var(--ink); text-decoration: none; letter-spacing: .02em; flex: none; }
.logo span { color: var(--staff); }
.links { display: flex; gap: 18px; overflow-x: auto; scrollbar-width: none; min-width: 0; margin-left: auto; }
.links::-webkit-scrollbar { display: none; }
.links a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; white-space: nowrap; padding-block: 4px; }
.links a:hover, .links a[aria-current] { color: var(--ink); }
@media (max-width: 440px) { .nav .wrap { gap: 14px; } .links { gap: 13px; } .links a { font-size: 13.5px; } .links a.opt { display: none; } }

/* Home hero */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.topo { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero > .wrap { position: relative; }
.hero .top { display: grid; gap: 28px; padding-block: 48px 40px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--river); }
.status i { width: 8px; height: 8px; border-radius: 50%; background: var(--staff); box-shadow: 0 0 0 4px color-mix(in srgb, var(--staff) 25%, transparent); }
.hero h1 { font-weight: 800; font-stretch: 125%; font-size: clamp(40px, 9vw, 84px); line-height: .95; letter-spacing: -.02em; margin-top: 14px; }
.role { font-family: var(--f-display); font-stretch: 112%; font-weight: 500; font-size: clamp(19px, 3.2vw, 26px); line-height: 1.3; margin-top: 16px; max-width: 30ch; }
.role b { font-weight: 700; color: var(--river); }
.lede { color: var(--muted); max-width: 56ch; margin-top: 16px; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 8px; font-weight: 600; font-size: 15px; text-decoration: none; border: 1px solid transparent; }
.btn.primary { background: var(--river); color: var(--on-river); }
.btn.line { border-color: var(--rule); color: var(--ink); background: var(--sheet); }
.portrait { width: min(240px, 60vw); aspect-ratio: 4 / 5; max-width: 100%; border-radius: 6px; overflow: hidden; background: var(--river-soft); border: 1px solid var(--rule); position: relative; margin: 0; }
.portrait img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; }
.portrait .mono-fallback { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-stretch: 125%; font-size: 64px; color: var(--river); }
.portrait figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px; background: color-mix(in srgb, var(--ink) 78%, transparent); color: var(--paper); }
@media (min-width: 860px) {
  .hero .top { grid-template-columns: 1fr auto; align-items: end; padding-block: 88px 64px; }
  .portrait { width: 260px; }
}
.facts { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--rule); margin: 0; }
.facts > div { padding: 16px 14px 16px 0; border-bottom: 1px solid var(--rule); min-width: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 4px 0 0; font-family: var(--f-display); font-stretch: 112%; font-weight: 700; font-size: 17px; line-height: 1.25; }
@media (min-width: 860px) { .facts { grid-template-columns: repeat(4, 1fr); } .facts > div { border-bottom: 0; } }

/* Sub-page header */
.page-head { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.page-head > .wrap { position: relative; padding-block: 36px 34px; display: flex; flex-direction: column; gap: 12px; }
.crumb { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.crumb:hover { color: var(--ink); }
.page-head .kicker { color: var(--river); }
.page-head h1 { font-weight: 800; font-stretch: 125%; font-size: clamp(32px, 7vw, 60px); line-height: 1; letter-spacing: -.015em; max-width: 20ch; }
.page-head .sub { color: var(--muted); max-width: 60ch; font-size: 17px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.meta span { font-family: var(--f-mono); font-size: 12px; padding: 4px 10px; border-radius: 4px; background: var(--sheet); border: 1px solid var(--rule); color: var(--muted); }
@media (min-width: 860px) { .page-head > .wrap { padding-block: 64px 56px; } }

/* Sections */
section.block { padding-block: 56px 0; scroll-margin-top: 64px; }
.head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 24px; flex-wrap: wrap; }
.head h2 { font-weight: 800; font-stretch: 125%; font-size: clamp(26px, 5vw, 38px); letter-spacing: -.01em; }
.head .mono { color: var(--muted); }
.prose { max-width: 66ch; display: flex; flex-direction: column; gap: 14px; }
.prose ul, .prose ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.prose b { font-weight: 600; }
.split { display: grid; gap: 32px; }
@media (min-width: 860px) { .split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 48px; align-items: start; } }

/* Experience record */
.record { display: flex; flex-direction: column; border-left: 2px solid var(--rule); margin-left: 6px; }
.entry { position: relative; padding: 0 0 36px 26px; }
.entry:last-child { padding-bottom: 0; }
.entry::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--muted); }
.entry.now::before { background: var(--staff); border-color: var(--staff); }
.entry .when { color: var(--muted); }
.entry.now .when { color: var(--staff); }
.entry h3 { font-weight: 700; font-stretch: 112%; font-size: 21px; margin-top: 6px; }
.entry .org { color: var(--muted); margin-top: 2px; }
.entry ul { margin: 12px 0 0; padding-left: 18px; max-width: 62ch; }
.entry li { margin-bottom: 6px; }
.entry .more { display: inline-block; margin-top: 10px; font-weight: 600; text-decoration: none; }
.parts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.parts span { font-family: var(--f-mono); font-size: 12px; padding: 3px 9px; border-radius: 4px; background: var(--river-soft); color: var(--river); }

/* Project sheets */
.sheets { display: grid; gap: 16px; }
@media (min-width: 860px) { .sheets { grid-template-columns: repeat(6, 1fr); } .sheet.lead { grid-column: span 6; } .sheet.half { grid-column: span 3; } }
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 22px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sheet.lead { border-top: 4px solid var(--river); }
.sheet .tag { color: var(--muted); }
.sheet h3 { font-weight: 700; font-stretch: 112%; font-size: 21px; line-height: 1.25; }
.sheet p { color: var(--muted); max-width: 64ch; }
.sheet ul { margin: 0; padding-left: 18px; }
.sheet li { margin-bottom: 4px; }
.sheet .more { margin-top: auto; padding-top: 6px; font-weight: 600; text-decoration: none; }
.sheet .more:hover, .entry .more:hover { text-decoration: underline; }
.sheet .thumb { margin: -22px -22px 6px; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px 8px 0 0; background: var(--concrete); }
.sheet.lead .thumb { border-radius: 4px 4px 0 0; }
.sheet .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lead-grid { display: grid; gap: 18px; }
@media (min-width: 860px) { .lead-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.hydro { width: 100%; height: auto; display: block; }

/* Spec list (salient features) */
.spec { margin: 0; display: grid; border-top: 1px solid var(--rule); }
.spec > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
.spec dt { color: var(--muted); font-size: 15px; }
.spec dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.panel h3 { font-weight: 700; font-stretch: 112%; font-size: 18px; }

/* Numbered method steps (real sequences only) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: s; }
@media (min-width: 860px) { .steps.two-col { grid-template-columns: 1fr 1fr; } }
.steps li { counter-increment: s; background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 18px 18px 18px 58px; position: relative; min-width: 0; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; left: 18px; top: 18px; font-family: var(--f-mono); font-size: 13px; color: var(--staff); font-weight: 500; }
.steps h3 { font-family: var(--f-body); font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.steps p { color: var(--muted); }

/* Figures & gallery */
.gallery { display: grid; gap: 14px; }
@media (min-width: 700px) { .gallery { grid-template-columns: repeat(2, 1fr); } .gallery.three { grid-template-columns: repeat(3, 1fr); } }
.fig { margin: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fig .frame { aspect-ratio: 4 / 3; border-radius: 6px; overflow: hidden; background: var(--concrete); border: 1px solid var(--rule); position: relative; }
.fig .frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fig.missing .frame::after { content: "Photo: " attr(data-file); position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center; font-family: var(--f-mono); font-size: 12px; color: var(--muted); }
.fig figcaption { font-size: 14px; color: var(--muted); }
.fig figcaption b { color: var(--ink); font-weight: 600; }

/* Diagram */
.diagram { background: var(--sheet); border: 1px solid var(--rule); border-radius: 8px; padding: 16px; overflow-x: auto; }
.diagram svg { display: block; width: 100%; min-width: 520px; height: auto; }
.diagram .cap { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Callout */
.note { border-left: 4px solid var(--staff); padding: 4px 0 4px 18px; max-width: 70ch; display: flex; flex-direction: column; gap: 8px; }
.note h3 { font-weight: 700; font-stretch: 112%; font-size: 20px; line-height: 1.3; }
.note p { color: var(--muted); }

/* Research */
.papers { display: flex; flex-direction: column; gap: 28px; }
.paper { border-left: 4px solid var(--staff); padding: 4px 0 4px 18px; max-width: 70ch; display: flex; flex-direction: column; gap: 8px; }
.paper .mono { color: var(--muted); }
.paper h3 { font-weight: 700; font-stretch: 112%; font-size: 20px; line-height: 1.3; }
.paper p { color: var(--muted); }
.paper.report { border-left-color: var(--river); }

/* Skills */
.skills { display: grid; border-top: 1px solid var(--rule); }
.skill { display: grid; gap: 4px 20px; padding: 16px 0; border-bottom: 1px solid var(--rule); }
.skill h3 { font-family: var(--f-body); font-size: 16px; font-weight: 600; }
.skill p { color: var(--muted); }
@media (min-width: 700px) { .skill { grid-template-columns: 220px 1fr; } }

/* Education & awards */
.two { display: grid; gap: 28px; }
@media (min-width: 860px) { .two { grid-template-columns: 1fr 1fr; gap: 48px; } }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.list li { display: grid; gap: 2px; }
.list b { font-weight: 600; }
.list span { color: var(--muted); font-size: 15px; }
.subhead { font-family: var(--f-display); font-stretch: 112%; font-weight: 700; font-size: 19px; margin-bottom: 14px; }

/* Prev / next */
.pager { display: grid; gap: 12px; margin-top: 64px; }
@media (min-width: 700px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 18px; border: 1px solid var(--rule); border-radius: 8px; background: var(--sheet); text-decoration: none; color: var(--ink); min-width: 0; }
.pager a:hover { border-color: var(--river); }
.pager .mono { color: var(--muted); }
.pager b { font-family: var(--f-display); font-stretch: 112%; font-weight: 700; font-size: 18px; line-height: 1.3; }
.pager .next { text-align: right; }

/* Contact */
.contact { margin-top: 72px; background: var(--river); color: var(--on-river); }
.contact .wrap { padding-block: 56px; display: grid; gap: 24px; }
.contact h2 { font-weight: 800; font-stretch: 125%; font-size: clamp(28px, 6vw, 46px); line-height: 1.05; max-width: 18ch; }
.contact p { max-width: 52ch; opacity: .9; }
.reach { display: grid; gap: 10px; }
@media (min-width: 700px) { .reach { grid-template-columns: repeat(3, 1fr); } }
.reach > div { border: 1px solid color-mix(in srgb, var(--on-river) 35%, transparent); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.reach .mono { opacity: .75; }
.reach a, .reach .val { color: var(--on-river); font-weight: 600; word-break: break-word; }
.copy { align-self: flex-start; background: transparent; border: 1px solid color-mix(in srgb, var(--on-river) 45%, transparent); color: var(--on-river); border-radius: 6px; padding: 4px 10px; font: 500 13px var(--f-body); cursor: pointer; }
footer.site { padding-block: 22px; color: var(--muted); font-size: 13px; }
footer.site .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }