/* SPDX-License-Identifier: GPL-3.0-or-later */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Libre+Caslon+Display&display=swap");

:root {
  --paper: #f3eee5;
  --paper-deep: #e6ddcf;
  --ink: #26221e;
  --muted: #6f6860;
  --line: rgba(38, 34, 30, 0.15);
  --wine: #8f1d2c;
  --wine-dark: #6f1421;
  --cream: #fbf8f2;
  --serif: "Libre Caslon Display", Georgia, serif;
  --sans: "DM Sans", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(255,255,255,.55), transparent 28rem),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}

button,
input,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.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;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 78px;
  padding: 0 5vw;
  border-bottom: 1px solid var(--line);
  background: rgba(243, 238, 229, 0.88);
  backdrop-filter: blur(18px);
}

.site-title {
  font-family: var(--serif);
  font-size: 27px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand > span:last-child {
  display: grid;
}

.brand strong {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 400;
  line-height: .8;
}

.brand small {
  margin-top: 7px;
  color: var(--wine);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .32em;
}

.brand-mark {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 32px;
  height: 36px;
  padding: 5px;
  border: 1px solid var(--wine);
  border-radius: 18px 18px 5px 5px;
}

.brand-mark span {
  display: block;
  width: 6px;
  border-radius: 6px 6px 1px 1px;
  background: var(--wine);
}

.brand-mark span:nth-child(1) { height: 16px; }
.brand-mark span:nth-child(2) { height: 24px; }
.brand-mark span:nth-child(3) { height: 19px; }

.main-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 42px);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.main-nav a,
.continue-link,
.favorites-link {
  position: relative;
  padding: 29px 0 26px;
}

.main-nav a::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--wine);
  content: "";
  opacity: 0;
  transform: scaleX(.3);
  transition: .2s ease;
}

.main-nav a:hover,
.main-nav a.active,
.favorites-link:hover {
  color: var(--ink);
}

.main-nav a.active::after,
.main-nav a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.favorites-link,
.continue-link {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.favorites-link span,
.continue-link span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 5px;
  border-radius: 50%;
  background: var(--wine);
  color: white;
  font-size: 10px;
}

.hero {
  min-height: 0;
  padding: 74px 7vw 68px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 680px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--wine);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .28em;
}

.hero h1 {
  max-width: 720px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(54px, 6vw, 82px);
  font-weight: 400;
  line-height: .96;
  letter-spacing: -.035em;
}

.hero h1 em {
  color: var(--wine);
  font-weight: 400;
}

.hero-description {
  max-width: 560px;
  margin: 16px 0 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.75;
}

.search-box {
  display: flex;
  align-items: center;
  max-width: 560px;
  min-height: 62px;
  padding: 0 18px;
  border: 1px solid rgba(38,34,30,.22);
  border-radius: 3px;
  background: rgba(255,255,255,.5);
  box-shadow: 0 15px 35px rgba(63,49,36,.07);
  transition: .2s ease;
}

.search-box:focus-within {
  border-color: var(--wine);
  background: var(--cream);
  box-shadow: 0 16px 38px rgba(111,20,33,.1);
}

.search-box svg {
  width: 20px;
  fill: none;
  stroke: var(--wine);
  stroke-width: 1.7;
}

.search-box input {
  flex: 1;
  min-width: 0;
  padding: 0 16px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
}

.search-box input::placeholder {
  color: #8e877e;
}

kbd {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--muted);
  font-size: 10px;
  box-shadow: 0 1px 0 rgba(0,0,0,.1);
}

.hero-stats {
  display: flex;
  gap: 46px;
  margin-top: 40px;
}

.hero-stats div {
  display: grid;
}

.hero-stats strong {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
}

.hero-stats span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .22em;
}

.hero-art {
  position: relative;
  min-height: 500px;
}

.sun-disc {
  position: absolute;
  top: 3%;
  left: 14%;
  width: 390px;
  height: 390px;
  border-radius: 50%;
  background: #d9c9b4;
  box-shadow: inset 0 0 80px rgba(255,255,255,.25);
}

.book {
  position: absolute;
  display: flex;
  flex-direction: column;
  width: 235px;
  height: 350px;
  padding: 31px 27px;
  box-shadow: -18px 24px 45px rgba(51,38,28,.22);
  transform-origin: bottom center;
}

.book::after {
  position: absolute;
  top: 0;
  right: -12px;
  width: 12px;
  height: 100%;
  background: inherit;
  filter: brightness(.68);
  content: "";
  transform: skewY(-36deg);
  transform-origin: left top;
}

.book-kicker {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .23em;
}

.book strong {
  margin-top: 25px;
  font-family: var(--serif);
  font-size: 34px;
  font-weight: 400;
  line-height: 1.08;
}

.book small {
  margin-top: auto;
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .2em;
}

.book-back {
  top: 34px;
  left: 8%;
  z-index: 2;
  background: #2c5550;
  color: #f4ead7;
  transform: rotate(-9deg);
}

.book-back::before {
  position: absolute;
  right: 28px;
  bottom: 54px;
  width: 90px;
  height: 90px;
  border: 1px solid rgba(244,234,215,.6);
  border-radius: 50%;
  content: "";
}

.book-front {
  top: 112px;
  left: 43%;
  z-index: 3;
  background: var(--wine);
  color: #f8eee3;
  transform: rotate(8deg);
}

.book-front svg {
  width: 125px;
  margin: 24px auto 0;
  fill: none;
  stroke: rgba(248,238,227,.75);
  stroke-width: 1;
}

.art-note {
  position: absolute;
  right: -10px;
  bottom: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  line-height: 1.4;
  transform: rotate(-5deg);
}

.library-section {
  padding: 90px 5vw 96px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 35px;
}

.section-heading h2,
.archive-banner h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4vw, 56px);
  font-weight: 400;
  letter-spacing: -.025em;
}

.section-heading > p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 42px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.category-scroller {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-scroller::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 0;
  border-radius: 30px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: .2s ease;
}

.filter-chip:hover {
  color: var(--wine);
  background: rgba(143,29,44,.07);
}

.filter-chip.active {
  background: var(--wine);
  color: white;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sort-select select {
  height: 38px;
  margin-right: 8px;
  padding: 0 32px 0 11px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.view-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.view-button.active {
  border-color: var(--line);
  background: rgba(255,255,255,.45);
  color: var(--wine);
}

.view-button svg {
  width: 16px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 48px 26px;
}

.book-card {
  position: relative;
  min-width: 0;
  animation: rise .45s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
}

.cover-link {
  position: relative;
  display: block;
  aspect-ratio: .7;
  max-height: 390px;
  overflow: hidden;
  border-radius: 2px 7px 7px 2px;
  background: var(--cover);
  color: var(--cover-ink);
  box-shadow:
    -7px 10px 19px rgba(51,38,28,.15),
    inset 8px 0 0 rgba(0,0,0,.11),
    inset 10px 0 0 rgba(255,255,255,.07);
  transition: transform .25s ease, box-shadow .25s ease;
}

.cover-link::before {
  position: absolute;
  inset: 7% 9%;
  border: 1px solid currentColor;
  border-radius: 50% 50% 43% 57% / 38% 56% 44% 62%;
  content: "";
  opacity: .18;
  transform: rotate(var(--ornament-rotate, 8deg));
}

.cover-link::after {
  position: absolute;
  z-index: 3;
  inset: 0 auto 0 0;
  width: 11px;
  background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(255,255,255,.12) 48%, transparent);
  content: "";
  opacity: .42;
  pointer-events: none;
}

.book-card:nth-child(3n) .cover-link::before {
  inset: 28% -14% -14% 26%;
  border-radius: 50%;
}

.book-card:nth-child(4n) .cover-link::before {
  inset: 12% 15%;
  border-radius: 0;
  transform: rotate(45deg);
}

.cover-link:hover,
.cover-link:focus-visible {
  box-shadow: -10px 15px 28px rgba(51,38,28,.23);
  transform: translateY(-7px) rotate(.6deg);
}

.cover-image {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f7f2e8;
  transition: transform .3s ease;
}

.cover-link:hover .cover-image,
.cover-link:focus-visible .cover-image {
  transform: scale(1.015);
}

.cover-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12% 11% 10% 15%;
}

.cover-author {
  min-height: 28px;
  font-size: clamp(6px, .55vw, 9px);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.cover-title {
  margin: auto 0;
  font-family: var(--serif);
  font-size: clamp(18px, 1.65vw, 29px);
  font-weight: 400;
  line-height: 1.06;
  overflow-wrap: anywhere;
}

.cover-label {
  font-size: 7px;
  font-weight: 700;
  letter-spacing: .18em;
  opacity: .75;
}

.favorite-button {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(250,247,240,.88);
  color: var(--wine);
  cursor: pointer;
  opacity: 0;
  transform: translateY(-4px);
  transition: .2s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.favorite-button svg {
  width: 16px;
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.8;
}

.favorite-button.saved svg {
  fill: currentColor;
}

.book-card:hover .favorite-button,
.favorite-button:focus-visible,
.favorite-button.saved {
  opacity: 1;
  transform: none;
}

.card-meta {
  padding-top: 18px;
}

.card-category {
  display: block;
  margin-bottom: 7px;
  color: var(--wine);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.card-title {
  margin: 0 0 5px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 400;
  line-height: 1.2;
}

.card-author {
  display: inline;
  width: fit-content;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, border-color .18s ease;
}

.card-author:hover,
.card-author:focus-visible {
  border-bottom-color: currentColor;
  color: var(--wine);
  outline: none;
}

.reading-progress {
  display: block;
  margin-top: 9px;
  color: var(--wine);
  font-size: 10px;
  font-weight: 600;
}

.book-grid.list {
  display: block;
}

.book-grid.list .book-card {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px 8px;
  border-bottom: 1px solid var(--line);
}

.book-grid.list .cover-link {
  grid-column: 1;
  grid-row: 1;
  width: 52px;
  height: 74px;
}

.book-grid.list .cover-content {
  padding: 12px;
}

.book-grid.list .cover-author,
.book-grid.list .cover-label {
  display: none;
}

.book-grid.list .cover-title {
  font-size: 10px;
}

.book-grid.list .card-meta {
  grid-column: 2;
  grid-row: 1;
  padding: 0;
}

.book-grid.list .favorite-button {
  position: static;
  grid-column: 3;
  grid-row: 1;
  opacity: 1;
  transform: none;
}

.empty-state {
  padding: 80px 20px;
  text-align: center;
}

.empty-state > span {
  color: var(--wine);
  font-family: var(--serif);
  font-size: 60px;
}

.empty-state h3 {
  margin: 8px 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 400;
}

.empty-state p {
  color: var(--muted);
}

.empty-state button,
.archive-banner button {
  padding: 13px 18px;
  border: 1px solid var(--wine);
  background: transparent;
  color: var(--wine);
  cursor: pointer;
}

.archive-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  margin: 0 5vw 90px;
  padding: 55px 6%;
  overflow: hidden;
  background:
    radial-gradient(circle at 87% 28%, transparent 0 42px, rgba(243,238,229,.15) 43px 44px, transparent 45px 67px, rgba(243,238,229,.12) 68px 69px, transparent 70px),
    #2b514d;
  color: var(--cream);
}

.archive-banner .eyebrow {
  color: #e5b8a6;
}

.archive-banner p:last-child {
  color: rgba(255,255,255,.66);
}

.archive-banner button {
  flex: 0 0 auto;
  border-color: rgba(255,255,255,.7);
  color: white;
}

.archive-banner button span {
  margin-left: 18px;
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  padding: 13px 18px;
  border-radius: 3px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: .25s ease;
}

.toast.show {
  opacity: 1;
  transform: none;
}

@media (max-width: 1120px) {
  .hero {
    padding-inline: 5vw;
  }

  .hero-art {
    transform: scale(.86);
    transform-origin: center;
  }

  .book-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .main-nav a,
  .continue-link {
    display: none;
  }

  .hero {
    display: block;
    min-height: auto;
    padding-top: 60px;
  }

  .hero-copy {
    max-width: none;
  }

  .book-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .category-scroller {
    width: 100%;
  }

  .view-actions {
    align-self: flex-end;
  }
}

@media (max-width: 580px) {
  .site-header {
    min-height: 66px;
    padding-inline: 20px;
  }

  .main-nav {
    gap: 0;
  }

  .favorites-link {
    padding: 20px 0;
    font-size: 0;
  }

  .favorites-link::before {
    content: "Favoriler";
    font-size: 11px;
  }

  .brand strong {
    font-size: 19px;
  }

  .brand-mark {
    width: 29px;
    height: 32px;
  }

  .hero {
    padding: 48px 20px 50px;
  }

  .hero h1 {
    font-size: clamp(48px, 16vw, 68px);
  }

  .hero-description {
    margin-top: 24px;
  }

  .search-box {
    min-height: 56px;
  }

  kbd {
    display: none;
  }

  .hero-stats {
    justify-content: space-between;
    gap: 15px;
  }

  .library-section {
    padding: 65px 20px;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .section-heading > p {
    margin: 0;
  }

  .book-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 38px 18px;
  }

  .cover-title {
    font-size: clamp(17px, 6vw, 25px);
  }

  .cover-author {
    font-size: 6px;
  }

  .favorite-button {
    opacity: 1;
    transform: none;
  }

  .archive-banner {
    align-items: flex-start;
    flex-direction: column;
    margin: 0 20px 60px;
    padding: 40px 28px;
  }

}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
