/* =========================================================
   Hassan Tsuma — portfolio design system
   Concept: "the ledger" — a technical/financial-document
   register (rule lines, tabular figures, section indices)
   grounded in the actual RentManager work (append-only
   ledgers, sequential migrations, audit trails).
   ========================================================= */

:root {
  /* ---- color: light (default) ---- */
  --bg: #F1F3F1;
  --surface: #FFFFFF;
  --surface-2: #E7EBE8;
  --ink: #171B1A;
  --ink-muted: #4B5450;
  --ink-faint: #636A67;
  --rule: #D3D9D5;
  --rule-strong: #B8C1BC;
  --accent: #A6691F;
  --accent-ink: #7A4E16;
  --accent-soft: #F1E3CD;
  --good: #2F6F5E;
  --good-soft: #E3EFEA;
  --warn: #9C4A2E;
  --warn-soft: #F3E6DF;
  --focus: #2F6F5E;

  --font-display: "Spectral", Georgia, "Times New Roman", serif;
  --font-body: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 66ch;
  --page-max: 1120px;
  --gutter: clamp(20px, 5vw, 64px);

  --radius-s: 3px;
  --radius-m: 6px;

  --shadow-sm: 0 1px 2px rgba(23,27,26,0.05), 0 1px 1px rgba(23,27,26,0.04);
  --shadow-md: 0 6px 18px -4px rgba(23,27,26,0.11), 0 2px 6px rgba(23,27,26,0.05);
  --shadow-lg: 0 22px 50px -14px rgba(23,27,26,0.20), 0 6px 16px -6px rgba(23,27,26,0.08);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161A;
    --surface: #171D21;
    --surface-2: #1F262B;
    --ink: #EAEBE5;
    --ink-muted: #ABB3AD;
    --ink-faint: #838C86;
    --rule: #2B3339;
    --rule-strong: #384049;
    --accent: #E0A94A;
    --accent-ink: #F2C879;
    --accent-soft: #2E2517;
    --good: #4FA98C;
    --good-soft: #17251F;
    --warn: #D97B57;
    --warn-soft: #2A1D17;
    --focus: #4FA98C;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.32);
    --shadow-md: 0 8px 22px -4px rgba(0,0,0,0.48), 0 2px 8px rgba(0,0,0,0.32);
    --shadow-lg: 0 26px 60px -14px rgba(0,0,0,0.58), 0 8px 20px -6px rgba(0,0,0,0.38);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #12161A;
  --surface: #171D21;
  --surface-2: #1F262B;
  --ink: #EAEBE5;
  --ink-muted: #ABB3AD;
  --ink-faint: #838C86;
  --rule: #2B3339;
  --rule-strong: #384049;
  --accent: #E0A94A;
  --accent-ink: #F2C879;
  --accent-soft: #2E2517;
  --good: #4FA98C;
  --good-soft: #17251F;
  --warn: #D97B57;
  --warn-soft: #2A1D17;
  --focus: #4FA98C;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.32);
  --shadow-md: 0 8px 22px -4px rgba(0,0,0,0.48), 0 2px 8px rgba(0,0,0,0.32);
  --shadow-lg: 0 26px 60px -14px rgba(0,0,0,0.58), 0 8px 20px -6px rgba(0,0,0,0.38);
  color-scheme: dark;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  margin: 0;
  padding-inline: var(--gutter);
  -webkit-font-smoothing: antialiased;
}

/* faint paper grain — a considered nod to the ledger/document register, not decoration */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2000;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}
@media (prefers-reduced-motion: reduce) {
  body::before { opacity: 0.025; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

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

.measure { max-width: var(--measure); }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--bg);
  padding: 10px 16px;
  z-index: 200;
  font-family: var(--font-mono);
  font-size: 13px;
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---- type ---- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}
h1 { font-size: clamp(2.3rem, 3.2vw + 1.2rem, 3.6rem); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 1.6vw + 1.1rem, 2.35rem); }
h3 { font-size: clamp(1.25rem, 0.6vw + 1.05rem, 1.5rem); }
h4 { font-size: 1.05rem; }

p { margin: 0; }
.lede { font-size: clamp(1.05rem, 0.4vw + 1rem, 1.2rem); color: var(--ink-muted); line-height: 1.65; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  width: 14px;
  height: 1px;
  background: currentColor;
  display: inline-block;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.hairline { border: none; border-top: 1px solid var(--rule); margin: 0; }

/* ---- layout helpers ---- */
.stack { display: flex; flex-direction: column; }
.section { padding-block: clamp(52px, 8vw, 108px); }
.section + .section { border-top: 1px solid var(--rule); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 4vw, 56px); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 32px); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(16px, 2.4vw, 24px); }
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15.5px; }
}

/* ---- ledger margin: a section index + rule that runs beside content ---- */
.ledger-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: clamp(16px, 3vw, 32px);
}
.ledger-row > div { min-width: 0; }
@media (max-width: 720px) {
  .ledger-row { grid-template-columns: 1fr; }
  .ledger-row .ledger-index { display: flex; align-items: center; gap: 10px; }
}
.ledger-index {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-faint);
  padding-top: 4px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.folio-num {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
.folio-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
@media (max-width: 720px) {
  .ledger-index { border-right: none; border-bottom: 1px solid var(--rule); padding: 0 0 10px 0; }
  .ledger-row .ledger-index { flex-direction: row; align-items: baseline; gap: 10px; }
  .folio-num { font-size: 1.2rem; }
}

/* ---- scroll progress ---- */
.progress-rail {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 100%;
  z-index: 210;
  background: transparent;
  pointer-events: none;
}
.progress-rail::before {
  content: "";
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
}
@media (prefers-reduced-motion: no-preference) {
  .progress-rail::before { transition: width 80ms linear; }
}

/* ---- header / nav ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 16px;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.08rem;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}
.brand .brand-mark {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.72rem;
  color: var(--bg);
  background: var(--ink);
  border-radius: var(--radius-s);
  padding: 3px 6px;
  letter-spacing: 0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2vw, 28px);
  font-size: 0.93rem;
}
.nav-links a {
  position: relative;
  text-decoration: none;
  color: var(--ink-muted);
  padding-block: 4px;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-cta {
  font-size: 0.88rem !important;
  color: var(--bg) !important;
  background: var(--ink);
  padding: 9px 16px;
  border-radius: var(--radius-m);
  border-bottom: none !important;
}
.nav-cta:hover { background: var(--accent-ink); color: var(--bg) !important; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-s);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}
@media (max-width: 780px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--rule);
    padding: 12px var(--gutter) 20px;
    gap: 14px;
  }
  .nav-cta { align-self: flex-start; }
}

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.96rem;
  text-decoration: none;
  padding: 13px 22px;
  border-radius: var(--radius-m);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.06);
}
.btn-primary:hover { background: var(--accent-ink); transform: translateY(-2px); box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.08); }
.btn-primary:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule-strong); }
.btn-ghost:hover { border-color: var(--ink); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.btn-sm { padding: 9px 16px; font-size: 0.88rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- cards / surfaces ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: clamp(20px, 2.4vw, 30px);
  box-shadow: var(--shadow-sm);
}

.tag {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-muted);
}
.tag.good { color: var(--good); background: var(--good-soft); border-color: transparent; }
.tag.warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.tag.accent { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

/* ---- stat strip ---- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-block: 14px;
  border-top: 1px solid var(--rule);
}
.stat .n {
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 1.4vw + 1rem, 2rem);
  font-weight: 500;
}
.stat .label { font-size: 0.85rem; color: var(--ink-muted); }

/* ---- ledger table (used for stack/toolkit/migrations) ---- */
.ledger-table { width: 100%; border-collapse: collapse; }
.ledger-table th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
  padding: 0 12px 10px 0;
  border-bottom: 1px solid var(--rule-strong);
}
.ledger-table td {
  padding: 13px 12px 13px 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  font-size: 0.93rem;
}
.ledger-table tr:last-child td { border-bottom: none; }
.ledger-table td:first-child, .ledger-table th:first-child { padding-left: 0; }
.ledger-table .col-label { color: var(--ink-muted); white-space: nowrap; }
@media (max-width: 640px) {
  .ledger-table, .ledger-table thead, .ledger-table tbody, .ledger-table th, .ledger-table td, .ledger-table tr { display: block; }
  .ledger-table thead { display: none; }
  .ledger-table tr { padding-block: 12px; border-bottom: 1px solid var(--rule); }
  .ledger-table td { border-bottom: none; padding: 3px 0; }
  .ledger-table .col-label { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
}

/* ---- footer ---- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding-block: 40px;
  margin-top: clamp(40px, 6vw, 80px);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--ink-faint);
}
.site-footer a { text-decoration: none; color: var(--ink-muted); }
.site-footer a:hover { color: var(--ink); }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }

/* ---- reveal-on-scroll ---- */
.reveal {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 1;
    transform: translateY(14px);
    transition: transform 560ms ease;
  }
  .reveal.is-visible { transform: none; }

  /* staggered choreography for card grids — each item settles slightly
     after the one before it, rather than arriving as a single block */
  .grid-2 .reveal:nth-child(2), .grid-3 .reveal:nth-child(2), .grid-4 .reveal:nth-child(2) { transition-delay: 70ms; }
  .grid-2 .reveal:nth-child(3), .grid-3 .reveal:nth-child(3), .grid-4 .reveal:nth-child(3) { transition-delay: 140ms; }
  .grid-2 .reveal:nth-child(4), .grid-3 .reveal:nth-child(4), .grid-4 .reveal:nth-child(4) { transition-delay: 210ms; }
}

/* ---- editorial pull-quote (used inside a .section, which already
   carries the top rule via .section + .section) ---- */
.pull-quote blockquote {
  margin: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.5rem, 1.6vw + 1.1rem, 2.1rem);
  line-height: 1.35;
  max-width: 28ch;
  color: var(--ink);
  text-wrap: balance;
}
.pull-quote cite {
  display: block;
  margin-top: 18px;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

/* ---- form ---- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 0.85rem; color: var(--ink-muted); }
.field input, .field textarea, .field select {
  font-family: var(--font-body);
  font-size: 0.96rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-s);
  padding: 11px 12px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent);
}
.field textarea { resize: vertical; min-height: 100px; font-family: var(--font-body); }
.form-msg { font-size: 0.88rem; padding: 10px 12px; border-radius: var(--radius-s); }
.form-msg.success { background: var(--good-soft); color: var(--good); }
.form-msg.error { background: var(--warn-soft); color: var(--warn); }
[hidden] { display: none !important; }

/* ---- utility ---- */
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; } .mt-48 { margin-top: 48px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.muted { color: var(--ink-muted); }
.faint { color: var(--ink-faint); }
.small { font-size: 0.86rem; }
.shot {
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
}
.shot img { width: 100%; height: auto; }

/* ---- browser chrome frame for screenshot exhibits ---- */
.browser-chrome {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
}
.browser-chrome .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rule-strong);
  flex-shrink: 0;
}
.browser-chrome .url {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 12px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.shot-cap {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-faint);
  padding: 8px 2px 0;
}
.diagram-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  background: var(--surface-2);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
@media (max-width: 700px) {
  .diagram-scroll { box-shadow: var(--shadow-sm), inset -16px 0 12px -12px var(--rule); }
}

/* ---- portrait treatment (About page) ---- */
.grid-photo {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
@media (max-width: 860px) {
  .grid-photo { grid-template-columns: 1fr; }
}
.portrait-frame {
  position: relative;
  margin: 0;
  border-radius: var(--radius-m);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background: var(--surface-2);
}
.portrait-frame img { width: 100%; height: auto; display: block; }
.portrait-frame figcaption {
  position: absolute;
  left: 14px;
  bottom: 14px;
  background: color-mix(in srgb, var(--ink) 86%, transparent);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: var(--radius-s);
}
@media (max-width: 860px) {
  .portrait-frame { max-width: 280px; }
}

/* ---- avatar byline (homepage About preview) ---- */
.quote-byline { display: flex; align-items: center; gap: 12px; }
.avatar-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--surface);
  flex-shrink: 0;
}

/* =========================================================
   AVAILABILITY — an "open entry" in the register.
   Status is stated plainly and repeated at the foot of every
   page, rather than shouted in a banner.
   ========================================================= */

.availability {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--good);
  background: var(--good-soft);
  border: 1px solid color-mix(in srgb, var(--good) 28%, transparent);
  border-radius: 999px;
  padding: 6px 14px 6px 12px;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}
a.availability:hover { border-color: var(--good); transform: translateY(-1px); }

.availability .pip {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  flex-shrink: 0;
  position: relative;
}
@media (prefers-reduced-motion: no-preference) {
  .availability .pip::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid var(--good);
    animation: pip-ring 2.6s ease-out infinite;
  }
}
@keyframes pip-ring {
  0%   { transform: scale(0.55); opacity: 0.85; }
  70%  { transform: scale(1.5);  opacity: 0; }
  100% { transform: scale(1.5);  opacity: 0; }
}

/* header variant — quieter, and stood down on narrow screens
   where the nav already competes for the same row */
.site-header .availability {
  padding: 5px 11px 5px 10px;
  font-size: 11px;
}
@media (max-width: 1080px) {
  .site-header .availability { display: none; }
}

/* the availability panel: a register of what I'm looking for,
   set on rule lines like the rest of the site */
.avail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0 clamp(24px, 4vw, 48px);
}
@media (max-width: 720px) { .avail-grid { grid-template-columns: 1fr; } }

.avail-item {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 12px;
  align-items: start;
  padding-block: 15px;
  border-top: 1px solid var(--rule);
}
.avail-item .check {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--good);
  line-height: 1.5;
}
.avail-item p { font-size: 0.88rem; color: var(--ink-muted); margin-top: 3px; }

/* =========================================================
   SKILLS — segmented meters that read like tick marks in a
   ledger column, not a marketing progress bar. Every meter is
   paired with a written claim, because a bar alone says nothing.
   ========================================================= */

.skill-group + .skill-group { margin-top: 40px; }
.skill-group > h3 {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-strong);
}

.skill-row {
  display: grid;
  grid-template-columns: minmax(148px, 1fr) 78px minmax(0, 2fr);
  gap: 8px clamp(14px, 2vw, 26px);
  align-items: baseline;
  padding-block: 13px;
  border-bottom: 1px solid var(--rule);
}
.skill-row:last-child { border-bottom: none; }
.skill-name { font-weight: 600; font-size: 0.95rem; }
.skill-note { font-size: 0.86rem; color: var(--ink-muted); }

@media (max-width: 720px) {
  .skill-row { grid-template-columns: 1fr auto; align-items: center; row-gap: 4px; }
  .skill-note { grid-column: 1 / -1; }
}

.meter {
  --lvl: 3;
  display: block;
  width: 78px;
  height: 9px;
  background: linear-gradient(
    to right,
    var(--accent) 0 calc(var(--lvl) / 5 * 100%),
    var(--rule) calc(var(--lvl) / 5 * 100%) 100%
  );
  -webkit-mask-image: repeating-linear-gradient(to right, #000 0 13.2px, transparent 13.2px 15.6px);
  mask-image: repeating-linear-gradient(to right, #000 0 13.2px, transparent 13.2px 15.6px);
  justify-self: start;
}
@media (max-width: 720px) { .meter { justify-self: end; } }

.meter-key {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.meter-key span { display: inline-flex; align-items: center; gap: 8px; }

/* =========================================================
   SURFACE CARDS — the three clients RentManager ships on.
   ========================================================= */

.surface-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.surface-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--rule-strong); }
.surface-card .kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.surface-card h3 { font-size: 1.12rem; }
.surface-card p { font-size: 0.89rem; color: var(--ink-muted); }
.surface-card .stackline {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-faint);
}

/* =========================================================
   THEME TOGGLE — the palette already supported light and dark;
   this hands the reader the switch.
   ========================================================= */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-m);
  color: var(--ink-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 160ms ease, border-color 160ms ease;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
}

.header-tools { display: inline-flex; align-items: center; gap: 12px; }

/* =========================================================
   MISC
   ========================================================= */

.livelink {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding-bottom: 1px;
}
.livelink:hover { border-bottom-color: var(--accent); }

a.shot { display: block; text-decoration: none; color: inherit; transition: box-shadow 200ms ease, transform 200ms ease; }
a.shot:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }

.cta-band {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  padding: clamp(28px, 4vw, 52px);
  box-shadow: var(--shadow-sm);
}

.btn-wa { background: #1E8E4E; color: #FFFFFF; border-color: transparent; }
.btn-wa:hover { background: #17733F; color: #FFFFFF; transform: translateY(-2px); box-shadow: var(--shadow-md); }

.contact-row { display: flex; gap: 12px; flex-wrap: wrap; }
.copy-mail {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  background: none;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--radius-s);
  color: var(--ink-muted);
  padding: 8px 12px;
  cursor: pointer;
}
.copy-mail:hover { border-color: var(--ink); color: var(--ink); }

/* =========================================================
   UI REFINEMENTS
   ========================================================= */

/* Anchored sections were landing under the sticky header.
   Offset them by the header's height plus a little air. */
:target,
section[id],
main [id] {
  scroll-margin-top: 96px;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Stop single-word last lines in body copy. */
p, li, .skill-note, .avail-item p {
  text-wrap: pretty;
}

/* Inline links inside prose: underlined from the start, so they read
   as links without relying on colour alone. */
.prose-link,
.measure a:not(.btn):not(.livelink):not(.availability),
.skill-note a,
.avail-item a,
.ledger-table a:not(.btn) {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  transition: text-decoration-color 160ms ease;
}
.prose-link:hover,
.measure a:not(.btn):not(.livelink):not(.availability):hover,
.skill-note a:hover,
.avail-item a:hover,
.ledger-table a:not(.btn):hover {
  text-decoration-color: var(--accent);
}

/* Cards lift like the surface cards already did. */
.card {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--rule-strong);
}
/* the dashed quote card is a panel, not a target — hold it still */
.card[style*="dashed"]:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--rule);
}

/* Stat tiles: heavier rule above the figure, so the row reads as a
   set of columns in a table rather than four loose numbers. */
.stat {
  border-top-width: 2px;
  border-top-color: var(--rule-strong);
  transition: border-top-color 200ms ease;
}
.stat:hover { border-top-color: var(--accent); }
.stat .n {
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat .label { line-height: 1.4; }

/* Table rows respond to the cursor, which helps on the wide
   principle/priority tables where a row spans the full measure. */
.ledger-table tbody tr {
  transition: background 160ms ease;
}
.ledger-table tbody tr:hover {
  background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}
@media (max-width: 640px) {
  .ledger-table tbody tr:hover { background: transparent; }
}

/* Skill rows: a hover band makes a long list scannable. */
.skill-row {
  transition: background 150ms ease;
  padding-inline: 8px;
  margin-inline: -8px;
  border-radius: var(--radius-s);
}
.skill-row:hover {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

/* Availability rows get the same treatment. */
.avail-item {
  transition: border-top-color 180ms ease;
}
.avail-item:hover { border-top-color: var(--good); }

/* Headings sit a little tighter, and the folio number reads as a
   printed page number rather than body text. */
h1 { letter-spacing: -0.025em; }
h2 { letter-spacing: -0.012em; }
.folio-num { letter-spacing: -0.01em; }

/* Section index gains a hairline that runs the full height of its
   column, reinforcing the register conceit. */
@media (min-width: 721px) {
  .ledger-index { align-self: stretch; }
}

/* Mobile navigation: full-width rows with real tap targets. */
@media (max-width: 780px) {
  .nav-links.open a {
    display: block;
    width: 100%;
    padding-block: 10px;
    border-bottom: 1px solid var(--rule);
  }
  .nav-links.open a:last-child { border-bottom: none; }
  .nav-links.open .nav-cta {
    width: auto;
    padding: 11px 18px;
    margin-top: 6px;
    border-bottom: none;
  }
  .nav-toggle, .theme-toggle { min-height: 40px; }
  .nav-toggle { min-width: 56px; justify-content: center; }
}

/* Buttons: a crisper pressed state and a wider tap target on touch. */
.btn { line-height: 1.2; }
@media (hover: none) {
  .btn { padding-block: 15px; }
}

/* The CTA band picks up a hairline accent along its top edge. */
.cta-band {
  position: relative;
  overflow: hidden;
}
.cta-band::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(to right, var(--accent), color-mix(in srgb, var(--accent) 20%, transparent));
}

/* Screenshot frames: caption sits on its own band. */
.shot-cap {
  border-top: 1px solid var(--rule);
  margin-top: 0;
  padding: 9px 14px;
  background: var(--surface-2);
}

/* Selection and focus, tuned per theme. */
::selection { background: var(--accent-soft); color: var(--accent-ink); }
:focus-visible { outline-width: 2px; outline-offset: 3px; border-radius: 2px; }

/* Print: a recruiter who prints this should get something readable —
   no grain, no sticky chrome, and links that show their destination. */
@media print {
  body { background: #fff; color: #000; padding: 0; font-size: 11pt; }
  body::before, .progress-rail, .site-header, .theme-toggle,
  .nav-toggle, .cta-band, .shot, .skip-link { display: none !important; }
  .section { padding-block: 14pt; border-top: 1px solid #ccc; }
  .section + .section { border-top: 1px solid #ccc; }
  a { color: #000; text-decoration: underline; }
  main a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; color: #555; }
  .ledger-row { grid-template-columns: 48px 1fr; }
  .availability { border: 1px solid #000; color: #000; background: none; }
  .meter { outline: 1px solid #999; }
  h1, h2, h3 { break-after: avoid; }
  .skill-row, .avail-item, tr { break-inside: avoid; }
}

/* =========================================================
   CODE EXCERPTS — a quoted passage from a source file, set
   like an exhibit: filename above, commentary below.
   ========================================================= */

.excerpt {
  margin: 0 0 clamp(28px, 4vw, 44px);
  border: 1px solid var(--rule);
  border-radius: var(--radius-m);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.excerpt:last-of-type { margin-bottom: 0; }

.excerpt figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
}
.excerpt figcaption .mono {
  font-size: 12px;
  color: var(--ink-muted);
}
.excerpt figcaption a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--accent-ink);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.excerpt figcaption a:hover { border-bottom-color: var(--accent); }

.excerpt pre {
  margin: 0;
  padding: 18px 16px;
  border-left: 2px solid var(--accent);
  /* These excerpts are prose comments, not code that depends on column
     alignment, so wrapping beats a horizontal scrollbar. Without the
     min-width reset the <pre> refuses to shrink inside the grid track and
     drags the whole page wider than the phone. */
  max-width: 100%;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.excerpt { max-width: 100%; min-width: 0; }
.excerpt code {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.72;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .excerpt code { font-size: 11.5px; line-height: 1.65; }
  .excerpt pre { padding: 14px 13px; }
}

.excerpt-note {
  margin: 0;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.excerpt-note code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-s);
  padding: 1px 5px;
}

/* inline code used in running prose elsewhere on the site */
.measure code, .skill-note code, td code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-s);
  padding: 1px 5px;
}

@media print {
  .excerpt { break-inside: avoid; box-shadow: none; }
  .excerpt pre { border-left: 2px solid #999; }
}
