html:has(body.home-page) {
  background-color: #000;
}

html[data-theme='light']:has(body.home-page) {
  background-color: #fff;
}

body.home-page {
  --theme-transition-duration: 340ms;
  --home-bg: #000;
  --home-text: #fff;
  --home-link: #fff;
  --home-rule: rgba(255, 255, 255, 0.85);
  --home-muted-text: rgba(255, 255, 255, 0.5);
  --home-accent: #7e5bea;
  background-color: var(--home-bg);
  color: var(--home-text);
  /* override index.css body constraints */
  max-width: none;
  padding: 0;
  margin: 0;
  transition: background-color var(--theme-transition-duration) ease, color var(--theme-transition-duration) ease;
}

html[data-theme='light'] body.home-page {
  --home-bg: #fff;
  --home-text: #000;
  --home-link: #000;
  --home-rule: rgba(0, 0, 0, 0.85);
  --home-muted-text: rgba(0, 0, 0, 0.5);
}

body.home-page a,
body.home-page button {
  color: var(--home-link);
  transition: color var(--theme-transition-duration) ease;
}

body.home-page a:hover {
  color: var(--home-accent);
  text-decoration: none;
}

/* ── Layout ── */

.home-layout {
  padding: 20px;
  box-sizing: border-box;
}

/* ── Hero ── */

.home-hero {
  display: flex;
  flex-direction: column;
}

.home-title {
  font-size: 5.1em;
  line-height: 0.92;
  font-weight: 700;
  margin-bottom: 12px;
  padding-top: 0;
}

.home-description {
  font-size: 1.7em;
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 12px;
}

.home-description p {
  margin-bottom: 0;
}

.home-description br {
  display: none;
}

.home-description a {
  text-decoration: underline;
  text-underline-offset: 0.1em;
}

.home-description a:hover {
  text-decoration: none;
}

.home-meta {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 20px;
  align-items: baseline;
  font-size: 1em;
  line-height: 1.2;
  margin-bottom: 200px;
}

.home-meta-item:nth-child(1) { grid-column: 1 / span 4; }
.home-meta-item:nth-child(2) { grid-column: 5 / span 4; }
.home-meta-item:nth-child(3) { grid-column: 9 / span 4; }

.home-meta-item a {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.home-meta-item a:hover {
  text-decoration: none;
}

/* ── Theme toggle ── */

.theme-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  color: var(--home-link);
  font: inherit;
  cursor: pointer;
  padding: 0;
  transition: color var(--theme-transition-duration) ease;
}

.theme-toggle-option {
  color: var(--home-muted-text);
  transition: color var(--theme-transition-duration) ease;
}

.theme-toggle[data-active-theme='dark'] .theme-toggle-option--dark,
.theme-toggle[data-active-theme='light'] .theme-toggle-option--light {
  color: var(--home-link);
}

/* ── Notes list ── */

.home-notes {
}

/*
 * 12-column grid, 20px gutter.
 * cols 1–2   : date
 * cols 3–4   : cover image
 * cols 5–8   : title
 * cols 9–12  : author
 */
.home-note-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: auto auto;
  gap: 20px;
  align-items: start;
  padding: 0;
  margin-bottom: 200px;
  text-decoration: none;
  color: var(--home-text);
  font-size: 1.7em;
  line-height: 1.15;
  transition: color var(--theme-transition-duration) ease;
}

.home-note-row:hover {
  color: var(--home-accent);
}


.home-note-number {
  grid-column: 1 / span 2;
  grid-row: 1;
  text-align: left;
  min-width: 0;
}

.home-note-date {
  grid-column: 3 / span 2;
  grid-row: 1;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
  text-align: left;
}

.home-note-thumb {
  grid-column: 5 / span 2;
  grid-row: 2;
  align-self: start;
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.home-note-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  filter: grayscale(1);
  transition: filter 180ms ease, opacity 180ms ease;
}

.home-note-row:hover .home-note-thumb {
  background-color: var(--home-accent);
}

.home-note-row:hover .home-note-thumb img {
  filter: grayscale(1) contrast(1.05) brightness(1.15);
  mix-blend-mode: screen;
}

.home-note-title {
  grid-column: 5 / span 4;
  grid-row: 1;
  font-weight: 700;
  min-width: 0;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.home-note-row:hover .home-note-title {
  text-decoration: none;
}

.home-note-author {
  grid-column: 9 / span 4;
  grid-row: 1;
  text-align: left;
  min-width: 0;
}

/* ── Mobile ── */

@media only screen and (max-width: 768px) {
  .home-title {
    font-size: 3em;
  }

  .home-description {
    font-size: 1.2em;
    columns: 1;
  }

  .home-note-row {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 4px 12px;
    align-items: start;
    font-size: 1.2em;
    margin-bottom: 80px;
    color: var(--home-text);
  }

  .home-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    margin-bottom: 80px;
  }

  .home-meta-item:nth-child(1),
  .home-meta-item:nth-child(2),
  .home-meta-item:nth-child(3) {
    grid-column: unset;
  }

  .home-note-number {
    grid-column: 1;
    grid-row: 1;
  }

  .home-note-date {
    grid-column: 2;
    grid-row: 1;
    color: var(--home-text);
    text-align: right;
  }

  .home-note-title {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .home-note-author {
    grid-column: 1 / -1;
    grid-row: 3;
    text-align: left;
  }

  .home-note-thumb {
    display: none;
  }
}
