:root {
  --paper: #f3eee2;
  --paper2: #ebe4d3;
  --sheet: #fffdf6;
  --grid: rgba(47, 156, 75, .09);
  --ink: #1d2a22;
  --ink2: #4c5a50;
  --muted: #7a8378;
  --red: #c8323a;
  --green: #2f9c4b;
  --amber: #c98a12;
  --line: #d8cfbb;
  --head: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --hand: "Caveat", "Segoe Print", cursive;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0; color: var(--ink); font: 17px/1.6 var(--head); font-weight: 500;
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
}
a { color: var(--green); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
h1, h2 { font-family: var(--head); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; margin: 0; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin-bottom: 10px; }
.sub { color: var(--ink2); max-width: 640px; margin: 0 0 30px; }
section { padding: 84px 0; }

/* heartbeat line across the top */
.ecg { position: fixed; top: 0; left: 0; width: 100%; height: 26px; z-index: 30; pointer-events: none; }
.ecg path { fill: none; stroke: var(--red); stroke-width: 2.4; stroke-dasharray: 1600; stroke-dashoffset: 1600; animation: beat 4.5s linear infinite; vector-effect: non-scaling-stroke; }
@keyframes beat { to { stroke-dashoffset: -1600; } }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(243, 238, 226, .9); backdrop-filter: blur(6px); border-bottom: 2px solid var(--ink); }
.bar { display: flex; align-items: center; gap: 22px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.25rem; }
.brand img { image-rendering: pixelated; }
.top nav { display: flex; gap: 22px; margin-left: auto; }
.top nav a { color: var(--ink2); text-decoration: none; font-size: .95rem; }
.top nav a:hover { color: var(--ink); text-decoration: underline wavy var(--red); text-underline-offset: 5px; }
.lang { border: 2px solid var(--ink); background: var(--sheet); color: var(--ink); font: 600 .85rem var(--mono); padding: 5px 10px; cursor: pointer; box-shadow: 3px 3px 0 var(--ink); }
.lang:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }

/* hero */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center; padding-top: 70px; padding-bottom: 90px; }
.stamp-line { display: flex; align-items: center; gap: 10px; font: 500 .85rem var(--mono); color: var(--paper); text-transform: uppercase; letter-spacing: .06em; margin: 0 0 18px; }
.cross { width: 18px; height: 18px; position: relative; flex: none; }
.cross::before, .cross::after { content: ""; position: absolute; background: var(--red); }
.cross::before { left: 6px; top: 0; width: 6px; height: 18px; }
.cross::after { top: 6px; left: 0; width: 18px; height: 6px; }
h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); margin-bottom: 22px; }
h1 em { font-style: normal; color: var(--green); background: linear-gradient(transparent 62%, rgba(200, 50, 58, .18) 62%); }
.lead { font-size: 1.15rem; color: var(--ink2); max-width: 540px; margin: 0 0 28px; }
.cta { display: flex; gap: 14px; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; font-weight: 700; text-decoration: none; border: 2px solid var(--ink); transition: transform .1s, box-shadow .1s; }
.btn.ink { background: var(--ink); color: var(--paper); box-shadow: 4px 4px 0 var(--green); }
.btn.line { background: var(--sheet); color: var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.btn:hover { transform: translate(-1px, -1px); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.off { background: transparent; color: var(--muted); border-style: dashed; border-color: var(--muted); box-shadow: none; cursor: default; }
.scribble { font: 700 1.35rem var(--hand); color: var(--red); transform: rotate(-2deg); margin: 22px 0 0; }

/* patient chart */
.chart { position: relative; margin: 0; padding-top: 22px; transform: rotate(1.2deg); }
.clip { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 42px; background: linear-gradient(#b9bcc1, #8a8f96); border: 2px solid var(--ink); border-radius: 8px 8px 4px 4px; z-index: 2; }
.clip::after { content: ""; position: absolute; left: 34px; right: 34px; top: 8px; height: 10px; border-radius: 6px; background: var(--paper2); border: 2px solid var(--ink); }
.sheet { position: relative; background: var(--sheet); border: 2px solid var(--ink); box-shadow: 10px 10px 0 #8b5a2b, 10px 10px 0 2px var(--ink); padding: 34px 26px 26px; min-height: 430px; }
.sheet-head { display: flex; justify-content: space-between; font: 600 .85rem var(--mono); letter-spacing: .14em; border-bottom: 2px solid var(--ink); padding-bottom: 8px; }
.sheet-no { color: var(--red); }
.fields { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 16px 0 10px; font-size: .95rem; }
.fields dt { font: 500 .8rem var(--mono); text-transform: uppercase; color: var(--muted); padding-top: 4px; }
.fields dd { margin: 0; border-bottom: 1px dashed var(--line); font-weight: 700; min-height: 1.6em; }
.hand { font: 700 1.4rem/1.1 var(--hand) !important; color: #2a4a8a; }
.monitor { height: 50px; background: #13201a; border: 2px solid var(--ink); margin: 10px 0 14px; }
.monitor svg { width: 100%; height: 100%; display: block; }
.monitor path { fill: none; stroke: #6dff8f; stroke-width: 2; vector-effect: non-scaling-stroke; }
.findings { list-style: none; padding: 0; margin: 0; font: 500 .88rem/1.45 var(--mono); }
.findings li { display: grid; grid-template-columns: 24px 1fr; gap: 6px; padding: 6px 0; border-bottom: 1px solid #eee6d4; animation: write .35s ease-out; }
.findings .m { font-weight: 600; }
.findings .ok .m { color: var(--green); }
.findings .warn .m { color: var(--amber); }
.findings .bad .m { color: var(--red); }
.rx { font: 700 1.35rem/1.2 var(--hand); color: #2a4a8a; margin: 14px 0 0; min-height: 1.4em; }
.rx b { font: 600 .9rem var(--mono); color: var(--ink); margin-right: 6px; }
.seal { position: absolute; right: 22px; bottom: 20px; font: 700 .85rem var(--mono); letter-spacing: .2em; color: var(--red); border: 3px double var(--red); padding: 6px 10px; transform: rotate(-12deg) scale(1.6); opacity: 0; transition: opacity .2s, transform .25s cubic-bezier(.2, 1.8, .4, 1); }
.seal.on { opacity: .85; transform: rotate(-12deg) scale(1); }
@keyframes write { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* the ward: prescription slips */
.ward { background: var(--paper2); border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.beds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.bed { position: relative; background: var(--sheet); border: 2px solid var(--ink); padding: 16px 16px 14px; box-shadow: 4px 4px 0 var(--ink); }
.bed:nth-child(3n) { transform: rotate(.6deg); }
.bed:nth-child(4n+1) { transform: rotate(-.5deg); }
.bed .no { font: 600 .72rem var(--mono); color: var(--muted); letter-spacing: .1em; }
.bed h3 { font-size: 1.1rem; margin: 2px 0 6px; font-weight: 800; }
.bed .for { font: 700 1.15rem/1.1 var(--hand); color: var(--red); margin: 0 0 8px; }
.bed ul { margin: 0; padding-left: 16px; color: var(--ink2); font-size: .88rem; line-height: 1.45; }

/* timeline */
.timeline { list-style: none; margin: 30px 0 0; padding: 0 0 0 28px; border-left: 3px solid var(--ink); }
.timeline li { position: relative; padding: 0 0 30px 20px; max-width: 720px; }
.timeline li::before { content: ""; position: absolute; left: -38px; top: 4px; width: 16px; height: 16px; background: var(--sheet); border: 3px solid var(--green); border-radius: 50%; }
.timeline .time { font: 600 .8rem var(--mono); color: var(--red); display: block; }
.timeline b { font-size: 1.2rem; }
.timeline p { margin: 4px 0 0; color: var(--ink2); }

/* pharmacy */
.pharmacy { background: #e7efe1; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.shelf { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.bottle { background: var(--sheet); border: 2px solid var(--ink); border-radius: 18px 18px 6px 6px; padding: 0 0 14px; text-align: center; box-shadow: 4px 4px 0 var(--ink); overflow: hidden; }
.bottle .cap { background: var(--ink); color: var(--paper); font: 600 .78rem var(--mono); letter-spacing: .12em; padding: 6px 0; }
.bottle .cap.fabric { background: #6b5a3c; }
.bottle .cap.neoforge { background: #c26a1a; }
.bottle .cap.forge { background: #2c3e66; }
.bottle .mc { font-size: 1.7rem; font-weight: 800; margin: 12px 0 0; }
.bottle .needs { font: 500 .78rem var(--mono); color: var(--muted); min-height: 1.2em; }
.bottle a { display: inline-block; margin-top: 10px; font: 600 .85rem var(--mono); color: var(--ink); text-decoration: none; border: 2px solid var(--ink); padding: 6px 14px; background: #fff; }
.bottle a:hover { background: var(--green); color: #fff; }
.bottle .kb { display: block; font: 400 .72rem var(--mono); color: var(--muted); margin-top: 6px; }
.links { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 14px; }
.fine { font: 400 .85rem var(--mono); color: var(--ink2); max-width: 760px; }

/* doctor's notes */
.note-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.notes details { background: #fff8c9; border: 2px solid var(--ink); padding: 14px 18px; box-shadow: 3px 3px 0 var(--ink); }
.notes details:nth-child(odd) { transform: rotate(-.4deg); }
.notes summary { cursor: pointer; font-weight: 800; }
.notes p { font: 700 1.25rem/1.3 var(--hand); color: #2a3a5a; margin: 10px 0 0; }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 28px 20px 40px; font: 400 .82rem var(--mono); color: var(--ink2); }

@media (max-width: 960px) {
  .beds, .shelf { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 50px; padding-top: 44px; }
  .top nav { display: none; }
  .lang { margin-left: auto; }
  .note-grid { grid-template-columns: 1fr; }
  .chart { transform: none; }
  .sheet { min-height: 0; }
  .fields { grid-template-columns: 92px 1fr; }
  section { padding: 60px 0; }
}
@media (max-width: 480px) {
  .beds, .shelf { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ecg path { animation: none; stroke-dashoffset: 0; }
  .findings li { animation: none; }
}
