/* ==========================================================================
   elchgeweih.de — Typografisches Tagebuch-Theme (ohne JS, inkl. Dark Mode)
   ========================================================================== */

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-ext-400-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-ext-400-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-400-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-ext-700-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "PT Serif";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-ext-700-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "PT Serif";
  font-style: italic;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/pt-serif-latin-700-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --bg: #ffffff;
  --bg-subtle: #f7f7f5;
  --text: #111111;
  --text-muted: #666662;
  --border: #e6e6e2;
  --link: #2b5c9e;
  --cal-empty: #f0f0ec;
  --cal-l1: #cfcfc8;
  --cal-l2: #9d9d96;
  --cal-l3: #63635d;
  --cal-l4: #242421;
  --cal-hover: #111110;
  --cal-current: #111110;
  --mark-bg: #f6ebb0;
  --mark-text: inherit;
  --measure: 60ch;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131312;
  --bg-subtle: #1c1c1a;
  --text: #f0efe9;
  --text-muted: #a3a199;
  --border: #2c2c29;
  --link: #9cb0c6;
  --cal-empty: #222220;
  --cal-l1: #45443f;
  --cal-l2: #6f6d66;
  --cal-l3: #a19e95;
  --cal-l4: #dcd9d0;
  --cal-hover: #f5f3ed;
  --cal-current: #f5f3ed;
  --mark-bg: #52461f;
  --mark-text: #f5f2e9;
}

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

html {
  background-color: var(--bg);
  color: var(--text);
  font-family: "PT Serif", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 0 1.25rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

mark {
  background-color: var(--mark-bg);
  color: var(--mark-text);
  padding: 0 0.15em;
  border-radius: 2px;
}

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

/* Header (Buchtitel-Stil)
   -------------------------------------------------------------------------- */
.site-header {
  max-width: var(--measure);
  width: 100%;
  margin: 3.5rem auto 4.5rem;
  text-align: center;
}

.site-title {
  display: inline-block;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
  letter-spacing: -0.01em;
}

.site-title:hover,
.site-title:focus-visible {
  text-decoration: none;
  opacity: 0.8;
}

.site-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.site-subtitle a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-subtitle a:hover,
.site-subtitle a:focus-visible {
  color: var(--text);
  text-decoration: underline;
}

/* Hauptbereich
   -------------------------------------------------------------------------- */
.site-main {
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  flex: 1 0 auto;
}

/* Einträge
   -------------------------------------------------------------------------- */
.note {
  margin: 0;
  position: relative;
}

.note-date {
  margin: 0 0 1.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  letter-spacing: 0.01em;
}

.note-date a {
  color: var(--text);
}

.note-date a:hover,
.note-date a:focus-visible {
  text-decoration: underline;
}

.note-body {
  hyphens: none;
  overflow-wrap: break-word;
}

.note-body > :first-child {
  margin-top: 0;
}

.note-body > :last-child {
  margin-bottom: 0;
}

.note-body p {
  margin: 0 0 1.15em;
}

.note-body blockquote {
  margin: 1.4em 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--border);
  color: var(--text-muted);
  font-style: italic;
}

/* Optionale Medien (nur gerendert wenn vorhanden) */
.note-media {
  margin-top: 1.5rem;
}

.note-media-disclosure {
  margin: 0;
}

.note-media-summary {
  position: absolute;
  top: 0;
  left: calc(50% + 3.4rem);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.42rem;
  color: var(--text-muted);
  cursor: pointer;
  list-style: none;
  padding: 0 0.15rem;
  opacity: 0.65;
  transition: color 0.15s ease, opacity 0.15s ease;
}

.note-media-summary::-webkit-details-marker {
  display: none;
}

.note-media-summary:hover,
.note-media-summary:focus-visible,
.note-media-disclosure[open] > .note-media-summary {
  color: var(--text);
  opacity: 1;
}

.note-stream .note + .note .note-media-summary {
  top: 4.2rem;
}

.media-icon {
  display: block;
  width: 15px;
  height: 15px;
}

.media-icon--text {
  display: none;
}

.note-media-disclosure[open] > .note-media-summary .media-icon--media {
  display: none;
}

.note-media-disclosure[open] > .note-media-summary .media-icon--text {
  display: block;
}

.note:has(.note-media-disclosure[open]) .note-body,
:root[data-media-view="media"] .note:has(.note-media-disclosure) .note-body {
  display: none;
}

.note-media-disclosure .note-media {
  margin-top: 0;
}

.note-figure {
  margin: 0 0 1rem;
}

.note-figure:last-child {
  margin-bottom: 0;
}

.note-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
}

.note-figure figcaption {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.note-media--audio audio,
.note-media--video video {
  display: block;
  width: 100%;
  border-radius: 2px;
}

/* Trennlinie zwischen Tagen im Stream */
.note-stream .note + .note {
  margin-top: 4.2rem;
  padding-top: 4.2rem;
  position: relative;
}

.note-stream .note + .note::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 5.5rem;
  height: 1px;
  background-color: var(--border);
}

/* 3-zeiliger typografischer Kalender (Jahre / Monate / Tage 1–31)
   -------------------------------------------------------------------------- */
.home-calendar,
.archive-calendar,
.note-below {
  width: min(48rem, calc(100vw - 2.5rem));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--bg-subtle);
  border-radius: 6px;
}

.home-calendar {
  margin: 3.75rem 0 4.5rem;
  padding: 1.5rem 1.75rem;
}

.archive-calendar {
  margin: 0 0 3rem;
  padding: 1.5rem 1.75rem;
}

.calendar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.calendar-row {
  display: block;
  text-align: center;
  text-wrap: balance;
  line-height: 1.55;
}

.calendar-years {
  font-size: 0.88rem;
}

.calendar-years .cal-item {
  margin: 0.1rem 0.42rem;
}

.calendar-months-row {
  font-size: 0.84rem;
}

.calendar-months-row .cal-item {
  margin: 0.1rem 0.38rem;
}

.calendar-days-row {
  font-size: 0.78rem;
}

.calendar-days-row .cal-item {
  margin: 0.08rem 0.2rem;
}

.cal-item {
  display: inline-block;
  color: var(--text-muted);
  padding: 0.05rem 0.1rem;
  text-decoration: none;
  transition: color 0.12s ease;
}

a.cal-item:hover,
a.cal-item:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cal-item.is-active {
  color: var(--text);
  font-weight: 700;
}

.cal-item.is-disabled {
  color: var(--text-muted);
  opacity: 0.28;
  cursor: default;
  user-select: none;
}

/* Navigation: Einzelansicht & Paginierung
   -------------------------------------------------------------------------- */
body[data-note="true"] {
  min-height: auto;
}

body[data-note="true"] .site-footer {
  margin-top: 3.5rem;
}

.note-bottom {
  margin-top: 4rem;
}

.note-prevnext {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.note-below {
  margin-top: 0;
  padding: 1.5rem 1.75rem;
}

.stream-pagination {
  margin-top: 4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: 0.95rem;
}

.note-prevnext a,
.stream-pagination a {
  color: var(--text-muted);
}

.note-prevnext a:hover,
.note-prevnext a:focus-visible,
.stream-pagination a:hover,
.stream-pagination a:focus-visible {
  color: var(--text);
}

/* Wenn auf Seite 1 nur „7 Tage in die Vergangenheit →“ da ist, zentrieren wie im Bestand */
.stream-pagination > span:first-child:empty {
  display: none;
}

.stream-pagination:has(> span:first-child:empty) {
  justify-content: center;
}

/* Archivseite
   -------------------------------------------------------------------------- */
.page-heading {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
}

.archive-header {
  text-align: center;
  margin-bottom: 2rem;
}

.archive-count {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.archive-list {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
}

.archive-month-details {
  border-bottom: 1px solid var(--border);
}

.archive-month-summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.85rem 0;
  cursor: pointer;
  list-style: none;
}

.archive-month-summary::-webkit-details-marker {
  display: none;
}

.archive-month-summary::after {
  content: "+";
  font-size: 0.95rem;
  color: var(--text-muted);
  font-weight: 400;
}

.archive-month-details[open] > .archive-month-summary::after {
  content: "−";
}

.archive-month-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: var(--text);
}

.archive-month-summary:hover .archive-month-name,
.archive-month-summary:hover::after {
  color: var(--link);
}

.archive-days {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.archive-days li + li {
  margin-top: 0.65rem;
}

.archive-day-link {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  color: var(--text);
}

.archive-day-link time {
  font-weight: 700;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.archive-day-excerpt {
  color: var(--text-muted);
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-day-link:hover,
.archive-day-link:focus-visible {
  text-decoration: none;
}

.archive-day-link:hover time {
  text-decoration: underline;
}

.archive-day-link:hover .archive-day-excerpt {
  color: var(--text);
}

/* Suche
   -------------------------------------------------------------------------- */
.search-section {
  margin-bottom: 3rem;
}

.search-form {
  margin-top: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.search-input,
.search-select,
.search-button {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.55rem 0.75rem;
  line-height: 1.3;
}

.search-input {
  flex: 1 1 14rem;
  min-width: 0;
}

.search-input:focus,
.search-select:focus,
.search-button:focus-visible {
  outline: 1.5px solid var(--text);
  outline-offset: 1px;
}

.search-button {
  background-color: var(--bg-subtle);
  cursor: pointer;
}

.search-button:hover {
  border-color: var(--text-muted);
}

.search-summary {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.empty-state,
.error-page {
  text-align: center;
  color: var(--text-muted);
}

.error-page p {
  margin: 0.8rem 0;
}

/* Footer
   -------------------------------------------------------------------------- */
.site-footer {
  max-width: var(--measure);
  width: 100%;
  margin: 5rem auto 3rem;
  text-align: center;
}

.footer-nav {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
  font-size: 0.9rem;
}

.footer-theme-toggle {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--link);
  cursor: pointer;
}

.footer-theme-toggle:hover,
.footer-theme-toggle:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

/* Responsive Anpassungen
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
  html {
    font-size: 18px;
  }

  .site-header {
    margin: 2.5rem auto 3.25rem;
  }

  .calendar-months {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem 0.95rem;
  }

  .note-stream .note + .note {
    margin-top: 3.25rem;
    padding-top: 3.25rem;
  }

  .note-stream .note + .note .note-media-summary {
    top: 3.25rem;
  }

  .home-calendar,
  .archive-calendar,
  .note-below {
    padding: 1.5rem 1.15rem 1.75rem;
  }

  .archive-day-link {
    grid-template-columns: 1fr;
    gap: 0.15rem;
  }

  .archive-day-excerpt {
    white-space: normal;
  }
}

@media (max-width: 400px) {
  .calendar-months {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}
