/* =========================
   Storybook Theme Tokens
   ========================= */
:root{
  --paper: #e6d2a4;           /* parchment */
  --paper-deep: #d7b56c;      /* deeper parchment */
  --ink: #1a1208;             /* warm dark ink */
  --accent: #7e5321;          /* wood/border accent */
  --shadow: rgba(0,0,0,.28);
}

nav a {
  --biw: 18px;                  /* border width (affects corner scaling) */
  --slice: 128;                  /* inward slice from each edge of PNG */

  display: inline-grid;
  place-items: center;

  height: 75px;                  /* lock height exactly */
  min-width: 170px;
  padding: 0 1rem;

  border: var(--biw) solid transparent;
  border-image-source: url('assets/button.png');
  border-image-slice: var(--slice) fill;
  border-image-width: var(--biw);
  border-image-repeat: stretch;

  background: none;
  color: var(--ink);
  font-family: "Gill Sans MT Ext Condensed Bold","Gill Sans MT Condensed",sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255,255,255,.55), 0 1px 6px rgba(0,0,0,.25);

  filter: drop-shadow(0 4px 6px rgba(0,0,0,.28));
  transition: transform .2s ease, filter .2s ease;
}

nav a:hover {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.3));
}

nav a:active {
  transform: translateY(0) scale(.98);
}



/* =========================
   Base
   ========================= */
* { box-sizing: border-box; }
html, body { height: 100%; }
body{
  margin: 0;
  font-family: 'Nunito', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255,255,255,.45), transparent 70%),
    var(--paper);
}

/* Headings in the book’s display face */
h1, h2{
  font-family: "Gill Sans MT Ext Condensed Bold", "Gill Sans MT Condensed",
               "League Gothic", "Oswald", system-ui, sans-serif;
  letter-spacing: .5px;
  margin: 0 0 .5rem;
}

/* =========================
   Subpage Hero/Banner
   ========================= */
.hero{
  height: 34vh;
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--ink);
  background:
    radial-gradient(60% 80% at 50% 30%, rgba(255,255,255,.45), rgba(255,255,255,.15) 60%, transparent 100%),
    var(--paper-deep);
  border-bottom: 1px solid rgba(126,83,33,.35);
  box-shadow: 0 10px 20px var(--shadow);
}
.hero-text h1{
  font-size: clamp(2rem, 5vw, 3rem);
  text-shadow: 0 1px 0 rgba(255,255,255,.55), 0 2px 6px var(--shadow);
}

/* =========================
   Books Grid
   ========================= */
.books-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  padding: clamp(16px, 3vw, 32px);
  margin: clamp(12px, 2vw, 24px);
  background:
    radial-gradient(50% 100% at 50% 0%, rgba(255,255,255,.35), rgba(255,255,255,0) 70%),
    #fff6de;
  border: 1px solid rgba(126,83,33,.25);
  border-radius: 18px;
  box-shadow: 0 10px 20px var(--shadow), inset 0 1px 0 rgba(255,255,255,.6);
}

/* Book card */
.book-card{
  background: linear-gradient(180deg, rgba(255,255,255,.85), rgba(255,255,255,.92)),
              var(--paper);
  border: 1px solid rgba(126,83,33,.35);
  border-radius: 16px;
  padding: 1.1rem;
  text-align: center;
  box-shadow: 0 6px 14px var(--shadow), inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .25s ease, box-shadow .25s ease;
}
.book-card:hover{
  transform: translateY(-4px);
  box-shadow: 0 10px 18px var(--shadow);
}

.book-card img{
  width: 100%;
  max-width: 190px;
  height: auto;
  border-radius: 10px;
  border: 3px solid rgba(126,83,33,.45);
  box-shadow: 0 6px 12px var(--shadow);
  margin-bottom: .8rem;
}

.book-card h2{
  font-size: 1.5rem;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

.book-card p{
  font-size: 1rem;
  line-height: 1.45;
  color: var(--ink);
}

/* =========================
   Buttons (use button.png)
   ========================= */
/* Parchment button using 9-slice so corners don't distort */
a.button, .add-to-cart, #checkout-btn{
  --biw: 34px;                   /* border-image width (tweak if needed) */
  --slice: 140;                  /* how far in to slice from each edge of the PNG */

  position: relative;
  display: inline-grid;
  place-items: center;

  padding: 0.6rem 1.25rem;       /* inner space for the label */
  border: var(--biw) solid transparent;
  border-image-source: url('assets/button.png');
  border-image-slice: var(--slice) fill;   /* <— 9-slice with center fill */
  border-image-width: var(--biw);
  border-image-repeat: stretch;

  background: none;              /* background handled by border-image */
  color: var(--ink);
  font-family: "Gill Sans MT Ext Condensed Bold","Gill Sans MT Condensed",sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  line-height: 1;                /* keeps height tidy */
  text-decoration: none;
  cursor: pointer;

  text-shadow: 0 1px 0 rgba(255,255,255,.55), 0 1px 6px rgba(0,0,0,.25);
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.28));
  transition: transform .2s ease, filter .2s ease;
}

a.button:hover, .add-to-cart:hover, #checkout-btn:hover{
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 8px 12px rgba(0,0,0,.3));
}

a.button:active, .add-to-cart:active, #checkout-btn:active{
  transform: translateY(0) scale(.98);
}


/* If you still want a solid-color fallback for .add-to-cart, keep this below as a safety:
.add-to-cart{ background: var(--accent); color: #fff; } */

/* =========================
   Cart Icon & Panel
   ========================= */
#cart-icon{
  position: fixed;
  top: 1rem; right: 1rem;
  padding: .5rem 1rem;
  font-weight: 800;
  border-radius: 999px;
  color: var(--ink);
  background:
    radial-gradient(60% 80% at 50% 40%, rgba(255,255,255,.45), rgba(255,255,255,.15) 60%, transparent 100%),
    var(--paper-deep);
  border: 1px solid rgba(126,83,33,.35);
  box-shadow: 0 6px 12px var(--shadow), inset 0 1px 0 rgba(255,255,255,.6);
  cursor: pointer;
  z-index: 1000;
}

#cart-panel{
  position: fixed;
  top: 0; right: 0;
  width: min(92vw, 340px);
  height: 100%;
  background:
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(255,255,255,.96)),
    var(--paper);
  border-left: 1px solid rgba(126,83,33,.35);
  box-shadow: -8px 0 18px rgba(0,0,0,.25);
  padding: 1rem;
  transform: translateX(100%);
  transition: transform .3s ease;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
#cart-panel.visible{ transform: translateX(0); }

#cart-panel h3{
  margin: 0;
  color: var(--ink);
  font-family: "Gill Sans MT Ext Condensed Bold", "Gill Sans MT Condensed", sans-serif;
  letter-spacing: .5px;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}

#cart-items{
  list-style: none;
  padding: 0;
  margin: .25rem 0 0;
  flex: 1;
  overflow-y: auto;
}
#cart-items li{
  margin-bottom: .5rem;
  font-size: 1rem;
  color: var(--ink);
}

.cart-total{
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
}

/* Checkout button uses the same parchment button */
#checkout-btn{
  width: 100%;
}

#cart-items li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
}

.remove-item {
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}



/* =========================
   Mobile
   ========================= */
@media (max-width: 600px){
  .hero{ height: 28vh; }
  .hero-text h1{ font-size: 1.75rem; }

  .books-grid{ gap: 1rem; padding: 1rem; }
  .book-card img{ max-width: 140px; }
  h2{ font-size: 1.25rem; }
}
