/* Mobile-first, book-themed design */
:root{
  --paper:#fff8ef; /* warm paper */
  --ink:#2b2b2b;   /* readable text */
  --muted:#6e6b66; /* subdued */
  --accent:#9c3a2f; /* deep maroon */
  --accent-2:#2b6f6f; /* teal for links */
  --card:#fffdf8;
  --radius:14px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family: 'DM Sans', sans-serif;background:var(--paper);color:var(--ink);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}

/* App shell */
.site-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px;background:linear-gradient(180deg,rgba(0,0,0,0.02),transparent);position:sticky;top:0;backdrop-filter: blur(6px);z-index:10}
.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:var(--ink)}
.brand img{height:38px}
.brand .name{font-family: 'Playfair Display', Georgia, serif;font-size:18px;font-weight:700}
.site-sub{font-size:12px;color:var(--muted)}

/* Main content */
.container{padding:16px;max-width:720px;margin:0 auto}
.hero{padding:8px 0 18px}
.hero h1{font-family: 'Playfair Display', Georgia, serif;font-size:28px;margin:8px 0 6px;line-height:1.05}
.hero p{color:var(--muted);margin:0 0 12px;font-size:15px}

/* Book list - mobile-first */
.book-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;padding-bottom:80px}
.book-item{background:var(--card);border-radius:var(--radius);box-shadow:0 6px 18px rgba(42,35,22,0.06);overflow:hidden;text-decoration:none;color:inherit;display:block}
.book-item .cover{width:100%;height:140px;object-fit:cover;display:block}
.book-item .info{padding:10px 12px}
.book-item .title{font-family: 'Playfair Display', Georgia, serif;font-size:15px;margin:0 0 6px;line-height:1.2}
.book-item .author{color:var(--muted);font-size:12px;margin:0 0 8px}
.book-item .meta{display:flex;justify-content:space-between;align-items:center;font-size:11px;color:var(--muted);gap:6px}
.book-item .meta a{color:var(--accent-2);text-decoration:none}

@media (min-width:640px){
  .book-list{grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}
}
@media (min-width:960px){
  .book-list{grid-template-columns:repeat(5,minmax(0,1fr));gap:14px}
}
@media (min-width:720px){
  .hero h1{font-size:36px}
  .container{max-width:980px}
}

/* Bottom nav for mobile */
.bottom-nav{ padding:8px 12px; position:fixed; left:0px; right:0px; bottom:0px; background-color: #5d513f; display:flex; justify-content:space-around; align-items:center;}
.bottom-nav a { font-size:13px; color: #ffffff; text-decoration:none; display:flex; flex-direction:column; align-items:center;gap:4px;padding:4px 10px;border-radius:10px}
.bottom-nav a.active{background:rgba(0,0,0,0.25)}
.nav-icon{font-size:20px;display:block}

/* Utilities */
.link-row{display:flex;align-items:center;gap:12px;margin-top:10px}
.link-row a{display:inline-flex;align-items:center;justify-content:center}
.btn-primary{background:var(--accent);color:#fff;padding:10px 14px;border-radius:10px;text-decoration:none;display:inline-block}
.search{display:flex;gap:8px;margin-top:8px}
.search input{flex:1;padding:10px 12px;border-radius:10px;border:1px solid #efe3d8;background:#fff}

.footer{ padding: 18px 18px 150px 18px; text-align:center; color:var(--muted); font-size:13px; margin-bottom: 200px}

/* Phone-frame emulation for desktop browsers */
@media (min-width:701px){
  :root{
    --phone-w:390px;
    --phone-h:min(844px,90vh);
  }
  html{
    background:radial-gradient(circle at 50% 30%,#2a2521 0%,#0f0d0b 100%);
    height:100%;
    overflow:hidden;
    display:flex;
    align-items:center;
    justify-content:center;
  }
  body{
    width:var(--phone-w);
    height:var(--phone-h);
    margin:0;
    border-radius:46px;
    overflow-y:auto;
    overflow-x:hidden;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    padding-top:36px;
    box-shadow:
      0 0 0 10px #0a0a0a,   /* bezel */
      0 0 0 13px #3a3a3a,   /* bezel edge highlight */
      0 40px 90px rgba(0,0,0,0.6);
    /* deliberately no transform here: that would make body (the scroll
       container) the containing block for its own fixed children, so they'd
       scroll with the content instead of staying pinned to the frame. Nav/
       notch/home-indicator below are positioned against the true viewport
       via calc(), using the frame's known centered size, instead. */
  }
  body::-webkit-scrollbar{display:none}

  /* Bottom nav pinned to the phone frame's bottom edge, not body's scroll flow */
  .bottom-nav{
    left:50%;
    right:auto;
    bottom:calc((100vh - var(--phone-h))/2);
    transform:translateX(-50%);
    width:var(--phone-w);
    border-radius:0 0 46px 46px;
    z-index:20;
  }

  /* Notch */
  html::before{
    content:"";
    position:fixed;
    top:calc((100vh - var(--phone-h))/2 + 10px);
    left:50%;
    transform:translateX(-50%);
    width:120px;
    height:26px;
    background:#0a0a0a;
    border-radius:14px;
    z-index:999;
    pointer-events:none;
  }
  /* Home indicator */
  html::after{
    content:"";
    position:fixed;
    bottom:calc((100vh - var(--phone-h))/2 + 8px);
    left:50%;
    transform:translateX(-50%);
    width:130px;
    height:4px;
    border-radius:3px;
    background:rgba(0,0,0,0.3);
    z-index:999;
    pointer-events:none;
  }
}
