/* raava.dev — all CSS. Editorial case studies: warm paper, one serif, mono labels,
   a hand-drawn figure and a few stat tiles per project, one accent colour per project. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

:root {
  --bg: #f7f5f0;
  --surface: #fff;
  --ink: #141414;
  --muted: #5f5c55;
  --faint: #9a968c;
  --rule: #e3dfd5;
  --line: #cfc9bc;
  --well: #efece4;
  --accent: #141414;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --gutter: clamp(20px, 4vw, 56px);
  --wide: 1180px;
  --prose: 640px;
}
.p-crewops { --accent: #b4441b; }
.p-qwalo   { --accent: #2f7a44; }
.p-orthanc { --accent: #4a46c4; }
.p-bank    { --accent: #127068; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.45;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}

p { margin: 0; }
p + p { margin-top: 1em; }
h1, h2, h3 { margin: 0; font-weight: 400; letter-spacing: -0.015em; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
a:hover { text-decoration-color: currentColor; }
a[href^="https://"]::after { content: "↗"; font-size: 0.8em; margin-left: 0.15em; display: inline-block; text-decoration: none; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--surface); padding: 6px 10px; }

.mono { font-family: var(--mono); font-size: 0.8em; }
.label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.wrap { max-width: var(--wide); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── header ─────────────────────────────────────────────────────────── */
.hdr {
  position: sticky; top: 0; z-index: 5;
  background: rgba(247, 245, 240, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.hdr .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-top: 14px; padding-bottom: 14px; }
.wordmark {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 24px; letter-spacing: -0.01em; text-decoration: none; color: var(--ink); line-height: 1;
}
.wordmark img { width: 22px; height: 22px; }
.crumb { color: var(--muted); }
.crumb-slash { color: var(--faint); }
.idx { display: flex; flex-wrap: wrap; gap: 4px 22px; font-size: 16px; }
.idx a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.idx a:hover, .idx a[aria-current] { color: var(--ink); }
.idx .key { font-family: var(--mono); font-size: 11px; color: var(--faint); margin-right: 3px; }

/* ── hero ───────────────────────────────────────────────────────────── */
.hero { padding-top: clamp(48px, 9vw, 112px); padding-bottom: clamp(36px, 5vw, 64px); }
.kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.hero h1 { font-size: clamp(38px, 6vw, 68px); line-height: 1.04; max-width: 16ch; margin-top: 18px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.lede { font-size: clamp(19px, 2vw, 22px); line-height: 1.45; color: var(--muted); max-width: 42ch; margin-top: 24px; }
.statusline { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 4px 10px; white-space: nowrap;
}
.chip::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: 1px; }

/* ── figures (hand-drawn SVG) ───────────────────────────────────────── */
.fig { background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: clamp(16px, 2.6vw, 32px); margin: 0; }
.fig svg { display: block; width: 100%; max-width: 560px; height: auto; margin: 0 auto; overflow: visible; }
.fig figcaption { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 16px; text-align: center; }
.fig .box  { fill: var(--surface); stroke: var(--line); stroke-width: 1.2; }
.fig .boxa { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.fig .boxp { fill: var(--well); stroke: var(--line); stroke-width: 1.2; stroke-dasharray: 4 3; }
.fig .ln   { fill: none; stroke: var(--faint); stroke-width: 1.3; }
.fig .lna  { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.fig .dash { stroke-dasharray: 5 4; }
.fig .ah   { fill: var(--faint); }
.fig .aha  { fill: var(--accent); }
.fig .t    { font-family: var(--serif); font-size: 19px; fill: var(--ink); }
.fig .tm   { font-family: var(--mono); font-size: 12.5px; fill: var(--muted); }
.fig .ta   { font-family: var(--mono); font-size: 12.5px; fill: var(--accent); }
.fig .dot  { fill: var(--accent); }

/* the shared loop: wide on desktop, stacked on phone */
.loop .fig svg { max-width: none; }
.loop .tall { display: block; max-width: 360px; }
.loop .wide { display: none; }
@media (min-width: 760px) { .loop .tall { display: none; } .loop .wide { display: block; } }
.loop-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 24px; margin-bottom: 18px; }
.loop-head p { color: var(--muted); max-width: 50ch; font-size: 17px; }

/* ── case studies on the home page ──────────────────────────────────── */
.cases { margin-top: clamp(56px, 8vw, 104px); }
.case { border-top: 1px solid var(--rule); padding-top: clamp(40px, 6vw, 72px); padding-bottom: clamp(40px, 6vw, 72px); }
.case-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 14px; margin-bottom: 28px; }
.case-num { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.case-head h2 { font-size: clamp(32px, 4vw, 46px); line-height: 1.05; }
.case-head h2 a { text-decoration: none; }
.case-head h2 a:hover { color: var(--accent); }
.case-head .chip { margin-left: auto; align-self: center; }
.case-grid { display: grid; gap: 32px; }
@media (min-width: 960px) {
  .case-grid { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; align-items: center; }
  .case.flip .case-grid > :first-child { order: 2; }
}
.case-body .one { font-size: clamp(22px, 2.3vw, 26px); line-height: 1.3; }
.case-body .more { color: var(--muted); margin-top: 16px; }
.go { display: inline-block; margin-top: 26px; font-family: var(--mono); font-size: 13px; color: var(--accent); text-decoration: none; }
.go:hover { text-decoration: underline; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-top: 28px; }
.tiles > div { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px 16px; }
.tiles > div:first-child { box-shadow: inset 0 3px 0 var(--accent); }
.tiles dt { font-family: var(--mono); font-size: 11px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.tiles dd { font-size: 27px; line-height: 1.1; margin-top: 8px; }

/* ── project pages ──────────────────────────────────────────────────── */
.page-fig { margin-bottom: clamp(40px, 6vw, 72px); }
.page-grid { display: grid; gap: 40px; }
@media (min-width: 960px) {
  .page-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 80px; align-items: start; }
  .page-grid aside { position: sticky; top: 96px; }
}
.prose { max-width: var(--prose); }
.prose p { font-size: 19px; line-height: 1.6; }
.prose h3 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); margin: 44px 0 12px; }
.prose h3:first-child { margin-top: 0; }
aside .tiles { grid-template-columns: 1fr 1fr; margin-top: 0; }

.note { font-family: var(--mono); font-size: 12px; line-height: 1.6; color: var(--muted); margin-top: 16px; }
.linkrow { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 8px 24px; font-family: var(--mono); font-size: 13px; }
.linkrow a { color: var(--accent); }

/* install line */
.cmdline {
  font-family: var(--mono); font-size: 13px; background: #16161a; color: #eceae4;
  padding: 14px 16px; border-radius: 8px; white-space: pre; overflow-x: auto; margin-top: 28px;
}
.cmdline .prompt { color: #8d8a83; }

/* numbered tiers (CrewOps email, Qwalo cascade) */
.tiers { display: grid; gap: 8px; margin-top: 18px; }
.tiers li { display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: baseline; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 12px 14px; font-size: 17px; line-height: 1.4; }
.tiers li span { font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* ── Orthanc terminal demo ──────────────────────────────────────────── */
.demo { background: #16161a; color: #eceae4; border-radius: 12px; padding: 16px 20px 14px; margin: 0; min-width: 0; }
.demo .cap { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: #8d8a83; padding-bottom: 10px; }
.demo .lights { display: inline-flex; gap: 6px; margin-right: 10px; vertical-align: middle; }
.demo .lights i { width: 9px; height: 9px; border-radius: 50%; background: #3a3a40; display: inline-block; }
.step { display: grid; grid-template-columns: 1fr auto; column-gap: 14px; border-top: 1px solid #2a2a30; padding: 9px 0; font-family: var(--mono); font-size: 12.5px; }
.step .cmd { grid-column: 1; grid-row: 1; overflow-x: auto; white-space: pre; }
.step .prompt { color: #8f8cf0; }
.step .dur { grid-column: 2; grid-row: 1; text-align: right; color: #8d8a83; }
.step .res { display: block; color: #9fd8a8; }
.demo .note { color: #8d8a83; margin-top: 6px; }
@media (prefers-reduced-motion: no-preference) {
  .demo.anim .step { display: none; }
  .demo.anim .step.show { display: grid; }
  .demo.anim .step:not(.done) .res,
  .demo.anim .step:not(.done) .dur { display: none; }
}

/* ── contact band + footer ──────────────────────────────────────────── */
.band { margin-top: clamp(56px, 8vw, 104px); background: var(--ink); color: var(--bg); border-radius: 14px; padding: clamp(28px, 5vw, 56px); display: grid; gap: 22px; }
@media (min-width: 900px) { .band { grid-template-columns: 1fr auto; align-items: end; } }
.band h2 { font-size: clamp(28px, 3.6vw, 40px); line-height: 1.1; max-width: 22ch; }
.band p { color: #b9b5ab; margin-top: 12px; max-width: 50ch; }
.band .mail { font-family: var(--mono); font-size: 14px; color: var(--bg); text-decoration-color: #77736a; white-space: nowrap; }

.ftr { margin-top: 56px; border-top: 1px solid var(--rule); padding-top: 26px; padding-bottom: 40px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ftr a { text-decoration: none; }
.ftr a:hover { color: var(--ink); }
.ftr .fitem { white-space: nowrap; }
.keys { display: none; }
@media (min-width: 900px) {
  .keys { display: flex; gap: 12px; margin-top: 10px; }
  .keys a { text-decoration: none; color: var(--faint); }
  .keys a:hover { color: var(--ink); }
  .keys-toggle { font: inherit; color: var(--faint); background: none; border: 0; padding: 0; cursor: pointer; }
  .keys-toggle:hover { color: var(--ink); text-decoration: underline; }
}
