/* Seitenwerk — Bibliotheksregal, persönliches Autorenregal & Ghostwriter-Brücke
   Einheitliche monochrome Formensprache (Radien 6px / 8px / 10px) passend zu Forttrieb & Ghostwriter. */

/* ── 1. Editorial Hero & Zwei-Säulen-Brücke ── */
.library-intro {
  display: grid;
  gap: clamp(24px, 3.5vw, 36px);
  padding: clamp(32px, 5vw, 60px) 0 clamp(28px, 4vw, 44px);
  border-bottom: 1px solid var(--sw-line);
}

.intro-head {
  max-width: 54rem;
}

.library-intro h1 {
  font-family: var(--sw-font);
  font-weight: 650;
  font-size: clamp(30px, 4.4vw, 52px);
  letter-spacing: -0.032em;
  line-height: 1.07;
  margin: 0;
  color: var(--sw-text);
  text-wrap: balance;
}

.library-intro .intro-copy {
  margin: 16px 0 0;
  font-size: clamp(15.5px, 1.4vw, 17.5px);
  line-height: 1.65;
  color: var(--sw-secondary);
  max-width: 66ch;
  text-wrap: pretty;
}

.seitenwerk-pillars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.pillar-card {
  container-type: inline-size;
  display: grid;
  align-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r-lg);
}

.pillar-card header {
  display: grid;
  gap: 4px;
}

.pillar-card .eyebrow {
  margin: 0;
}

.pillar-card h2 {
  font-family: var(--sw-font);
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--sw-text);
  text-wrap: balance;
}

.pillar-card p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--sw-secondary);
  text-wrap: pretty;
}

.pillar-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--sw-text);
  text-decoration: underline;
  text-decoration-color: var(--sw-line-strong);
  text-underline-offset: 4px;
}

.pillar-link:hover {
  text-decoration-color: var(--sw-text);
}

/* ── 2. Persönliches Autorenregal (für angemeldete Schreibende) ── */
.personal-shelf {
  margin: 28px 0 0;
}

.personal-shelf-card {
  container-type: inline-size;
  display: grid;
  gap: 14px;
  padding: 22px 24px;
  background: var(--sw-panel);
  border: 1px solid var(--sw-line-strong);
  border-radius: var(--sw-r-lg);
}

.personal-shelf-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}

.personal-shelf-head .eyebrow {
  margin: 0;
}

.shelf-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--sw-r-sm);
  border: 1px solid var(--sw-line-strong);
  background: var(--sw-raised);
  color: var(--sw-text);
  font-size: 12px;
  font-weight: 600;
}

.shelf-badge.is-public {
  background: var(--sw-accent);
  color: var(--sw-on-accent);
  border-color: var(--sw-accent);
}

.personal-shelf-card h2 {
  font-family: var(--sw-serif);
  font-size: clamp(22px, 2.8vw, 30px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
  color: var(--sw-text);
  text-wrap: balance;
}

.personal-shelf-meta {
  margin: 0;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--sw-muted);
}

.personal-shelf-copy {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.62;
  color: var(--sw-secondary);
  max-width: 68ch;
  text-wrap: pretty;
}

.personal-shelf-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

/* ── 3. Bücherregal, Kategorien & Filter ── */
.shelf-section {
  padding-top: clamp(26px, 4vw, 40px);
}

.shelf-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 12px;
}

.shelf-toolbar h2 {
  font-family: var(--sw-font);
  font-size: clamp(21px, 2.4vw, 25px);
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
}

.shelf-toolbar h2 span {
  margin-left: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--sw-muted);
  font-variant-numeric: tabular-nums;
}

.shelf-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.shelf-categories button,
.filter {
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--sw-line-strong);
  border-radius: var(--sw-r-sm);
  background: var(--sw-panel);
  color: var(--sw-secondary);
  font-size: 13.5px;
  font-weight: 550;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.shelf-categories button:hover,
.filter:hover {
  background: var(--sw-raised);
  color: var(--sw-text);
}

.shelf-categories button[aria-pressed="true"],
.filter[aria-pressed="true"] {
  background: var(--sw-accent);
  color: var(--sw-on-accent);
  border-color: var(--sw-accent);
  font-weight: 600;
}

.shelf-filters {
  margin: 0 0 22px;
}

.shelf-filters summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 6px 0;
  color: var(--sw-secondary);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  list-style: none;
}

.shelf-filters summary::-webkit-details-marker { display: none; }
.shelf-filters summary::before {
  content: "+";
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--sw-line-strong);
  border-radius: 4px;
  font-size: 14px;
  line-height: 1;
}
.shelf-filters[open] summary::before { content: "−"; }

.shelf-filters-panel {
  margin-top: 10px;
  padding: 16px 18px;
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r-md);
  display: grid;
  gap: 14px;
}

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 440px;
  padding: 0 12px;
  background: var(--sw-raised);
  border: 1px solid var(--sw-line-strong);
  border-radius: var(--sw-r-sm);
}

.search > span {
  font-size: 18px;
  line-height: 1;
  color: var(--sw-muted);
}

.search input {
  background: transparent;
  border: 0;
  outline: none;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  font-size: 14px;
  color: var(--sw-text);
}

.search input::placeholder {
  color: var(--sw-muted);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.age-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--sw-secondary);
  font-size: 13.5px;
  font-weight: 550;
}

.genre-filter select {
  min-height: 40px;
  border: 1px solid var(--sw-line-strong);
  border-radius: var(--sw-r-sm);
  padding: 6px 12px;
  background: var(--sw-raised);
  color: var(--sw-text);
  font-size: 13.5px;
}

/* ── 4. Buchkarten & Typografische Hardcover ── */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: clamp(18px, 2.6vw, 28px);
}

.book-card {
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r-lg);
  overflow: hidden;
  transition: border-color 160ms ease;
}

.book-card:hover {
  border-color: var(--sw-line-strong);
}

.book-card.studio-card {
  border-style: solid;
  border-color: var(--sw-line-strong);
}

.cover-stage {
  position: relative;
  aspect-ratio: 1.48;
  padding: 26px 22px;
  background: var(--sw-cover);
  border-bottom: 1px solid var(--sw-line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  perspective: 1000px;
}

.cover-stage::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 16px;
  height: 14px;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.18);
  filter: blur(12px);
  pointer-events: none;
}

.cover-stage .cover-open {
  padding: 0;
  background: none;
  position: relative;
  display: block;
  width: min(56%, 196px);
  aspect-ratio: 2 / 3;
  z-index: 1;
  transform: rotateY(-10deg) rotateZ(-2deg);
  transition: transform 0.22s ease;
  border-radius: 2px 5px 5px 2px;
  text-decoration: none;
}

.cover-stage .cover-open:hover,
.cover-stage .cover-open:focus-visible {
  transform: rotateY(-4deg) rotateZ(-0.5deg) translateY(-3px);
}

.cover-stage .cover-open::before,
.cover-stage .cover-open::after {
  content: "";
  position: absolute;
  pointer-events: none;
  border-radius: inherit;
}

.cover-stage .cover-open::before {
  z-index: -1;
  inset: 2px -8px -6px 1px;
  border-right: 2px solid #232328;
  border-bottom: 2px solid #232328;
  background: repeating-linear-gradient(0deg, #c2c2ca 0 1px, #e9e9ee 1px 3px);
  box-shadow: 7px 14px 24px rgb(0 0 0 / 0.26);
}

.cover-stage .cover-open::after {
  inset: 0;
  border: 0;
  background: linear-gradient(90deg, rgb(0 0 0 / 0.34), rgb(0 0 0 / 0.12) 2.5%, rgb(255 255 255 / 0.18) 3.5%, rgb(0 0 0 / 0.14) 4.5%, transparent 8%);
}

.cover-stage .cover-art {
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  display: block;
  border: 0;
  border-radius: inherit;
}

/* Architektonischer Leineneinband für Ghostwriter-Bücher & Werkstatt-Karte */
.cover-typo {
  width: 100%;
  height: 100%;
  padding: 18px 16px 16px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  text-align: left;
  background: #161619;
  color: #f4f4f3;
  border-radius: inherit;
  border: 1px solid #2f2f35;
}

.cover-typo.is-studio {
  background: #fafafa;
  color: #111113;
  border-color: #c4c4cc;
}

:root[data-theme="dark"] .cover-typo.is-studio {
  background: #202024;
  color: #f4f4f3;
  border-color: #3f3f46;
}

.cover-typo-kicker {
  font-family: var(--sw-font);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #a1a1aa;
}

.cover-typo.is-studio .cover-typo-kicker {
  color: #52525b;
}
:root[data-theme="dark"] .cover-typo.is-studio .cover-typo-kicker {
  color: #a1a1aa;
}

.cover-typo-title {
  font-family: var(--sw-serif);
  font-size: clamp(16px, 4.8cqw, 22px);
  font-weight: 450;
  line-height: 1.16;
  letter-spacing: -0.02em;
  margin: auto 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cover-page .cover-typo {
  padding: clamp(28px, 6cqw, 46px) clamp(24px, 5.5cqw, 42px) clamp(24px, 5cqw, 38px) clamp(30px, 6.5cqw, 48px);
  border-radius: 0;
  border: 0;
}

.cover-page .cover-typo-kicker {
  font-size: 10.5px;
}

.cover-page .cover-typo-title {
  font-size: clamp(26px, 5.5cqw, 38px);
  -webkit-line-clamp: 5;
}

.cover-typo-author {
  width: 100%;
  padding-top: 9px;
  border-top: 1px solid rgb(255 255 255 / 0.16);
  font-family: var(--sw-font);
  font-size: 10.5px;
  font-weight: 500;
  color: #d4d4d8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cover-typo.is-studio .cover-typo-author {
  border-top-color: rgb(17 17 19 / 0.14);
  color: #3f3f46;
}
:root[data-theme="dark"] .cover-typo.is-studio .cover-typo-author {
  border-top-color: rgb(255 255 255 / 0.16);
  color: #d4d4d8;
}

.age-badge {
  position: absolute;
  left: 14px;
  top: 14px;
  z-index: 2;
  background: var(--sw-panel);
  color: var(--sw-text);
  padding: 5px 10px;
  border-radius: var(--sw-r-sm);
  font-size: 11.5px;
  font-weight: 600;
  border: 1px solid var(--sw-line-strong);
}

.book-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 22px 22px;
}

.book-meta .eyebrow {
  font-size: 10.5px;
  margin: 0 0 6px;
}

.book-meta h3 {
  font-family: var(--sw-serif);
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.14;
  margin: 0 0 6px;
  color: var(--sw-text);
  text-wrap: balance;
}

.book-subtitle {
  font-size: 13.5px;
  font-weight: 550;
  color: var(--sw-text);
  margin: 0 0 8px;
  line-height: 1.45;
}

.book-description {
  font-size: 14px;
  line-height: 1.62;
  color: var(--sw-secondary);
  margin: 0;
  text-wrap: pretty;
}

.book-actions {
  margin-top: auto;
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

/* ── 5. Knöpfe, Leitgedanke & Fußbereich ── */
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: var(--sw-r-sm);
  border: 1px solid var(--sw-accent);
  background: var(--sw-accent);
  color: var(--sw-on-accent);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease;
}

.primary-button:hover {
  background: var(--sw-accent-hover);
  border-color: var(--sw-accent-hover);
}

.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 16px;
  border-radius: var(--sw-r-sm);
  border: 1px solid var(--sw-line-strong);
  background: var(--sw-panel);
  color: var(--sw-text);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 150ms ease, border-color 150ms ease;
}

.secondary-button:hover {
  background: var(--sw-raised);
  border-color: var(--sw-text);
}

.reading-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 28px;
  padding: 24px 26px;
  margin: 44px 0 28px;
  background: var(--sw-panel);
  border: 1px solid var(--sw-line);
  border-radius: var(--sw-r-lg);
}

.reading-note-copy {
  max-width: 66ch;
}

.reading-note-copy .eyebrow {
  margin-bottom: 6px;
}

.reading-note p {
  font-size: 14.5px;
  line-height: 1.65;
  margin: 0;
  color: var(--sw-secondary);
  text-wrap: pretty;
}

.reading-note strong {
  color: var(--sw-text);
  font-weight: 650;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 18px 0 36px;
  border-top: 1px solid var(--sw-line);
  font-size: 12.5px;
  color: var(--sw-muted);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  text-decoration: underline;
  text-decoration-color: var(--sw-line-strong);
  text-underline-offset: 4px;
}

.footer-links a:hover {
  color: var(--sw-text);
}

.footer-separator {
  margin: 0 6px;
  opacity: 0.6;
}

.settings-dialog [data-appearance-control] {
  margin: 0 0 12px;
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--sw-line);
}

@container (max-width: 320px) {
  .book-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .book-actions .primary-button {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .seitenwerk-pillars {
    grid-template-columns: 1fr;
  }
  .shelf-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .personal-shelf-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .personal-shelf-actions .primary-button,
  .personal-shelf-actions .secondary-button {
    width: 100%;
  }
}

@media (pointer: coarse) {
  .shelf-categories button,
  .filter,
  .genre-filter select,
  .primary-button,
  .secondary-button {
    min-height: 44px;
  }
}

@media (forced-colors: active) {
  .shelf-categories button[aria-pressed="true"],
  .filter[aria-pressed="true"],
  .shelf-badge.is-public {
    outline: 2px solid Highlight;
    outline-offset: -2px;
  }
}
