/* Layout: left-aligned hero with a fanned stack of covers, filterable shelf of books, author strip, quiet footer */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --ink: #0b0b1e;
  --muted: #565870;
  --line: #e1e2ec;
  --accent: #f2d52b;
  --badge-bg: #0b0b1e;
  --badge-fg: #f5f6fa;
  --chip-on-bg: #0b0b1e;
  --chip-on-fg: #ffffff;
  --shadow: 11 11 30;
  --logo-filter: invert(1);
  --logo-blend: multiply;

  --f-display: "Archivo", "Arial Black", system-ui, sans-serif;
  --f-body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --wrap: 1180px;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0a1c; --surface: #121229; --ink: #ececf6; --muted: #9a9cb8; --line: #25253f;
    --accent: #f2d52b; --badge-bg: #f2d52b; --badge-fg: #0a0a1c;
    --chip-on-bg: #f2d52b; --chip-on-fg: #0a0a1c; --shadow: 0 0 0;
    --logo-filter: none; --logo-blend: screen;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a0a1c; --surface: #121229; --ink: #ececf6; --muted: #9a9cb8; --line: #25253f;
  --accent: #f2d52b; --badge-bg: #f2d52b; --badge-fg: #0a0a1c;
  --chip-on-bg: #f2d52b; --chip-on-fg: #0a0a1c; --shadow: 0 0 0;
  --logo-filter: none; --logo-blend: screen;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
img { max-width: 100%; }
[hidden] { display: none !important; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s, color .25s;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: clamp(16px, 4vw, 40px); }

/* ---------- Header ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.logo {
  font-family: var(--f-display); font-weight: 800; font-size: 1.15rem; letter-spacing: -.01em;
  text-decoration: none; display: inline-block; transform: rotate(-3deg); white-space: nowrap;
}
.logo span { color: var(--muted); font-weight: 600; }
.nav { display: flex; align-items: center; gap: clamp(8px, 2vw, 24px); }
.nav a { text-decoration: none; color: var(--muted); font-weight: 500; font-size: .95rem; }
.nav a:hover, .nav a[aria-current] { color: var(--ink); }
.theme-btn {
  width: 38px; height: 38px; display: grid; place-items: center; flex: none;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; cursor: pointer;
}
.theme-btn:hover { border-color: var(--ink); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn.spin svg { animation: spin .5s cubic-bezier(.3,1.4,.5,1); }
@keyframes spin { from { transform: rotate(-120deg) scale(.4); opacity: 0; } }
.theme-btn .sun { display: none; }
.is-dark .theme-btn .sun { display: block; }
.is-dark .theme-btn .moon { display: none; }

/* ---------- Hero ---------- */
.hero { padding-block: clamp(48px, 8vw, 96px) clamp(40px, 6vw, 72px); }
.hero .wrap { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 5vw, 64px); align-items: center; }
.hero-copy { min-width: 0; }
h1 {
  font-family: var(--f-display); font-weight: 900; font-stretch: 102%;
  font-size: clamp(2.2rem, 6vw, 4.4rem); line-height: 1.02; letter-spacing: -.025em;
  margin: 0 0 28px; text-wrap: balance;
}
.badge {
  display: inline-block; background: var(--badge-bg); color: var(--badge-fg);
  padding: .02em .22em .08em; border-radius: .12em; transform: rotate(-3deg);
  margin-top: .12em; white-space: nowrap;
  animation: badge-in .8s cubic-bezier(.3,1.5,.5,1) .45s both, float 4.5s ease-in-out 1.3s infinite;
  box-shadow: 0 .18em .4em -.15em rgb(var(--shadow) / .35);
}
@keyframes badge-in {
  from { transform: rotate(-14deg) scale(.6); opacity: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-.09em) rotate(-1.5deg); }
}
.rise { animation: rise .7s cubic-bezier(.2,.8,.2,1) both; }
.rise-1 { animation-delay: .05s; } .rise-2 { animation-delay: .2s; } .rise-3 { animation-delay: .32s; }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 34em; margin: 0 0 32px; }
.ctas { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 22px; border-radius: 999px;
  font-weight: 600; text-decoration: none; font-size: .98rem; border: 1px solid var(--ink);
  transition: transform .15s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { color: var(--ink); }

.fan { position: relative; height: clamp(300px, 34vw, 420px); }
.fan img {
  position: absolute; top: 50%; left: 50%; width: 52%; max-width: 100%; aspect-ratio: 449 / 720;
  object-fit: cover; border-radius: 3px 8px 8px 3px;
  box-shadow: 0 1px 2px rgb(var(--shadow) / .2), 0 18px 40px -8px rgb(var(--shadow) / .35);
}
.fan img:nth-child(1) { --x: -95%; --r: -9deg; --d: .15s; --p: 0s; }
.fan img:nth-child(2) { --x: -5%; --r: 8deg; --d: .25s; --p: -2.2s; }
.fan img:nth-child(3) { --x: -50%; --y: -52%; --d: 0s; --p: -1.1s; z-index: 2; }
.fan img {
  transform: translate(var(--x), var(--y, -50%)) rotate(var(--r, 0deg));
  animation: deal .9s cubic-bezier(.2,.8,.2,1) var(--d) backwards, drift 6s ease-in-out calc(1s + var(--p)) infinite;
}
.fan:hover img:nth-child(1) { --x: -108%; --r: -13deg; }
.fan:hover img:nth-child(2) { --x: 8%; --r: 12deg; }
.fan:hover img:nth-child(3) { --y: -56%; }
@property --x { syntax: "<percentage>"; inherits: false; initial-value: -50%; }
@property --r { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@property --y { syntax: "<percentage>"; inherits: false; initial-value: -50%; }
@property --lift { syntax: "<length>"; inherits: false; initial-value: 0px; }
.fan img { translate: 0 var(--lift); transition: --x .45s cubic-bezier(.2,.7,.2,1), --r .45s cubic-bezier(.2,.7,.2,1), --y .45s cubic-bezier(.2,.7,.2,1); }
@keyframes deal {
  from { transform: translate(-50%, -40%) rotate(0deg); opacity: 0; }
}
@keyframes drift {
  0%, 100% { --lift: 0px; }
  50% { --lift: -10px; }
}

/* ---------- Shelf ---------- */
.shelf { padding-block: 24px 80px; }
.shelf-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 32px; padding-top: 32px; border-top: 1px solid var(--line); }
h2 {
  font-family: var(--f-display); font-weight: 800; font-stretch: 112%;
  font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -.02em; line-height: 1.1; margin: 0; text-wrap: balance;
}

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 32px; list-style: none; padding: 0; margin: 0; }
.book { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 20px; align-items: start; position: relative; }
.cover {
  position: relative; width: 100%; aspect-ratio: 449 / 720; border-radius: 2px 6px 6px 2px; overflow: hidden;
  box-shadow: 0 1px 2px rgb(var(--shadow) / .2), 0 12px 24px -10px rgb(var(--shadow) / .4);
  transition: transform .3s cubic-bezier(.2,.7,.2,1), box-shadow .3s;
}
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover::after { /* spine crease */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 10px;
  background: linear-gradient(90deg, rgb(0 0 0 / .22), rgb(255 255 255 / .18) 45%, rgb(0 0 0 / 0));
}
.cover::before { /* light sweep on hover */
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .35) 50%, transparent 65%);
  transform: translateX(-120%);
}
.book:hover .cover::before { transform: translateX(120%); transition: transform .8s ease; }
.book:hover .cover { transform: translateY(-6px) rotate(-2deg); box-shadow: 0 1px 2px rgb(var(--shadow) / .2), 0 22px 34px -12px rgb(var(--shadow) / .5); }
.book-body { min-width: 0; display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--f-mono); font-size: .7rem; font-weight: 500; letter-spacing: .02em;
  padding: 2px 7px; border-radius: 4px; border: 1px solid var(--line); color: var(--muted);
}
.book h3 { font-family: var(--f-display); font-weight: 800; font-stretch: 112%; font-size: 1.12rem; line-height: 1.2; letter-spacing: -.01em; margin: 0; text-wrap: balance; }
.book p { margin: 0; color: var(--muted); font-size: .94rem; line-height: 1.5; }
.more {
  margin-top: 4px; font-weight: 600; font-size: .92rem; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; width: fit-content;
  background: linear-gradient(var(--accent), var(--accent)) 0 92% / 0 .38em no-repeat;
  transition: background-size .25s;
}
.more::before { content: ""; position: absolute; inset: 0; } /* whole card clickable */
.book:hover .more { background-size: 100% .38em; }
.more svg { width: 14px; height: 14px; transition: transform .2s; }
.book:hover .more svg { transform: translateX(3px); }

@supports (animation-timeline: view()) {
  .book, .author-card {
    animation: reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 45%;
  }
}
@keyframes reveal { from { opacity: 0; transform: translateY(40px); } }

/* ---------- Author ---------- */
.author { padding-block: 0 80px; }
.author-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(20px, 4vw, 48px); align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: clamp(24px, 4vw, 40px);
}
.author-card img.me { width: 96px; height: 96px; border-radius: 50%; display: block; }
.author-card h2 { font-size: clamp(1.3rem, 2.2vw, 1.6rem); margin-bottom: 8px; }
.author-card p { margin: 0; color: var(--muted); max-width: 36em; }
.seen { min-width: 0; }
.seen img { width: 100%; display: block; filter: var(--logo-filter); mix-blend-mode: var(--logo-blend); opacity: .85; }

/* ---------- Simple pages (contact, newsletter) ---------- */
.page { flex: 1; padding-block: clamp(56px, 10vw, 112px); }
.page .wrap { max-width: 640px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 20px; }
.page h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0; }
.page p { margin: 0; color: var(--muted); font-size: 1.1rem; }
.page .avatar { width: 96px; height: 96px; border-radius: 50%; }
.page .mail { font-size: 1rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); padding: 10px 16px; border-radius: 8px; }
.subscribe { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.subscribe input[type="email"] {
  font: inherit; padding: 13px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.subscribe input[type="email"]:focus { outline: none; border-color: var(--ink); }
.subscribe .btn { justify-content: center; cursor: pointer; font-family: inherit; }
.subscribe small { color: var(--muted); font-size: .8rem; }

/* ---------- Footer ---------- */
footer { margin-top: auto; border-top: 1px solid var(--line); padding-block: 28px 40px; color: var(--muted); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; }
.social { display: flex; gap: 8px; }
.social a { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.social a:hover { color: var(--ink); border-color: var(--ink); }
.social svg { width: 15px; height: 15px; }
.mail { font-family: var(--f-mono); font-size: .82rem; user-select: all; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .author-card { grid-template-columns: auto minmax(0, 1fr); }
  .seen { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .fan { height: 300px; max-width: 420px; width: 100%; margin-inline: auto; }
  .fan img { width: 44%; }
  .grid { grid-template-columns: 1fr; gap: 32px; }
  .book { grid-template-columns: 112px minmax(0, 1fr); }
  .nav .hide-sm { display: none; }
}
@media (max-width: 420px) {
  .author-card { grid-template-columns: 1fr; }
  .logo { font-size: 1rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
