:root {
  color-scheme: dark;

  --bg:        #14171D;
  --surface-1: #1F1F26;
  --surface-2: #22262D;
  --ink:       #C5C9C7;
  --muted:     #75797F;
  --accent:    #8992A7; /* keyword */
  --accent-2:  #8A9A7B; /* string  */
  --accent-3:  #B6927B; /* constant */

  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

html, body {
  margin: 0;
  background: var(--bg);
}

body {
  color: var(--ink);
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page {
  max-width: 30rem;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

/* ---------- comment-style caption (tagline, featured note) ---------- */

.comment {
  font-family: var(--sans);
  font-style: italic;
  font-weight: 400;
  color: var(--muted);
}
.comment::before {
  content: "// ";
}

/* ---------- homepage: brand + nav ---------- */

.brand {
  margin-bottom: 2.25rem;
}

.wordmark {
  font-family: var(--mono);
  font-weight: 800;
  font-size: clamp(2rem, 9vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}

.tagline {
  font-size: 0.9rem;
  margin: 0.55rem 0 0;
}

.dirlist {
  display: flex;
  flex-direction: column;
}

/* ---------- homepage: 2-up tile grid (kanso-ink "Option B") ---------- */

.grid-2up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--surface-2);
  border: 1px solid var(--surface-2);
}

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg);
  cursor: pointer;
}

.tile-photo {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: brightness(0.32) saturate(0.85);
  transition: filter 320ms ease;
}
.tile:hover .tile-photo,
.tile:focus-visible .tile-photo,
.tile:focus-within .tile-photo {
  filter: brightness(1) saturate(1);
}

/* permanent scrim near the text, independent of hover brightness, so the
   index/title/caption stay legible whether or not the tile is hovered */
.tile-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(20, 23, 29, 0.92) 0%,
    rgba(20, 23, 29, 0.55) 40%,
    rgba(20, 23, 29, 0.08) 70%,
    transparent 100%
  );
  pointer-events: none;
}

.tile-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
}

.tile-index {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  transition: color 0.15s ease;
}
.tile:hover .tile-index,
.tile:focus-visible .tile-index,
.tile:focus-within .tile-index {
  color: var(--accent);
}

.tile-foot {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.tile-foot .tile-title {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
}
.tile-foot .tile-desc {
  font-family: var(--sans);
  font-style: italic;
  font-size: 0.78rem;
  color: var(--muted);
}
.tile-foot .tile-desc::before {
  content: "// ";
}

.tile--stub {
  cursor: default;
}
.tile--stub .tile-photo {
  filter: brightness(0.22) saturate(0.5);
}
.tile--stub:hover .tile-photo,
.tile--stub:focus-visible .tile-photo {
  filter: brightness(0.22) saturate(0.5);
}
.tile--stub:hover .tile-index {
  color: var(--muted);
}

.row {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  column-gap: 1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--surface-2);
  align-items: baseline;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.row:hover, .row:focus-visible, .row:focus-within {
  background: var(--surface-1);
}

.row-index {
  align-self: stretch;
  border-right: 1px solid var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  transition: color 0.15s ease;
}
.row:hover .row-index, .row:focus-visible .row-index, .row:focus-within .row-index {
  color: var(--accent);
}

.row-main {
  min-width: 0;
}

.row-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
}

.row-desc {
  font-family: var(--sans);
  font-style: italic;
  font-size: 0.82rem;
  color: var(--muted);
}
.row-desc::before {
  content: " — ";
}

/* ---------- shared sub-page chrome ---------- */

.back {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 1.5rem;
  transition: color 0.15s ease;
}
.back:hover, .back:focus-visible {
  color: var(--accent);
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 1.75rem;
  text-wrap: balance;
}

/* ---------- /music/ ---------- */

.featured {
  display: block;
  border: 1px solid var(--surface-2);
  background: var(--surface-1);
  padding: 1.1rem 1.1rem 1.25rem;
  margin-bottom: 2rem;
  transition: border-color 0.15s ease;
}
.featured:hover, .featured:focus-visible {
  border-color: var(--accent-2);
}

.featured-tag {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-3);
  border: 1px solid var(--accent-3);
  padding: 0.15rem 0.4rem;
  margin-bottom: 0.75rem;
}

.featured-row {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.featured-year {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 500;
}

.featured-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent-2);
  letter-spacing: -0.01em;
}

.featured-note {
  font-size: 0.8rem;
  margin: 0.6rem 0 0;
}

.section-eyebrow {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.linklist .row-index.row-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}
.row-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.linklist .row-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.linklist .row-title {
  font-weight: 500;
  font-size: 0.95rem;
}
.linklist .row-handle {
  color: var(--muted);
  font-size: 0.8rem;
}
.linklist .row:hover .row-handle, .linklist .row:focus-visible .row-handle {
  color: var(--accent);
}

/* ---------- /music/songs/ ---------- */

.songlist {
  display: flex;
  flex-direction: column;
}

.song-row {
  display: grid;
  grid-template-columns: 7rem 1fr;
  column-gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--surface-2);
  transition: background-color 0.15s ease;
}
.song-row:hover, .song-row:focus-within {
  background: var(--surface-1);
}

.song-gutter {
  align-self: start;
  border-right: 1px solid var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  font-size: 0.82rem;
  padding-top: 0.1rem;
}

/* cover-art thumbnail, fetched at build time from Spotify's oEmbed and
   committed to src/images/covers/ — never a live/runtime fetch. Songs
   with no art (no spotify link, or the build-time fetch failed) render
   the placeholder glyph span instead, same footprint, no broken image. */
.song-art {
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--surface-2);
  background: var(--surface-1);
  object-fit: cover;
  display: block;
}
.song-art--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}
.song-art--placeholder svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.song-meta {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.song-year {
  color: var(--accent-3);
  font-weight: 600;
}
.song-slug {
  color: var(--muted);
}

.song-content {
  align-self: start;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  min-width: 0;
}
.song-title {
  font-weight: 600;
  font-size: 0.98rem;
  color: var(--ink);
  transition: color 0.15s ease;
}
.song-row:hover .song-title, .song-row:focus-within .song-title {
  color: var(--accent-2);
}

.song-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  justify-content: flex-end;
  text-align: right;
}
.song-links a {
  transition: color 0.15s ease;
}
.song-links a:hover, .song-links a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- /photos/ (coming-soon stub) ---------- */

.stub-note {
  font-size: 0.85rem;
  margin: 0;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--surface-2);
}

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

.foot {
  margin-top: 3rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--surface-2);
}
.foot p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* ================= mobile gutter decision — below ~400px =================
   The gutter column (and its vertical rule) stays put at every width — it
   never shrinks away. What changes is only what happens to its right: the
   year/slug pair drops from one inline line to two stacked lines (saving
   horizontal room without shrinking type), and the title/links pair drops
   from a left/right split onto its own stacked lines, still flush left
   against the same rule. Nothing scales down proportionally. */
@media (max-width: 400px) {
  .song-row {
    grid-template-columns: 4.25rem 1fr;
    column-gap: 0.75rem;
  }
  .song-meta {
    flex-direction: column;
    gap: 0.1rem;
    align-items: flex-start;
  }
  .song-content {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
  .song-links {
    justify-content: flex-start;
    text-align: left;
  }

  .linklist .row-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
}

@media (max-width: 340px) {
  .row {
    grid-template-columns: 1.75rem 1fr;
    column-gap: 0.75rem;
  }
}
