/* ═══════════════════════════════════════════════════════════
   humusic — base.css
   Design system: "PRESS"

   A music-publishing house, not a SaaS dashboard. Bone paper,
   navy-black ink taken from the app icon's glyphs, and the
   icon's electric blue used structurally rather than
   decoratively. Depth comes from hairline rules and frosted
   glass over ruled staves — never from drop shadows.
   ═══════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────
   FONTS — self-hosted so the iOS bundle runs fully offline
   ────────────────────────────────────────────────────────── */
@font-face {
  font-family: 'Bodoni Moda';
  src: url('vendor/fonts/bodoni-moda.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Bodoni Moda';
  src: url('vendor/fonts/bodoni-moda-italic.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Archivo';
  src: url('vendor/fonts/archivo.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('vendor/fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Mono';
  src: url('vendor/fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* ──────────────────────────────────────────────────────────
   TOKENS
   ────────────────────────────────────────────────────────── */
:root {
  /* Palette — sampled directly from the app icon.
     #061225 is the icon's glyph navy; #3478F6 its field blue. */
  --ink:       #061225;
  --ink-2:     #38455A;
  --ink-3:     #6E7A8B;
  --ink-4:     #A3ABB6;

  --paper:     #EDE8DE;
  --paper-2:   #E4DED1;
  --paper-3:   #D9D2C3;
  --paper-hi:  #F7F4EE;

  --blue:      #3478F6;
  --blue-lift: #5A98FF;
  --blue-deep: #1B4CB3;

  --vermillion: #DA3B16;

  /* Line work — the entire elevation system */
  --hair:      rgba(6, 18, 37, 0.16);
  --hair-2:    rgba(6, 18, 37, 0.28);
  --rule:      1px solid var(--ink);
  --rule-hair: 1px solid var(--hair);
  --rule-2:    2px solid var(--ink);

  /* Glass */
  --glass:        rgba(240, 236, 227, 0.60);
  --glass-strong: rgba(243, 240, 233, 0.78);
  --glass-blur:   blur(22px) saturate(1.7);
  --glass-spec:   rgba(255, 255, 255, 0.85);

  /* Type */
  --display: 'Bodoni Moda', 'Times New Roman', Times, serif;
  --ui:      'Archivo', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* Weight. Archivo and Bodoni Moda are variable faces carrying a real
     400–700 axis, so anything in that range is a drawn weight rather than
     an interpolation the browser invents. IBM Plex Mono is not: it ships
     as two static cuts, 400 and 500. Ask it for 600 and the browser
     synthesises a bold by smearing the outlines, which at the sizes the
     mono is used for — 10 and 11px, letterspaced, uppercase — turns crisp
     type to mud. --w-mono is therefore a ceiling, not a suggestion. */
  --w-body:   450;
  --w-medium: 500;
  --w-mono:   500;

  --fs-10: 0.625rem;
  --fs-11: 0.6875rem;
  --fs-12: 0.75rem;
  --fs-13: 0.8125rem;
  --fs-15: 0.9375rem;
  --fs-17: 1.0625rem;
  --fs-21: 1.3125rem;
  --fs-28: 1.75rem;
  --fs-40: 2.5rem;
  --fs-64: 4rem;

  /* Spacing — 4px base */
  --s1: 4px;   --s2: 8px;   --s3: 12px;  --s4: 16px;
  --s5: 20px;  --s6: 24px;  --s8: 32px;  --s10: 40px;
  --s12: 48px; --s16: 64px; --s20: 80px; --s24: 96px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t1: 130ms;
  --t2: 240ms;
  --t3: 420ms;

  /* Safe areas — resolve to 0 in a browser, real insets on iOS */
  --sa-t: env(safe-area-inset-top, 0px);
  --sa-b: env(safe-area-inset-bottom, 0px);
  --sa-l: env(safe-area-inset-left, 0px);
  --sa-r: env(safe-area-inset-right, 0px);

  color-scheme: light;
}

/* Ruled-manuscript field. Five hairlines, then a rest — the
   texture that makes the frosted panels legible as glass. */
:root {
  --staves: repeating-linear-gradient(
    to bottom,
    var(--hair) 0 1px,
    transparent 1px 9px,
    var(--hair) 9px 10px,
    transparent 10px 18px,
    var(--hair) 18px 19px,
    transparent 19px 27px,
    var(--hair) 27px 28px,
    transparent 28px 36px,
    var(--hair) 36px 37px,
    transparent 37px 96px
  );
}

/* ──────────────────────────────────────────────────────────
   RESET
   ────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--ui);
  font-size: var(--fs-15);
  font-weight: var(--w-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  /* Native-app feel inside WKWebView; harmless in a browser. */
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }

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

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

/* ──────────────────────────────────────────────────────────
   TYPOGRAPHY PRIMITIVES
   ────────────────────────────────────────────────────────── */
.display {
  font-family: var(--display);
  font-optical-sizing: auto;
  font-weight: var(--w-body);
  line-height: 0.94;
  letter-spacing: -0.02em;
}

/* Tiny mono caps — the system's connective tissue: section
   numbers, field labels, table headers, metadata cells. */
.label {
  font-family: var(--mono);
  font-size: var(--fs-10);
  font-weight: var(--w-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  /* Already at the mono's heaviest real cut, so the readability that a
     weight bump buys elsewhere has to come from contrast here instead:
     --ink-3 on paper is 3.6:1, which fails AA for text this small; the
     same grey on the dark bands already gets overridden to --ink-4. */
  color: var(--ink-2);
}

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

.seq {
  font-family: var(--display);
  font-size: var(--fs-21);
  font-weight: var(--w-body);
  font-style: italic;
  line-height: 1;
}

/* ──────────────────────────────────────────────────────────
   GLASS PANEL
   Frosted, but bounded by a hard 1px ink rule — never a
   floating card with a soft shadow.
   ────────────────────────────────────────────────────────── */
.panel {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: var(--rule);
  border-radius: 0;
  box-shadow: none;
}

/* Specular edge — the one highlight that sells it as glass. */
.panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: var(--glass-spec);
  pointer-events: none;
}

.panel--solid {
  background: var(--glass-strong);
}

/* ──────────────────────────────────────────────────────────
   BACKDROP — what the glass is actually frosting
   ────────────────────────────────────────────────────────── */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: var(--paper);
}

.backdrop__staves {
  position: absolute;
  inset: 0;
  background-image: var(--staves);
}

/* The asymmetric blue field. Deliberately off-centre and
   full-bleed to one edge so panels straddle its boundary. */
.backdrop__field {
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 38%;
  background: linear-gradient(200deg, var(--blue-lift), var(--blue) 55%, var(--blue-deep));
  border-left: var(--rule);
}

.backdrop__field::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: var(--staves);
  opacity: 0.5;
  mix-blend-mode: overlay;
}

/* ──────────────────────────────────────────────────────────
   CONTROLS
   ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  height: 40px;
  padding: 0 var(--s5);
  border: var(--rule);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--fs-11);
  font-weight: var(--w-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: background var(--t1) var(--ease), color var(--t1) var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:active { background: var(--ink-2); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn:disabled:hover { background: transparent; color: var(--ink); }

.btn--primary {
  background: var(--blue);
  border-color: var(--blue-deep);
  color: #fff;
}
.btn--primary:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.btn--primary:disabled:hover { background: var(--blue); border-color: var(--blue-deep); color: #fff; }

/* Same rule, shorter: for buttons riding inside another band of chrome —
   the masthead, a library row — where a 40px control would set the height
   of the thing containing it. */
.btn--sm {
  height: 30px;
  padding: 0 var(--s3);
  font-size: var(--fs-10);
  letter-spacing: 0.1em;
}

/* Reserved for the one destructive action in the app. It stays outlined
   until hover: a row of red buttons in a list is a dare, not a warning. */
.btn--danger { border-color: var(--hair-2); color: var(--ink-2); }
.btn--danger:hover { background: var(--vermillion); border-color: var(--vermillion); color: #fff; }

.btn svg { flex-shrink: 0; }

/* Source link — the GitHub mark, kept square and icon-only so it reads as
   a mark of provenance rather than a third button arguing with the CTA. */
.ghlink {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: var(--rule);
  color: var(--ink);
  transition: background var(--t1) var(--ease), color var(--t1) var(--ease);
}
.ghlink:hover { background: var(--ink); color: var(--paper); }
.ghlink svg { display: block; }

/* Matches .btn--sm, for mastheads whose controls are already 30px. */
.ghlink--sm { width: 30px; height: 30px; }

/* ──────────────────────────────────────────────────────────
   DATA ROWS — dense ruled key/value cells
   ────────────────────────────────────────────────────────── */
.rows { border-top: var(--rule-hair); }

.row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s4);
  padding: var(--s3) 0;
  border-bottom: var(--rule-hair);
}

.row__v {
  font-family: var(--mono);
  font-size: var(--fs-12);
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  text-align: right;
}

/* ──────────────────────────────────────────────────────────
   SHARED MARKS
   ────────────────────────────────────────────────────────── */
.wordmark {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.wordmark em { font-style: italic; font-weight: 400; color: var(--blue-deep); }

.appmark {
  width: 26px;
  height: 26px;
  border: var(--rule);
  border-radius: 6px;
  flex-shrink: 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
