:root{
  --bg:#0b0b0d;
  --fg:#f2f2f4;
  --muted:#a9a9b2;
  --warm: rgba(210, 150, 80, 0.07);
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background:var(--bg);
  color:var(--fg);
}

a{color:var(--fg); text-decoration:none}
a:hover{text-decoration:underline}

.wrap{min-height:100vh}

.page{
  position:relative;
  min-height:100vh;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

/* === DEFAULT BACKGROUND === */
.page::before{
  content:"";
  position:absolute;
  inset:0;
  background: center/cover no-repeat;
  filter: brightness(0.80) contrast(1.06) saturate(0.92);
  transform: scale(1.02);
  z-index:0;
  will-change: transform;
}

/* Drift animation */
@keyframes booksDrift{
  0%   { transform: scale(1.02) translate3d(0,0,0); }
  100% { transform: scale(1.042) translate3d(-0.4%, -0.25%, 0); }
}

.page::before{
  animation: booksDrift 80s ease-in-out infinite alternate;
}

@media (prefers-reduced-motion: reduce){
  .page::before{ animation:none; }
}

/* Overlay */
.page::after{
  content:"";
  position:absolute;
  inset:0;
  background:
    linear-gradient(90deg,
      rgba(11,11,13,0.92) 0%,
      rgba(11,11,13,0.74) 30%,
      rgba(11,11,13,0.46) 58%,
      rgba(11,11,13,0.18) 82%,
      rgba(11,11,13,0.06) 100%),
    radial-gradient(70% 80% at 62% 45%,
      var(--warm) 0%,
      rgba(210,150,80,0.00) 70%);
  z-index:1;
}

/* === SPECIFIC BOOK BACKGROUNDS === */

/* Ты уже в сети */
.page.book-online::before{
  background-image: url("backgrounds/online-bg.jpg");
}

/* Книга Нытия */
.page.book-whinesis::before{
  background-image: url("backgrounds/whinesis-bg.jpg");
}

/* Header */
.site-header{
  position:relative;
  z-index:2;
  padding:22px 44px 0;
  text-align:right;
}

.site-header .brand{
  margin:0 0 6px;
  letter-spacing:0.22em;
  text-transform:uppercase;
  font-size:14px;
  font-weight:600;
  opacity:0.92;
}

.site-header .menu{
  font-size:13px;
  color:var(--muted);
}

.site-header .menu a{
  color:var(--muted);
  margin:0 10px;
}
.site-header .menu a:hover{
  color:var(--fg);
  text-decoration:none;
}

/* Main */
.main{
  position:relative;
  z-index:2;
  flex:1;
  display:flex;
  align-items:center;
}

.container{
  width:100%;
  max-width:980px;
  padding:28px 44px 56px;
}

.h1{
  margin:0 0 10px;
  font-size:28px;
  font-weight:800;
  letter-spacing:0.02em;
}

.lead{
  margin:0 0 16px;
  line-height:1.25;
  color:var(--muted);
  max-width:78ch;
}

/* List blocks */
.list{
  margin-top:14px;
  border:1px solid rgba(242,242,244,0.14);
  border-radius:18px;
  background: rgba(0,0,0,0.18);
  backdrop-filter: blur(4px);
  overflow:hidden;
}

.list-header{
  padding:14px 16px;
  border-bottom:1px solid rgba(242,242,244,0.10);
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
}

.list-header h2{
  margin:0;
  font-size:16px;
  font-weight:700;
}

.list-header .note{
  margin:0;
  font-size:12px;
  color:var(--muted);
}

.items{
  list-style:none;
  margin:0;
  padding:0;
}

.item{
  padding:18px 18px;
  display:grid;
  grid-template-columns: 1fr auto;
  gap:18px;
  border-top:1px solid rgba(242,242,244,0.08);
}
.item:first-child{ border-top:none; }

/* Thumbnails */
.thumb{
  width:110px;
  height:110px;
  border-radius:14px;
  overflow:hidden;
  flex-shrink:0;
}

.thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Title inside list */
.item a{
  font-size:20px;
  font-weight:800;
  line-height:1.25;
}

.item .meta{
  margin-top:8px;
  font-size:13px;
  color:var(--muted);
  line-height:1.25;
  max-width:70ch;
}

/* Badge */
.badge{
  font-size:12px;
  color:var(--muted);
  border:1px solid rgba(242,242,244,0.14);
  border-radius:999px;
  padding:6px 12px;
  white-space:nowrap;
  background: rgba(255,255,255,0.03);
  align-self:start;
}

.badge.warm{
  border-color: rgba(210,150,80,0.22);
  background: rgba(210,150,80,0.06);
}

/* ==== BUTTON NORMALIZE (critical) ==== */
button.btn{
  font-family: inherit;
  background: none;
}

/* Buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 18px;
  border-radius:14px;
  border:1px solid rgba(242,242,244,0.18);
  background: rgba(0,0,0,0.22);
  backdrop-filter: blur(3px);
  font-size:14px;
  font-weight:800;
  text-decoration:none;
  cursor:pointer;
  user-select:none;
  transition: transform 140ms ease,
              background 140ms ease,
              border-color 140ms ease,
              opacity 140ms ease;
  opacity:0.95;

  /* ✅ FIX: force visible text on BOTH <a> and <button> */
  color: var(--fg) !important;

  /* ✅ FIX: prevent browser default styles */
  appearance:none;
  -webkit-appearance:none;
  outline:none;
}

.btn:hover{
  background: rgba(255,255,255,0.08);
  border-color: rgba(242,242,244,0.34);
  transform: translateY(-1px);
  opacity:1;
  text-decoration:none;
  color: var(--fg) !important;
}

.btn:active{
  transform: translateY(0px) scale(0.99);
}

.btn:focus-visible{
  box-shadow: 0 0 0 2px rgba(242,242,244,0.18), 0 0 0 6px rgba(242,242,244,0.08);
}

.btn.secondary{
  font-weight:700;
  border-color: rgba(242,242,244,0.14);
  background: rgba(0,0,0,0.16);
  opacity:0.95;
  color: var(--fg) !important;
}

.cta-row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:14px;
}

/* Seal */
.seal{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:24px;
  color:var(--muted);
  font-size:12px;
}

.seal img{
  height:22px;
  width:auto;
  opacity:0.75;
}

/* Mobile */
@media (max-width: 900px){
  .site-header{ padding:16px 22px 0; }
  .main{ align-items:flex-start; }
  .container{ padding:22px 22px 44px; }

  .item{
    grid-template-columns: 1fr;
  }

  .thumb{
    width:100%;
    height:180px;
  }

  .item a{
    font-size:22px;
  }
}
