/* Case-study pages for hareeshr.me. Same tokens and type as assets/style.css,
   but readable long-form layout. Shared by every page in /work. */
@import url(https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,400;0,600;1,300&display=swap);

:root {
  --bg: #0e1212;
  --white: #fff;
  --hl: #0071d3;
  --gray: #687185;
  --text: #c9ced8;
  --panel: #141a1b;
  --line: #1f2829;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}
a { color: var(--hl); }
a:hover { color: var(--white); }
img, svg { max-width: 100%; }

/* ---------- header (same look as the home page) ---------- */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 20px 60px;
  background: linear-gradient(0deg, #0e121200 0%, #0e1212 70%);
  pointer-events: none;
}
header > * { pointer-events: auto; }
.logo img { width: 75px; display: block; }
nav ul { display: flex; align-items: center; gap: 20px; list-style: none; margin: 0; padding: 0; }
nav ul a { color: var(--white); text-decoration: none; position: relative; }
nav ul a.nav-text::after {
  content: ""; position: absolute; left: 9px; bottom: -3px;
  width: calc(100% - 9px); height: 1px; background: var(--white);
  transform: scaleX(0); transform-origin: left; transition: transform .3s ease;
}
nav ul a.nav-text:hover::after { transform: scaleX(1); }
.social-icon { width: 1.6em; height: 1.6em; fill: currentColor; color: var(--hl); vertical-align: middle; transition: color .3s ease; }
.social-icon:hover { color: var(--white); }

/* ---------- page frame with the blue spine ---------- */
.page {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  padding: 140px 20px 80px 50px;
}
.page::before {
  content: ""; position: absolute; left: 20px; top: 150px; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--hl) 0%, var(--hl) 85%, var(--bg) 100%);
  opacity: .3;
}
.spine-dot {
  position: absolute; left: 14px; top: 150px; width: 14px; height: 14px;
  border-radius: 50%; border: 2px solid var(--hl); background: var(--hl);
}

/* ---------- type ---------- */
.title { font-size: 48px; line-height: 1.15; color: var(--white); margin: 0 0 24px; font-weight: 400; }
.title .high { color: var(--hl); }
.command { display: block; font-size: 22px; line-height: 1.5; color: var(--white); margin: 0 0 14px; font-weight: 400; }
.command::before { content: '> '; color: var(--hl); }
.comment { display: block; color: var(--gray); margin: 0 0 12px; }
.comment::before { content: '// '; }
h2 {
  font-size: 22px; font-weight: 600; color: var(--white);
  margin: 64px 0 18px; line-height: 1.3;
}
h2 .num { color: var(--hl); font-weight: 400; margin-right: 10px; }
p { margin: 0 0 16px; max-width: 68ch; }
strong { color: var(--white); font-weight: 600; }
ul.points { margin: 0 0 16px; padding: 0; list-style: none; max-width: 68ch; }
ul.points li { position: relative; padding-left: 24px; margin-bottom: 10px; }
ul.points li::before { content: '-'; position: absolute; left: 4px; color: var(--hl); }
code { color: var(--white); background: var(--panel); padding: 1px 6px; border-radius: 4px; font-size: .92em; }

/* ---------- intro meta ---------- */
.meta { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 26px 0 0; color: var(--gray); font-size: 14px; }
.meta b { display: block; color: var(--hl); font-weight: 400; }
.meta span { color: var(--text); }

/* ---------- stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; margin: 48px 0 0;
}
.stat { background: var(--bg); padding: 20px 18px; }
.stat .v { display: block; font-size: 22px; line-height: 1.2; color: var(--white); font-weight: 600; }
.stat .v .high { color: var(--hl); }
.stat .v { white-space: nowrap; }
@media (min-width: 861px) { .stat .v { font-size: 20px; } }
.stat .l { display: block; font-size: 13px; color: var(--gray); margin-top: 6px; line-height: 1.45; }

/* ---------- options compared ---------- */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 20px 0 16px; }
.option { border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; background: var(--panel); }
.option.chosen { border-color: var(--hl); }
.option h3 { margin: 0 0 8px; font-size: 16px; color: var(--white); font-weight: 600; }
.option .tag { font-size: 12px; color: var(--gray); display: block; margin-bottom: 10px; }
.option.chosen .tag { color: var(--hl); }
.option p { font-size: 14px; margin: 0; }

/* ---------- architecture diagrams ---------- */
.architecture { margin: 24px 0 16px; }
.architecture svg { display: block; width: 100%; min-width: 720px; height: auto; }
.architecture { overflow-x: auto; padding: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.architecture figcaption { font-size: 13px; color: var(--gray); margin-top: 12px; }
.architecture svg text { font-family: 'Roboto Mono', monospace; text-anchor: middle; fill: var(--white); font-size: 15px; font-weight: 600; }
.architecture .diagram-label { text-anchor: start; fill: var(--hl); font-size: 12px; font-weight: 400; letter-spacing: .08em; }
.architecture .diagram-detail { fill: var(--gray); font-size: 12px; font-weight: 400; }
.architecture .diagram-priority { fill: var(--hl); font-size: 12px; font-weight: 400; }
.architecture .diagram-note { fill: var(--gray); font-size: 12px; font-weight: 400; }
.architecture .diagram-node rect { fill: var(--bg); stroke: var(--gray); stroke-width: 1.5; }
.architecture .diagram-node.selected rect, .architecture .diagram-output.selected rect { stroke: var(--hl); }
.architecture .diagram-output rect { fill: var(--bg); stroke: var(--gray); stroke-width: 1.5; }
.architecture .diagram-output text { font-size: 13px; }
.architecture .diagram-line { fill: none; stroke: var(--hl); stroke-width: 2; }
.architecture marker path { fill: var(--hl); }
.architecture .diagram-shards rect { fill: transparent; stroke: var(--hl); stroke-width: 1; }
.architecture .diagram-shards text { fill: var(--hl); font-size: 10px; font-weight: 400; }
.architecture .architecture-detailed { min-width: 780px; }
.architecture .diagram-zone rect { fill: transparent; stroke: var(--line); stroke-width: 1.5; }
.architecture .diagram-zone.selected rect { stroke: var(--hl); }
.architecture .diagram-zone-label { text-anchor: start; fill: var(--gray); font-size: 11px; font-weight: 400; letter-spacing: .08em; }
.architecture .diagram-storage path { fill: var(--bg); stroke: var(--hl); stroke-width: 1.5; }
.architecture .diagram-storage ellipse { fill: var(--panel); stroke: var(--hl); stroke-width: 1.5; }
.architecture .diagram-storage text { font-size: 13px; }
.architecture .diagram-mini-reader rect, .architecture .diagram-callout rect { fill: var(--bg); stroke: var(--gray); stroke-width: 1.25; }
.architecture .diagram-mini-reader text { font-size: 11px; font-weight: 400; }
.architecture .diagram-callout text { font-size: 11px; font-weight: 400; }
.architecture .diagram-dashed-line { fill: none; stroke: var(--gray); stroke-width: 1.5; stroke-dasharray: 4 5; }

/* Legacy architecture flow (kept for future plain-HTML diagrams). */
.flow {
  display: flex; align-items: stretch; gap: 0;
  margin: 24px 0 12px; padding: 22px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--panel);
}
.node {
  flex: 1 1 0; min-width: 0;
  border: 1px solid var(--gray); border-radius: 8px; padding: 12px 10px;
  text-align: center; font-size: 13px; line-height: 1.4; color: var(--text); background: var(--bg);
}
.node b { display: block; color: var(--white); font-size: 14px; margin-bottom: 4px; font-weight: 600; }
.node.key { border-color: var(--hl); }
.arrow { flex: 0 0 28px; display: flex; align-items: center; justify-content: center; color: var(--hl); font-size: 18px; }
.arrow::before { content: '\2192'; }
.shards { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.shards span { border: 1px dashed var(--hl); border-radius: 5px; font-size: 11px; padding: 3px 0; color: var(--hl); }
.flow-caption { font-size: 13px; color: var(--gray); margin: 0 0 16px; }

/* ---------- stack tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; list-style: none; }
.tags li { border: 1px solid var(--line); border-radius: 20px; padding: 4px 14px; font-size: 13px; color: var(--gray); }

/* ---------- footer ---------- */
.next {
  margin-top: 72px; padding-top: 28px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between;
}
.btn {
  display: inline-block; background: var(--hl); color: var(--bg); text-decoration: none;
  padding: 6px 22px; border-radius: 23px; transition: background-color .3s ease;
}
.btn:hover { background: var(--white); color: var(--bg); }
.back { color: var(--gray); text-decoration: none; }
.back:hover { color: var(--white); }

/* ---------- motion (only when JS runs; content is visible without it) ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); }
@media (prefers-reduced-motion: reduce) {
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .flow { flex-direction: column; padding: 16px; }
  .node { flex: none; }
  .arrow { flex: 0 0 26px; }
  .arrow::before { content: '\2193'; }
  .shards { grid-template-columns: repeat(4, 1fr); }
  .architecture { padding: 16px; }
}
@media (max-width: 720px) {
  body { font-size: 15px; }
  header { padding: 16px 16px 40px; }
  .logo img { width: 60px; }
  nav ul { gap: 14px; font-size: 14px; }
  .page { padding: 110px 16px 60px 34px; }
  .page::before { left: 12px; top: 120px; }
  .spine-dot { left: 6px; top: 120px; }
  .title { font-size: 32px; }
  .command { font-size: 17px; }
  h2 { font-size: 19px; margin-top: 48px; }
  .options { grid-template-columns: 1fr; }
  .stat .v { font-size: 19px; }
}
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
  .shards { grid-template-columns: 1fr 1fr; }
  nav .hide-xs { display: none; }
}

/* ---------- fork in a flow diagram ---------- */
.fork { flex: 1.3 1 0; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fork .node { flex: 1 1 auto; }

/* ---------- /work index ---------- */
.cases { display: grid; gap: 18px; margin-top: 36px; }
.case {
  display: flex; flex-direction: column; gap: 8px; text-decoration: none;
  border: 1px solid var(--line); border-radius: 10px; padding: 20px 22px;
  background: var(--panel); color: var(--text); transition: border-color .3s ease;
}
.case:hover { border-color: var(--hl); color: var(--text); }
.case-title { color: var(--white); font-weight: 600; font-size: 18px; line-height: 1.4; }
.case-sub { font-size: 14px; line-height: 1.6; }
.case-tags { font-size: 13px; color: var(--hl); }
@media (max-width: 860px) { .fork { flex: none; } }
