/* Sushant Mishra — portfolio. Direction A "Calc Sheet". Rev A.1 */
:root {
  --paper: #F4F1E8;
  --paper-2: #ECE8DC;
  --grid: #DDD8CC;
  --ink: #1C1B18;
  --pencil: #625F56;
  --pencil-lt: #7A776E;
  --red: #B03224;
  --blue: #2F4A7A;
  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --max: 1240px;
  --hair: 1px solid var(--grid);
  --rule: 1px solid var(--ink);
  /* five-step type scale */
  --fs-meta: 12.5px;
  --fs-data: 14px;
  --fs-body: 16.5px;
  --fs-lede: 18px;
  --fs-sub: 21px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  /* 5 mm grid ≈ 20 px at 96 dpi */
  background-image:
    linear-gradient(to right, rgba(221, 216, 204, .55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(221, 216, 204, .55) 1px, transparent 1px);
  background-size: 20px 20px;
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.55;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-weight: 400; margin: 0; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: .15em; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
sup, sub { line-height: 0; font-size: .72em; }
ul, ol { margin: 0; padding-left: 1.2em; }
li { margin: 0 0 .35em; }
li::marker { color: var(--pencil-lt); }
em { font-style: italic; }

.mono, .m { font-family: var(--mono); font-size: var(--fs-data); line-height: 1.5; letter-spacing: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pencil { color: var(--pencil); }
.red { color: var(--red); }
.serif { font-family: var(--serif); }

.skip {
  position: absolute; left: 8px; top: -60px;
  padding: 8px 12px; background: var(--ink); color: var(--paper);
  font-family: var(--mono); font-size: var(--fs-meta); z-index: 100;
}
.skip:focus { top: 8px; }

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

/* ---------- Title block (header, and repeated as the footer strip) ---------- */
.tb, .tb-strip { font-family: var(--mono); font-size: var(--fs-meta); line-height: 1; }
.tb {
  position: sticky; top: 0; z-index: 50;
  background: var(--paper);
  border-bottom: var(--rule);
}
.tb-row {
  display: flex; align-items: stretch;
  max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter);
  min-height: 44px;
}
.tb-cell {
  display: flex; align-items: center;
  padding: 0 12px; border-right: var(--hair); white-space: nowrap;
}
.tb-cell:first-child { padding-left: 0; }
.tb-name { font-weight: 600; letter-spacing: .02em; }
.tb-name a { color: var(--ink); text-decoration: none; }
.tb-cell.dim { color: var(--pencil); }
.tb-sheet { min-width: 9.5em; color: var(--ink); }
.tb-nav { margin-left: auto; display: flex; gap: 0; border-right: 0; padding-right: 0; }
.tb-nav a {
  display: flex; align-items: center; height: 100%;
  padding: 0 8px; color: var(--ink); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tb-nav a:last-child { padding-right: 0; }
.tb-nav a b { font-weight: 400; color: var(--pencil); margin-right: .45em; }
.tb-nav a:hover { color: var(--red); }
.tb-nav a[aria-current="true"] { border-bottom-color: var(--red); }

/* degrade in steps so the block always fits its own sheet margin */
@media (max-width: 1400px) { .tb .opt.o2 { display: none; } }
@media (max-width: 1180px) { .tb .opt, .tb-strip .opt { display: none; } }
@media (max-width: 720px) { .tb-strip .tb-cell { flex: 1 1 50%; padding-left: 0; border-right: 0; border-bottom: var(--hair); } }
@media (max-width: 1000px) {
  .tb .tb-row { flex-wrap: wrap; min-height: 0; }
  .tb .tb-cell { min-height: 40px; }
  .tb .tb-sheet { margin-left: auto; border-right: 0; padding-right: 0; }
  .tb .tb-nav { flex-basis: 100%; margin-left: 0; border-top: var(--hair); }
  .tb .tb-nav a { height: 44px; margin-bottom: 0; }
  .tb .tb-nav a:first-child { padding-left: 0; }
}
@media (max-width: 720px) {
  .tb .tb-cell.dim:not(.tb-sheet) { display: none; }
  .tb .tb-sheet { min-width: 0; }
  .tb .tb-nav { justify-content: space-between; }
  .tb .tb-nav a { padding: 0; min-width: 44px; justify-content: center; }
  .tb .tb-nav a b { display: none; }
}

/* footer strip: same cells, not sticky, wraps freely */
.tb-strip { border-top: var(--rule); border-bottom: var(--rule); margin-top: 8px; }
.tb-strip .tb-row { padding-inline: 0; flex-wrap: wrap; min-height: 0; }
.tb-strip .tb-cell { min-height: 40px; }
.tb-strip .tb-nav a { height: 40px; }
.tb-strip .tb-name { color: var(--ink); }

/* ---------- Sheet sections ---------- */
.sheet { padding-block: 0 72px; scroll-margin-top: 60px; }
.sheet-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px;
  font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil);
  border-top: var(--rule); padding-top: 28px; margin-bottom: 26px;
}
.sheet-head .no { color: var(--ink); font-weight: 600; }
.sheet-head .meta { margin-left: auto; }
.sheet h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(30px, 3.4vw, 46px); line-height: 1.08; letter-spacing: -.012em;
  max-width: 24ch; margin-bottom: 14px;
}
.lede { font-size: var(--fs-lede); max-width: 60ch; color: var(--ink); margin-bottom: 28px; }
.sub { font-family: var(--mono); font-size: var(--fs-data); color: var(--pencil); margin: -6px 0 24px; max-width: 72ch; }
@media (max-width: 1000px) { .sheet { scroll-margin-top: 96px; } }

/* ---------- Hero (Sheet 00) ---------- */
.hero { padding-top: clamp(40px, 6vw, 84px); padding-bottom: 64px; }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 0 clamp(24px, 4vw, 64px); align-items: start;
}
.hero-grid > .hero-fig { grid-column: 2; grid-row: 1 / span 2; }
.hero-grid > .sketch { grid-column: 1; grid-row: 2; }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(40px, 6.4vw, 68px); line-height: 1.02; letter-spacing: -.018em;
  text-wrap: balance; max-width: 12ch; margin: 0 0 26px;
}
.hero h1 em { font-style: italic; }
.hero-sub { font-family: var(--mono); font-size: var(--fs-data); line-height: 1.6; color: var(--ink); max-width: 46ch; margin-bottom: 30px; }
.hero-sub .pencil { display: block; }
.hero-links { display: flex; flex-wrap: wrap; gap: 8px 28px; font-family: var(--mono); font-size: var(--fs-data); }
.hero-links a { color: var(--ink); }
.hero-links a:hover { color: var(--red); }

/* hand sketches (cover frame, strut panel, raft on springs) */
.sketch { margin: 40px 0 0; max-width: 340px; }
.sketch svg { width: 100%; height: auto; display: block; overflow: visible; }
.sketch text { font-family: var(--mono); font-size: 11px; fill: var(--pencil); }
.sketch .ink { stroke: var(--ink); fill: none; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.sketch .thin { stroke: var(--pencil-lt); fill: none; stroke-width: .8; }
.sketch .red { stroke: var(--red); fill: none; stroke-width: 1.5; }
.sketch text.red { fill: var(--red); stroke: none; }
.sketch .draw { stroke-dasharray: 1400; stroke-dashoffset: 1400; animation: draw 2.4s ease-out .3s forwards; }
.sketch .draw.d2 { animation-delay: 1.6s; animation-duration: 1s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* sketches further down the page draw in when scrolled to */
.sketch.lazy .draw { animation: none; transition: stroke-dashoffset 2s ease-out; }
.sketch.lazy .draw.d2 { transition-delay: 1.2s; transition-duration: 1s; }
.sketch.lazy.on .draw { stroke-dashoffset: 0; }
.sketch.fig2 { margin: 6px 0 22px; max-width: 360px; }
.strut { max-width: 300px; margin: 6px 0 22px; }
.strut .brick { fill: rgba(176, 50, 36, .07); stroke: none; }
.strut line.red { stroke-width: 6; stroke-linecap: butt; opacity: .55; }
.strut .draw { stroke-dasharray: 260; stroke-dashoffset: 260; animation: none; transition: stroke-dashoffset 1.4s ease-out .2s; }
.strut.on .draw { stroke-dashoffset: 0; }

.hero-fig { margin: 0; }
.hero-fig .frame { aspect-ratio: 5 / 4; overflow: hidden; border: var(--hair); background: var(--paper-2); }
.hero-fig img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
figcaption { font-family: var(--mono); font-size: var(--fs-meta); line-height: 1.5; color: var(--pencil); margin-top: 8px; }
figcaption b { font-weight: 600; color: var(--ink); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .hero-grid > .hero-fig, .hero-grid > .sketch { grid-column: 1; grid-row: auto; }
  .hero-grid > .hero-fig { order: 2; }
  .hero-grid > .sketch { order: 3; margin-top: 0; }
  .hero-sub .pencil { display: none; }
  .hero-fig { margin-inline: calc(-1 * var(--gutter)); }
  .hero-fig .frame { border-left: 0; border-right: 0; aspect-ratio: 4 / 3; }
  .hero-fig figcaption { padding-inline: var(--gutter); }
}

/* ---------- Tables ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.scroll table tbody tr:last-child td { border-bottom: var(--rule); }
table { border-collapse: collapse; width: 100%; font-size: var(--fs-data); }
th, td { text-align: left; vertical-align: top; padding: 11px 14px 11px 0; border-bottom: var(--hair); }
th { font-family: var(--mono); font-weight: 400; font-size: var(--fs-meta); color: var(--pencil); border-bottom: var(--rule); padding-top: 0; white-space: nowrap; }
th.r { text-align: right; }
td.m, th.m { font-family: var(--mono); }

/* Register (Sheet 01) */
.reg { min-width: 900px; }
.reg tbody tr { cursor: pointer; }
.reg td:first-child { color: var(--pencil); white-space: nowrap; }
.reg td:first-child::before { content: "→"; display: inline-block; width: 1.3em; color: var(--red); opacity: 0; }
.reg tbody tr:hover td:first-child { color: var(--red); }
.reg tbody tr:hover td:first-child::before { opacity: 1; }
.reg .t a { color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: var(--fs-sub); line-height: 1.25; }
.reg tr:hover .t a { color: var(--red); }
.reg .t small { display: block; font-family: var(--sans); font-size: var(--fs-data); color: var(--pencil); margin-top: 2px; }
.reg td { padding-top: 14px; padding-bottom: 14px; }

/* ---------- Case-study sheets ---------- */
.study { display: grid; grid-template-columns: 9rem minmax(0, 1fr); column-gap: 28px; row-gap: 0; align-items: start; }
.study > h3 {
  font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); font-weight: 400;
  padding-top: 26px; border-top: var(--hair); margin: 0;
}
.study > div { padding-top: 22px; border-top: var(--hair); padding-bottom: 30px; }
.study > div p, .study > div ul { max-width: 62ch; }
.study > h3 + div { grid-column: 2; }
@media (max-width: 960px) {
  .study { grid-template-columns: minmax(0, 1fr); }
  .study > h3 + div, .study > div { grid-column: 1; }
  .study > h3 { padding-top: 18px; padding-bottom: 6px; }
  .study > div { border-top: 0; padding-top: 0; }
}

/* Calc sheet */
.calc { min-width: 720px; }
.calc th { padding-bottom: 8px; }
.calc td { padding: 9px 14px 9px 0; }
.calc td.ln { width: 2.6em; font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); padding-top: 12px; }
.calc td.ex { font-family: var(--sans); min-width: 24em; }
.calc td.ex .m { color: var(--ink); }
.calc td.ex small { display: block; color: var(--pencil); font-size: var(--fs-meta); margin-top: 2px; }
.calc td.val { font-family: var(--mono); white-space: nowrap; text-align: right; font-variant-numeric: tabular-nums; }
.calc td.ref { font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); white-space: normal; width: 13em; max-width: 13em; padding-right: 0; }
.calc tr.key td { border-bottom: var(--rule); }
.calc tr.key td.val { font-weight: 600; }
.calc tr.key td.val u { text-decoration: none; border-bottom: 3px double var(--ink); padding-bottom: 1px; }
.calc tr.sep td { border-bottom: 0; padding-top: 18px; font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); }

/* stamp: sits after the last line of the sheet, bottom right */
.stamp-row { display: flex; justify-content: flex-end; margin-top: 6px; padding-right: 18px; }
.stamp {
  display: inline-block; padding: 8px 12px 7px;
  border: 2px solid var(--red); border-radius: 2px; color: var(--red);
  font-family: var(--mono); font-size: var(--fs-meta); line-height: 1.2; letter-spacing: .06em; text-align: center;
  transform: rotate(-6deg) scale(1.12); opacity: 0; mix-blend-mode: multiply;
  transition: opacity .35s ease-out, transform .35s cubic-bezier(.2, .9, .3, 1.2);
  pointer-events: none;
}
.stamp strong { display: block; font-size: var(--fs-lede); letter-spacing: .12em; font-weight: 600; margin-top: 2px; }
.stamp.on { opacity: .92; transform: rotate(-6deg) scale(1); }
@media (prefers-reduced-motion: reduce) {
  .stamp { transition: none; transform: rotate(-6deg); }
  .sketch .draw, .sketch.lazy .draw, .strut .draw { animation: none; transition: none; stroke-dashoffset: 0; }
}

/* Pending note (in place of comparison table) */
.pending {
  font-family: var(--mono); font-size: var(--fs-data); color: var(--pencil);
  border: 1px dashed var(--pencil-lt); padding: 12px 14px; max-width: 62ch; margin-top: 8px;
}
.pending b { color: var(--ink); font-weight: 600; }

/* Definition lists (results) */
dl.res { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 22px; margin: 0; max-width: 62ch; }
dl.res dt { font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); padding-top: 2px; }
dl.res dd { margin: 0; }
dl.res dd .num { font-size: var(--fs-data); }
.delta { color: var(--red); font-family: var(--mono); font-size: var(--fs-data); }

/* ---------- Lab table ---------- */
.lab { min-width: 860px; }
@media (max-width: 1100px) { .lab { min-width: 700px; } }
.lab td, .lab th { padding-right: 18px; }
.lab td.val { font-family: var(--mono); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lab td.ref { font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); white-space: nowrap; }
.lab td.lim .m { font-size: var(--fs-meta); }
.lab td.ok { font-family: var(--mono); white-space: nowrap; padding-right: 0; }
.tick { color: var(--blue); font-weight: 600; }
.cross { color: var(--red); font-weight: 600; }
.notes { font-size: var(--fs-data); color: var(--pencil); max-width: 72ch; margin-top: 16px; list-style: none; padding: 0; }
.notes li { margin-bottom: .4em; }

/* ---------- Tables stack below 960px: the answer column must be on screen ---------- */
@media (max-width: 960px) {
  .calc, .lab, .reg { min-width: 0; }
  .calc thead, .lab thead, .reg thead { display: none; }
  .calc tr { display: grid; grid-template-columns: 2.2em minmax(0, 1fr); column-gap: 8px; padding: 10px 0; border-bottom: var(--hair); }
  .calc td { display: block; border: 0; padding: 0; }
  .calc td.ln { grid-row: 1 / span 3; padding-top: 3px; width: auto; }
  .calc td.ex { min-width: 0; }
  .calc td.val { text-align: left; white-space: normal; margin-top: 6px; }
  .calc tr:not(.key) td.val:not(:empty)::before { content: "= "; color: var(--pencil-lt); }
  .calc td.ref { width: auto; white-space: normal; margin-top: 2px; }
  .calc td.ref:empty { display: none; }
  .calc tr.sep { display: block; border: 0; padding-bottom: 0; padding-top: 16px; }
  .calc tr.sep td:first-child { display: none; }
  .calc tr.key { border-bottom: var(--rule); }
  .calc tr.key td, .scroll .calc tbody tr:last-child td { border: 0; }
  .lab tr { display: block; padding: 10px 0; border-bottom: var(--hair); }
  .lab td { display: block; border: 0; padding: 0 0 2px; white-space: normal; }
  .lab td:first-child { font-family: var(--serif); font-size: var(--fs-lede); }
  .lab td.ref::before { content: "Std. "; color: var(--pencil-lt); }
  .lab td.lim::before { content: "Limit "; font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil-lt); }
  .scroll .lab tbody tr:last-child td { border: 0; }
  .lab tbody tr:last-child { border-bottom: var(--rule); }
  .reg tr { display: block; position: relative; padding: 12px 0 12px 3.2em; border-bottom: var(--hair); }
  .reg td { display: inline; border: 0; padding: 0; font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); line-height: 1.6; }
  .reg td:first-child { position: absolute; left: 0; top: 14px; }
  .reg td:first-child::before { display: none; }
  .reg td.t { display: block; margin-bottom: 4px; }
  .reg td:nth-child(n+4)::before { content: " · "; }
  .scroll .reg tbody tr:last-child td { border: 0; }
  .reg tbody tr:last-child { border-bottom: var(--rule); }
  .stamp-row { margin-top: -6px; padding-right: 4px; }
}

/* ---------- Profile ---------- */
.profile { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 4fr); gap: 32px clamp(28px, 5vw, 72px); align-items: start; }
.profile .bio { font-family: var(--serif); font-size: var(--fs-sub); line-height: 1.42; max-width: 56ch; margin-bottom: 36px; }
.profile figure { margin: 0; }
.profile .frame { aspect-ratio: 4 / 5; overflow: hidden; border: var(--hair); background: var(--paper-2); }
.profile img { width: 100%; height: 100%; object-fit: cover; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 28px 32px; }
.cols h3, .exp h3 { font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); font-weight: 400; }
.cols h3 { border-top: var(--hair); padding-top: 10px; margin-bottom: 10px; }
.cols ul { list-style: none; padding: 0; font-size: var(--fs-data); }
.cols li { margin-bottom: .3em; }
.cols li small { color: var(--pencil); font-size: var(--fs-meta); }
.cols li .m { font-size: var(--fs-meta); }
.exp { border-top: var(--hair); padding-top: 12px; margin-bottom: 28px; max-width: 58ch; }
.exp h3 { margin-bottom: 8px; }
.exp .role { font-family: var(--serif); font-size: var(--fs-sub); line-height: 1.25; }
.exp .when { font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); margin: 2px 0 10px; }
@media (max-width: 800px) {
  .profile { grid-template-columns: minmax(0, 1fr); }
  .profile figure { max-width: 380px; order: -1; }
}

/* ---------- Contact / footer ---------- */
.foot { padding-bottom: 28px; }
.foot-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 36px; }
.foot-cell { padding: 18px 18px 20px 0; border-right: var(--hair); margin-right: 18px; font-family: var(--mono); font-size: var(--fs-data); line-height: 1.6; }
.foot-cell:last-child { border-right: 0; margin-right: 0; }
.foot-cell .lab-l { display: block; color: var(--pencil); font-size: var(--fs-meta); margin-bottom: 6px; }
.foot-cell a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--grid); }
.foot-cell a:hover { color: var(--red); border-color: var(--red); }
.foot-big { font-family: var(--serif); font-size: clamp(28px, 3vw, 40px); line-height: 1.1; letter-spacing: -.01em; padding: 8px 0 28px; max-width: 24ch; }
.foot-big a { color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--grid); }
.foot-big a:hover { border-color: var(--red); color: var(--red); }
.colophon { font-family: var(--mono); font-size: var(--fs-meta); color: var(--pencil); padding: 14px 0 0; }
@media (max-width: 800px) {
  .foot-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot-cell:nth-child(2) { border-right: 0; margin-right: 0; }
}
@media (max-width: 420px) { .foot-grid { grid-template-columns: 1fr; } .foot-cell { border-right: 0; margin-right: 0; border-bottom: var(--hair); } }
