/* nabaruns.com — hand-written, no framework, no build step. */

/* ---------- fonts (self-hosted, latin subset) ---------- */

@font-face {
  font-family: 'Newsreader';
  src: url('../fonts/newsreader-latin.woff2?v=5') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Newsreader';
  src: url('../fonts/newsreader-italic-latin.woff2?v=5') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/plexmono-400-latin.woff2?v=5') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/plexmono-500-latin.woff2?v=5') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */

:root {
  --paper: #faf8f4;
  --ink: #171614;
  --muted: #6b6660;
  --rule: #e3ded4;
  --accent: #9c3b1b;
  --accent-soft: #c9a08c;

  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Charter, Georgia, serif;
  --mono: 'Plex Mono', ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  --deva: 'Noto Serif Devanagari', 'Kohinoor Devanagari', 'Devanagari MT', 'Nirmala UI', var(--serif);

  --measure: 34rem;
  --page: 44rem;
  --gap: 2.75rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14130f;
    --ink: #e8e3d9;
    --muted: #9a948a;
    --rule: #2c2a24;
    --accent: #e08a5f;
    --accent-soft: #7a4c37;
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.1875rem);
  line-height: 1.65;
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 1px;
}

h1,
h2,
h3 {
  font-weight: 400;
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0 0 1.15em;
  max-width: var(--measure);
  text-wrap: pretty;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* ---------- page frame ---------- */

.page {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3rem, 9vw, 6.5rem) clamp(1.35rem, 6vw, 2.5rem) 4rem;
}

/* ---------- masthead ---------- */

.masthead {
  margin-bottom: var(--gap);
  display: flex;
  align-items: flex-start;
  gap: 1.75rem;
}

.identity {
  min-width: 0;
}

.portrait {
  display: block;
  width: 112px;
  height: 112px;
  object-fit: cover;
  background: var(--rule);
}

.masthead h1 {
  font-size: clamp(2rem, 1.5rem + 2.2vw, 2.75rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 0.5rem;
}

.standfirst {
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-bottom: 1.35rem;
}

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.15rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.elsewhere a {
  text-decoration-color: var(--rule);
}

/* codev.ai channels: icon row under the contact links */

.channels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin: 0.85rem 0 0;
  max-width: none;
}

.channels a {
  display: inline-flex;
  color: var(--muted);
  text-decoration: none;
  transition: color 120ms ease;
}

.channels a:hover {
  color: var(--accent);
}

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

.channels svg {
  display: block;
  width: 17px;
  height: 17px;
  fill: currentColor;
}

/* ---------- QR ---------- */

.qr-open,
.reveal,
.draw-clear {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 120ms ease, text-decoration-color 120ms ease;
}

.qr-open:hover,
.reveal:hover,
.draw-clear:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.qr-open:focus-visible,
.reveal:focus-visible,
.draw-clear:focus-visible,
.qr-close:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- doodle layer ---------- */

.doodle {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  pointer-events: none;
}

/* the pencil is the default cursor once the layer is live (fine pointers, JS on),
   hotspot at the tip; anything clickable keeps its own cursor */
body.can-draw {
  cursor: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='28' viewBox='0 0 28 28'%3E%3Cpath d='M3 25l1.4-4.6L18 6.8l3.2 3.2L7.6 23.6z' fill='%23e8b9a6' stroke='%23171614' stroke-width='1.3' stroke-linejoin='round'/%3E%3Cpath d='M3 25l1.4-4.6 1.6 1.6 1.6 1.6z' fill='%23171614'/%3E%3Cpath d='M19.4 5.4l2-2a1.7 1.7 0 0 1 2.4 0l.8.8a1.7 1.7 0 0 1 0 2.4l-2 2z' fill='%239c3b1b' stroke='%23171614' stroke-width='1.3' stroke-linejoin='round'/%3E%3C/svg%3E") 3 25, crosshair;
}

body.can-draw a,
body.can-draw button,
body.can-draw summary,
body.can-draw label {
  cursor: pointer;
}

.qr-dialog {
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  padding: 0;
  max-width: min(21rem, calc(100vw - 2rem));
}

.qr-dialog::backdrop {
  background: rgb(23 22 20 / 0.6);
}

.qr-body {
  padding: 1.75rem;
  text-align: center;
}

.qr-title {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.25rem;
  max-width: none;
}

/* the code stays dark-on-light in both themes — scanners are unreliable on inverted codes */
.qr-code {
  width: 208px;
  height: 208px;
  margin: 0 auto;
  padding: 14px;
  background: #fff;
  color: #171614;
}

.qr-code svg {
  display: block;
  width: 100%;
  height: 100%;
}

.qr-url {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--accent);
  margin: 1.1rem 0 1.4rem;
  max-width: none;
}

.qr-close {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--rule);
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease;
}

.qr-close:hover {
  color: var(--ink);
  border-color: var(--muted);
}

/* ---------- sections ---------- */

section + section {
  margin-top: var(--gap);
}

.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.6rem;
}

.lede p:last-child {
  margin-bottom: 0;
}

/* ---------- ledger rows ---------- */

.ledger > li + li {
  margin-top: 1.5rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: 1.5rem;
  row-gap: 0.15rem;
}

.row-title {
  font-size: 1em;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.row-title .at {
  font-weight: 400;
  color: var(--muted);
}

.row-date {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
  margin: 0;
  text-align: right;
}

.row-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.9375em;
  margin: 0.1rem 0 0;
}

/* the current thing: given room to breathe */

.feature .row-note {
  color: var(--ink);
  font-size: 1em;
  margin-top: 0.6rem;
}

.feature .row-note + .row-note {
  color: var(--muted);
  font-size: 0.9375em;
  margin-top: 0.65rem;
}

/* two-column name / gloss list, for the products */

.gloss {
  margin-top: 1.35rem;
  border-top: 1px solid var(--rule);
}

.gloss li {
  display: grid;
  grid-template-columns: minmax(0, 11rem) 1fr;
  column-gap: 1.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--rule);
}

.gloss .name {
  font-family: var(--mono);
  font-size: 0.8125rem;
  align-self: center;
}

.gloss .what {
  color: var(--muted);
  font-size: 0.9375em;
  align-self: center;
}

/* ---------- footer ---------- */

.colophon {
  margin-top: calc(var(--gap) * 1.4);
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.75;
  color: var(--muted);
}

.colophon p {
  max-width: none;
  margin: 0;
}

.verse {
  margin: 0 0 1.5rem;
  color: var(--muted);
}

.verse .sa {
  font-family: var(--deva);
  font-size: 1.0625rem;
  line-height: 1.9;
  color: var(--ink);
  display: block;
  margin-bottom: 0.35rem;
}

.verse .en {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1rem;
  display: block;
}

.verse cite {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---------- narrow ---------- */

@media (max-width: 34rem) {
  .masthead {
    flex-direction: column;
    gap: 1.25rem;
  }

  .row {
    grid-template-columns: 1fr;
  }

  .row-date {
    text-align: left;
    order: -1;
    margin-bottom: 0.2rem;
  }

  .gloss li {
    grid-template-columns: 1fr;
    row-gap: 0.1rem;
  }
}

/* ---------- print ---------- */

@media print {
  :root {
    --paper: #fff;
    --ink: #000;
    --muted: #444;
    --rule: #ccc;
    --accent: #000;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  a {
    text-decoration: none;
  }

  /* the overlay is one tall canvas — it cannot survive page breaks */
  .doodle,
  .qr-open,
  .draw-clear {
    display: none;
  }
}
