/* The Library — a local, offline master catalogue */

:root {
  --ui: "Avenir Next", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Charter, Georgia, serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1240px;
  --radius: 18px;
  --card-radius: 20px;
}

html[data-theme="paper"] {
  color-scheme: light;
  --bg: #ece7dd;
  --bg-deep: #e5dfd3;
  --surface: #fbf8f1;
  --surface-2: #f3eee4;
  --surface-3: #ece5d8;
  --text: #20231f;
  --text-soft: #41443c;
  --muted: #726d63;
  --faint: #9c9588;
  --line: #dcd4c5;
  --line-strong: #c6bcaa;
  --accent: #a84927;
  --accent-strong: #86391e;
  --accent-soft: rgba(168, 73, 39, 0.1);
  --forest: #315c4e;
  --forest-soft: rgba(49, 92, 78, 0.1);
  --button-text: #fffaf2;
  --shadow: 0 20px 60px rgba(55, 48, 37, 0.12);
  --shadow-soft: 0 3px 16px rgba(55, 48, 37, 0.07);
  --cover-shadow: 0 18px 34px rgba(48, 41, 30, 0.22);
  --glow: rgba(168, 73, 39, 0.09);
  --header-bg: rgba(236, 231, 221, 0.84);
  --scrim: rgba(30, 29, 25, 0.55);
}

html[data-theme="sepia"] {
  color-scheme: light;
  --bg: #e7dac2;
  --bg-deep: #ddcfb5;
  --surface: #f6edda;
  --surface-2: #eee1c9;
  --surface-3: #e6d7bc;
  --text: #392e22;
  --text-soft: #51402f;
  --muted: #7c6952;
  --faint: #9c866a;
  --line: #d6c4a5;
  --line-strong: #c2ab86;
  --accent: #984420;
  --accent-strong: #793216;
  --accent-soft: rgba(152, 68, 32, 0.12);
  --forest: #4b6047;
  --forest-soft: rgba(75, 96, 71, 0.11);
  --button-text: #fff9ed;
  --shadow: 0 20px 60px rgba(66, 47, 24, 0.14);
  --shadow-soft: 0 3px 16px rgba(66, 47, 24, 0.08);
  --cover-shadow: 0 18px 34px rgba(58, 40, 20, 0.26);
  --glow: rgba(152, 68, 32, 0.1);
  --header-bg: rgba(231, 218, 194, 0.86);
  --scrim: rgba(40, 30, 18, 0.58);
}

html[data-theme="night"] {
  color-scheme: dark;
  --bg: #101311;
  --bg-deep: #0b0d0c;
  --surface: #191c18;
  --surface-2: #1e211d;
  --surface-3: #252923;
  --text: #e3ded2;
  --text-soft: #cec8ba;
  --muted: #999287;
  --faint: #746f65;
  --line: #2c302a;
  --line-strong: #3d4239;
  --accent: #d47c55;
  --accent-strong: #e59671;
  --accent-soft: rgba(212, 124, 85, 0.14);
  --forest: #86b9a5;
  --forest-soft: rgba(134, 185, 165, 0.11);
  --button-text: #18130f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
  --shadow-soft: 0 3px 18px rgba(0, 0, 0, 0.26);
  --cover-shadow: 0 18px 38px rgba(0, 0, 0, 0.55);
  --glow: rgba(212, 124, 85, 0.09);
  --header-bg: rgba(16, 19, 17, 0.86);
  --scrim: rgba(0, 0, 0, 0.68);
}

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 300px;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 55rem 42rem at 8% -8%, var(--glow), transparent 65%),
    radial-gradient(ellipse 42rem 34rem at 98% 8%, var(--forest-soft), transparent 68%),
    var(--bg);
  color: var(--text);
  font-family: var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
}

[hidden] { display: none !important; }

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
img { max-width: 100%; display: block; }
svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

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

::selection { background: var(--accent-soft); }

.skip-link {
  position: fixed;
  top: -90px;
  left: 16px;
  z-index: 100;
  padding: 10px 15px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  transition: top 140ms ease;
}
.skip-link:focus { top: 14px; }

.wrap {
  width: min(var(--wrap), calc(100% - 48px));
  margin-inline: auto;
}

/* Header ------------------------------------------------------------------ */

.site-head {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  background: var(--header-bg);
  backdrop-filter: saturate(130%) blur(18px);
  -webkit-backdrop-filter: saturate(130%) blur(18px);
}

.head-inner {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--text);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #1d2723;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08), var(--shadow-soft);
  color: #d47c55;
}
.brand-mark svg { width: 24px; height: 24px; stroke-width: 1.8; }

.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong {
  font-family: var(--display);
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  line-height: 1;
}
.brand-copy small {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.head-tools { display: flex; align-items: center; gap: 14px; }

.local-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 650;
  letter-spacing: 0.04em;
}
.local-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--forest);
  box-shadow: 0 0 0 4px var(--forest-soft);
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--text-soft);
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}
.icon-button:hover { background: var(--surface); border-color: var(--line-strong); color: var(--accent); transform: translateY(-1px); }
.icon-button svg { width: 18px; height: 18px; }
.theme-icon { display: none; }
html[data-theme="night"] .theme-icon-sun { display: block; }
html:not([data-theme="night"]) .theme-icon-moon { display: block; }

/* Hero -------------------------------------------------------------------- */

.hero { padding: clamp(48px, 7vw, 96px) 0 clamp(38px, 5.6vw, 68px); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.78fr);
  gap: clamp(38px, 6vw, 88px);
  align-items: center;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 1.4;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 860px;
  margin: 15px 0 24px;
  font-family: var(--display);
  font-size: clamp(3.15rem, 7.1vw, 6.35rem);
  font-weight: 500;
  letter-spacing: -0.052em;
  line-height: 0.92;
  text-wrap: balance;
}
.hero h1 em {
  color: var(--accent);
  font-weight: 400;
  font-style: italic;
}

.lede {
  max-width: 610px;
  margin: 0;
  color: var(--text-soft);
  font-family: var(--display);
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 22px;
  margin-top: 32px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 760;
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.button svg { width: 17px; height: 17px; transition: transform 150ms ease; }
.button:hover { transform: translateY(-1px); }
.button:hover svg { transform: translateX(2px); }

.button-primary {
  background: var(--accent);
  color: var(--button-text);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 24%, transparent);
}
.button-primary:hover { background: var(--accent-strong); }

.button-ghost {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--text);
}
.button-ghost:hover { background: var(--surface); }

.button-small { min-height: 38px; padding: 8px 15px; font-size: 0.77rem; }

.offline-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.offline-note span { color: var(--forest); font-size: 0.55rem; }

.library-card {
  position: relative;
  overflow: hidden;
  padding: 27px 28px 22px 34px;
  border: 1px solid var(--line);
  border-radius: 5px var(--card-radius) var(--card-radius) 5px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, var(--accent-soft)), var(--surface-2));
  box-shadow: var(--shadow);
}
.library-card::before {
  content: "";
  position: absolute;
  inset: 14px auto 14px 0;
  width: 5px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(var(--accent), var(--forest));
  opacity: 0.88;
}
.library-card::after {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  right: -90px;
  top: -118px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  box-shadow: 0 0 0 28px color-mix(in srgb, var(--accent) 5%, transparent);
  pointer-events: none;
}
.library-card-head { display: flex; align-items: center; gap: 10px; }
.card-rule { width: 24px; height: 1px; background: var(--accent); }
.library-card .eyebrow { color: var(--muted); font-size: 0.62rem; letter-spacing: 0.14em; }

.big-number {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 13px 0 20px;
  font-family: var(--display);
  font-size: clamp(3.2rem, 4.7vw, 4.5rem);
  letter-spacing: -0.05em;
  line-height: 1;
}
.big-number small {
  color: var(--muted);
  font-family: var(--ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  padding: 17px 0 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-row > div { display: flex; flex-direction: column; gap: 3px; }
.stat-value {
  font-family: var(--display);
  font-size: 1.65rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.stat-label {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.35;
  text-transform: uppercase;
}

.library-note {
  margin: 16px 0 20px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
}

.spine-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 16px;
  opacity: 0.72;
}
.spine-row span { display: block; width: 17px; height: 12px; border-radius: 2px; background: var(--accent); }
.spine-row span:nth-child(2) { height: 16px; background: var(--forest); }
.spine-row span:nth-child(3) { height: 10px; background: var(--line-strong); }
.spine-row span:nth-child(4) { height: 15px; background: var(--accent); opacity: 0.7; }
.spine-row span:nth-child(5) { height: 8px; background: var(--forest); opacity: 0.7; }
.spine-row span:nth-child(6) { height: 13px; background: var(--line-strong); }

/* Resume strip ------------------------------------------------------------ */

#resumeSlot { margin-top: -8px; margin-bottom: 22px; }

.resume-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 14px 20px 14px 16px;
  border: 1px solid color-mix(in srgb, var(--forest) 24%, var(--line));
  border-radius: 15px;
  background:
    linear-gradient(100deg, var(--forest-soft), transparent 60%),
    color-mix(in srgb, var(--surface) 86%, transparent);
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  transition: border-color 150ms ease, transform 150ms ease, background 150ms ease;
}
.resume-card:hover { border-color: var(--forest); transform: translateY(-1px); }

.resume-cover {
  width: 58px;
  height: 74px;
  overflow: hidden;
  border-radius: 3px 7px 7px 3px;
  background: var(--surface-3);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}
.resume-cover img { width: 100%; height: 100%; object-fit: cover; }
.resume-cover.is-wide img { object-fit: contain; padding: 5px; background: var(--surface-2); }

.resume-body { min-width: 0; }
.resume-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--forest);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}
.resume-title {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: var(--display);
  font-size: 1.14rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.resume-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 0.7rem; }
.resume-meter {
  width: min(520px, 100%);
  height: 3px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--line);
}
.resume-meter span { display: block; height: 100%; border-radius: inherit; background: var(--forest); }
.resume-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 750;
  white-space: nowrap;
}
.resume-cta svg { width: 16px; height: 16px; transition: transform 150ms ease; }
.resume-card:hover .resume-cta svg { transform: translateX(3px); }

/* Catalogue --------------------------------------------------------------- */

.catalog {
  padding: clamp(30px, 4.8vw, 60px) 0 clamp(60px, 8vw, 105px);
  scroll-margin-top: 92px;
}

.catalog-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 26px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.catalog h2,
.shelf h2 {
  margin: 7px 0 0;
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.catalog-head h2 { font-size: clamp(1.75rem, 3vw, 2.4rem); }

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(370px, 100%);
  min-height: 44px;
  padding: 0 12px 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 74%, transparent);
  color: var(--muted);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.search-box:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search-box svg { width: 17px; height: 17px; flex: none; }
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
}
.search-box input::placeholder { color: var(--faint); }
.search-box kbd {
  display: inline-grid;
  place-items: center;
  min-width: 21px;
  height: 21px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--faint);
  font-family: var(--mono);
  font-size: 0.65rem;
}

.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
}

.filter-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 33px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}
.chip span { color: var(--faint); font-size: 0.64rem; font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--line-strong); color: var(--text); background: color-mix(in srgb, var(--surface) 54%, transparent); }
.chip.is-active { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); color: var(--accent); }
.chip.is-active span { color: var(--accent); }
.result-count { margin: 0; color: var(--faint); font-size: 0.69rem; white-space: nowrap; }

.shelf { margin-top: clamp(42px, 5.4vw, 66px); scroll-margin-top: 92px; }

.shelf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.shelf h2 { font-size: clamp(1.45rem, 2.45vw, 2rem); }
.shelf-count { color: var(--faint); font-size: 0.67rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }

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

.reader-card {
  position: relative;
  display: grid;
  grid-template-columns: 194px minmax(0, 1fr);
  gap: 24px;
  padding: 23px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background:
    radial-gradient(ellipse 20rem 16rem at 100% 0%, var(--glow), transparent 70%),
    var(--surface);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.reader-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  box-shadow: var(--shadow);
}

.cover-link { display: block; height: max-content; text-decoration: none; }
.cover-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line) 60%, #000 12%);
  border-radius: 3px 9px 9px 3px;
  background: var(--surface-3);
  box-shadow: var(--cover-shadow);
}
.cover-frame::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 2;
  width: 7px;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.2), transparent);
}
.cover-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(115deg, rgba(255, 255, 255, 0.16), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.1));
  opacity: 0.65;
}
.cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reader-card:hover .cover-frame img { transform: scale(1.018); }
.cover-frame.is-wide {
  aspect-ratio: 16 / 9;
  background: #121512;
}
.cover-frame.is-wide img {
  padding: 0;
  object-fit: contain;
  background: transparent;
}

.reader-body { display: flex; flex-direction: column; min-width: 0; }

.card-type {
  margin: 1px 0 8px;
  color: var(--accent);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.reader-card h3,
.pdf-card h3 {
  margin: 0;
  font-family: var(--display);
  font-weight: 550;
  letter-spacing: -0.03em;
  line-height: 1.06;
}
.reader-card h3 { font-size: clamp(1.35rem, 2vw, 1.72rem); }
.reader-card h3 a { text-decoration: none; }
.reader-card h3 a:hover { color: var(--accent); }

.book-byline {
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.4;
}
.book-subtitle {
  display: -webkit-box;
  margin: 9px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.9rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.book-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
}
.book-facts li {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface-2) 68%, transparent);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 650;
  white-space: nowrap;
}

.card-progress { margin-top: auto; padding-top: 19px; }
.progress-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 650;
}
.progress-line strong { color: var(--text-soft); font-weight: 750; }
.progress-track {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--forest))); }

.card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 15px;
}
.card-ready { color: var(--faint); font-size: 0.65rem; }
.card-ready strong { color: var(--text-soft); }

.pdf-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
}

.pdf-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 13px 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}
.pdf-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
  box-shadow: var(--shadow);
}

.pdf-cover {
  position: relative;
  display: block;
  text-decoration: none;
}
.pdf-card .cover-frame { aspect-ratio: 3 / 4; }
.pdf-card .cover-frame.is-wide { aspect-ratio: 16 / 9; }
.pdf-card .cover-frame.is-wide img { padding: 0; }

.format-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 3;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  background: rgba(20, 22, 19, 0.72);
  color: #f8f2e6;
  font-size: 0.55rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  backdrop-filter: blur(6px);
}

.pdf-body { display: flex; flex: 1; flex-direction: column; padding: 14px 3px 0; }
.pdf-card h3 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 1.03rem;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pdf-card .book-byline {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  font-size: 0.67rem;
  font-weight: 600;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.pdf-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}
.pdf-meta { color: var(--faint); font-size: 0.59rem; line-height: 1.4; }
.open-pdf {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  color: var(--accent);
  font-size: 0.64rem;
  font-weight: 800;
  text-decoration: none;
}
.open-pdf svg { width: 13px; height: 13px; }
.open-pdf:hover { color: var(--accent-strong); }

.empty-state {
  margin: 52px auto;
  max-width: 480px;
  padding: 34px 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  text-align: center;
}
.empty-mark {
  display: block;
  margin-bottom: 8px;
  color: var(--faint);
  font-family: var(--display);
  font-size: 2.2rem;
}
.empty-state h3 { margin: 0; font-family: var(--display); font-size: 1.35rem; font-weight: 600; }
.empty-state p { margin: 7px 0 18px; color: var(--muted); font-size: 0.8rem; }

/* Footer ------------------------------------------------------------------ */

.site-foot {
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-deep) 64%, transparent);
}
.foot-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  padding: 32px 0 38px;
}
.foot-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 600;
}
.foot-copy { margin: 5px 0 0; color: var(--muted); font-size: 0.7rem; }
.foot-meta { margin: 0; color: var(--faint); font-size: 0.65rem; line-height: 1.7; text-align: right; }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1060px) {
  .hero-grid { grid-template-columns: minmax(0, 1.25fr) minmax(270px, 0.8fr); gap: 42px; }
  .reader-card { grid-template-columns: 168px minmax(0, 1fr); gap: 20px; padding: 20px; }
  .reader-card h3 { font-size: 1.42rem; }
  .pdf-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 38px; }
  .hero h1 { max-width: 720px; }
  .library-card { max-width: 520px; }
  .reader-grid { grid-template-columns: 1fr; }
  .reader-card { grid-template-columns: 186px minmax(0, 1fr); }
  .pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-head { align-items: flex-start; flex-direction: column; }
  .search-box { width: 100%; max-width: 460px; }
}

@media (max-width: 620px) {
  .wrap { width: min(var(--wrap), calc(100% - 30px)); }
  .head-inner { min-height: 66px; }
  .brand-mark { width: 38px; height: 38px; }
  .brand-copy strong { font-size: 1.08rem; }
  .local-badge { display: none; }

  .hero { padding-top: 40px; }
  .hero h1 { font-size: clamp(3rem, 14vw, 4.15rem); }
  .lede { font-size: 1rem; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 14px; }

  .library-card { padding: 24px 24px 20px 30px; }

  .filter-row { align-items: flex-start; flex-direction: column; gap: 12px; }
  .result-count { padding-left: 2px; }

  .reader-card { grid-template-columns: 116px minmax(0, 1fr); gap: 16px; padding: 15px; }
  .reader-card h3 { font-size: 1.18rem; }
  .book-subtitle { font-size: 0.82rem; -webkit-line-clamp: 3; }
  .book-facts { gap: 4px; margin-top: 12px; }
  .book-facts li { padding: 3px 6px; font-size: 0.56rem; }
  .card-progress { padding-top: 13px; }
  .card-actions { align-items: flex-start; flex-direction: column; gap: 8px; margin-top: 12px; }
  .button-small { width: 100%; }

  .shelf-head { align-items: flex-start; flex-direction: column; gap: 6px; }
  .pdf-grid { gap: 12px; }
  .pdf-card { padding: 9px 9px 12px; }
  .pdf-card h3 { font-size: 0.92rem; }
  .pdf-body { padding-top: 10px; }
  .pdf-foot { align-items: flex-start; flex-direction: column; gap: 5px; padding-top: 10px; }
  .open-pdf { font-size: 0.6rem; }

  .resume-card { grid-template-columns: 48px minmax(0, 1fr); gap: 13px; padding: 12px 14px; }
  .resume-cover { width: 48px; height: 62px; }
  .resume-cta { grid-column: 2; margin-top: 2px; }
  .resume-title { font-size: 1rem; }

  .foot-inner { align-items: flex-start; flex-direction: column; gap: 16px; }
  .foot-meta { text-align: left; }
}

@media (max-width: 430px) {
  .brand-copy small { display: none; }
  .reader-card { grid-template-columns: 98px minmax(0, 1fr); }
  .reader-card h3 { font-size: 1.08rem; }
  .book-byline { font-size: 0.68rem; }
  .book-subtitle { display: none; }
  .pdf-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdf-card h3 { font-size: 0.86rem; }
  .pdf-card .book-byline { font-size: 0.61rem; }
  .pdf-meta { font-size: 0.55rem; }
}

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