/* ============================================================= *
   BookSharing — modern & bold design system
   Big display type · high contrast · vivid accent · card-forward
 * ============================================================= */

:root {
  /* Palette — "the colours of giving": warm leaf green, gold, cream */
  --ink:        #103a30;   /* deep pine — text & dark surfaces */
  --ink-soft:   #38493f;
  --ink-faint:  #7d8a80;
  --paper:      #f5efe2;   /* cream page background */
  --paper-2:    #ece4d2;   /* raised surfaces */
  --card:       #fffdf8;   /* warm white */
  --line:       #e2dac8;

  --accent:     #1f9d6b;   /* giving green — the primary note */
  --accent-ink: #157a52;   /* deeper green for text on light */
  --accent-2:   #1f9d6b;
  --gold:       #e4b24a;   /* warm gold — gratitude */
  --danger:     #c0492f;   /* muted red, errors only */

  --forest:     #1b8f62;   /* green — "given" */

  --radius:     20px;
  --radius-sm:  13px;
  --shadow:     0 1px 2px rgba(20,15,10,.05), 0 18px 40px -22px rgba(20,15,10,.30);
  --shadow-lg:  0 30px 70px -30px rgba(20,15,10,.45);

  --maxw: 1180px;
  --serif: "Fraunces", Georgia, serif;
  --sans:  "Hanken Grotesk", system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.04; letter-spacing: -.02em; margin: 0; }
.serif { font-family: var(--serif); }

/* --------------------------------------------------------------- */
/*  Buttons                                                         */
/* --------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-weight: 700; font-size: 16px;
  padding: 14px 24px; border-radius: 999px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper); cursor: pointer;
  transition: transform .14s ease, box-shadow .2s ease, background .2s ease, color .2s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -14px rgba(20,15,10,.5); }
.btn:active { transform: translateY(0); }

.btn.clay { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.clay:hover { box-shadow: 0 16px 30px -12px rgba(31,157,107,.55); }

.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: var(--paper-2); }

.btn.sm { padding: 9px 16px; font-size: 14px; }
.btn.full { width: 100%; }

/* --------------------------------------------------------------- */
/*  Header / Footer                                                 */
/* --------------------------------------------------------------- */
header.site {
  position: sticky; top: 0; z-index: 50;
  background: rgba(251,248,243,.82);
  backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 11px; font-family: var(--serif); }
.brand .mark {
  width: 40px; height: 40px; display: block; flex: none;
  transform: rotate(-4deg); filter: drop-shadow(0 6px 12px rgba(27,46,34,.20));
}
.brand .name { font-size: 22px; font-weight: 500; letter-spacing: -.02em; }
.brand .name b { font-weight: 600; color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-weight: 600; font-size: 15px; color: var(--ink-soft); transition: color .15s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.btn { color: #fff; }

footer.site { background: var(--ink); color: var(--paper); margin-top: 90px; padding: 56px 0 40px; }
footer .ftop { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.12); }
footer .brand .name { color: var(--paper); }
footer .brand .name b { color: var(--paper); }
footer .tagline { font-family: var(--serif); font-style: italic; font-size: 19px; color: #d9cfc0; margin: 0; }
footer .fbot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 22px; font-size: 14px; color: #b3a895; }

/* --------------------------------------------------------------- */
/*  Flash messages                                                 */
/* --------------------------------------------------------------- */
.flashes { position: fixed; top: 84px; right: 22px; z-index: 100; display: flex; flex-direction: column; gap: 10px; max-width: 360px; }
.flash {
  padding: 14px 18px; border-radius: 13px; font-weight: 600; font-size: 14.5px;
  background: var(--ink); color: var(--paper); box-shadow: var(--shadow-lg);
  border-left: 5px solid var(--gold); animation: slidein .35s cubic-bezier(.2,.9,.3,1);
}
.flash.success { border-left-color: var(--forest); }
.flash.error { border-left-color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(30px); } }

/* --------------------------------------------------------------- */
/*  Hero                                                           */
/* --------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; background: var(--ink); color: var(--paper); }
.hero::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(900px 500px at 88% -10%, rgba(31,157,107,.30), transparent 60%),
    radial-gradient(600px 500px at 0% 120%, rgba(228,178,74,.18), transparent 55%);
  pointer-events: none;
}
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.15fr .85fr; gap: 50px; align-items: center; padding: 86px 0 96px; }

.eyebrow {
  display: inline-block; font-weight: 700; font-size: 13px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-ink); background: rgba(31,157,107,.14); padding: 7px 14px; border-radius: 999px;
}
.hero h1 { font-size: clamp(46px, 7vw, 86px); margin: 22px 0 0; color: var(--paper); }
.hero h1 em { font-style: italic; color: var(--accent); }
.hero .lede { font-size: clamp(17px, 2vw, 20px); color: #d6ccbd; max-width: 30em; margin: 24px 0 32px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-cta .btn.ghost { color: var(--paper); border-color: rgba(255,255,255,.28); }
.hero-cta .btn.ghost:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.6); }

.stats { display: flex; gap: 40px; margin-top: 48px; flex-wrap: wrap; }
.stat .num { font-family: var(--serif); font-size: 44px; font-weight: 600; line-height: 1; color: var(--paper); }
.stat .num span { color: var(--accent); }
.stat .lbl { font-size: 13.5px; color: #b3a895; margin-top: 6px; max-width: 14em; }

/* Floating book-cover stack in hero */
.hero-art { position: relative; height: 380px; }
.hero-art .bk {
  position: absolute; width: 168px; aspect-ratio: 2/3; border-radius: 8px; overflow: hidden;
  box-shadow: var(--shadow-lg); background: var(--paper-2);
  animation: float 7s ease-in-out infinite;
}
.hero-art .bk img { width: 100%; height: 100%; object-fit: cover; }
.hero-art .bk:nth-child(1) { left: 6%;  top: 30px;  transform: rotate(-9deg); z-index: 2; }
.hero-art .bk:nth-child(2) { left: 34%; top: 0;     transform: rotate(3deg);  z-index: 3; animation-delay: -2.2s; }
.hero-art .bk:nth-child(3) { left: 60%; top: 64px;  transform: rotate(11deg); z-index: 1; animation-delay: -4.4s; }
.hero-art .bk:nth-child(4) { left: 24%; top: 168px; transform: rotate(-4deg); z-index: 2; animation-delay: -1.1s; }
.hero-art .bk:nth-child(5) { left: 52%; top: 196px; transform: rotate(7deg);  z-index: 3; animation-delay: -3.3s; }
@keyframes float { 0%,100% { translate: 0 0; } 50% { translate: 0 -12px; } }

/* --------------------------------------------------------------- */
/*  Sections                                                       */
/* --------------------------------------------------------------- */
.section { padding: 76px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 26px; flex-wrap: wrap; margin-bottom: 30px; }
.section-head h2 { font-size: clamp(30px, 4vw, 46px); }
.section-head p { color: var(--ink-faint); margin: 8px 0 0; font-size: 16px; }

/* Search bar */
.searchbar { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1.5px solid var(--line); border-radius: 999px; padding: 7px 7px 7px 18px; box-shadow: var(--shadow); }
.searchbar svg { color: var(--ink-faint); flex: none; }
.searchbar input { border: none; outline: none; background: transparent; font-family: var(--sans); font-size: 15.5px; min-width: 220px; color: var(--ink); }
.searchbar input::placeholder { color: var(--ink-faint); }

/* Category chips */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-bottom: 36px; }
.chip {
  font-weight: 600; font-size: 14px; padding: 9px 16px; border-radius: 999px;
  border: 1.5px solid var(--line); color: var(--ink-soft); background: var(--card); transition: all .15s;
}
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Book grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(214px, 1fr)); gap: 26px; }
.book-card {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .25s ease, border-color .2s;
  animation: cardin .55s both cubic-bezier(.2,.8,.3,1);
}
@keyframes cardin { from { opacity: 0; transform: translateY(18px); } }
.book-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: var(--paper-2); }

.cover { position: relative; aspect-ratio: 3/4; overflow: hidden; background: var(--paper-2); }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.book-card:hover .cover img { transform: scale(1.05); }

.cover.gen { display: flex; flex-direction: column; justify-content: flex-end; padding: 18px; color: #fff; }
.cover.gen::before { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.16), transparent 40%, rgba(0,0,0,.35)); }
.cover.gen .ca { position: relative; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.cover.gen .ct { position: relative; font-family: var(--serif); font-size: 21px; line-height: 1.1; margin-top: 8px; }
.cover.gen .cf { position: relative; font-size: 13px; opacity: .85; margin-top: 6px; }

.tag {
  position: absolute; top: 12px; left: 12px; z-index: 2; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; padding: 5px 11px; border-radius: 999px; color: #fff;
}
.tag.reserved { background: var(--gold); color: #2a1d00; }
.tag.given { background: var(--forest); }

.book-meta { padding: 15px 16px 17px; }
.book-meta .t { font-family: var(--serif); font-size: 17.5px; font-weight: 600; line-height: 1.2; }
.book-meta .a { color: var(--ink-faint); font-size: 14px; margin-top: 3px; }
.book-meta .loc { color: var(--accent-ink); font-size: 12.5px; font-weight: 600; margin-top: 9px; }

/* Empty state */
.empty { text-align: center; padding: 70px 20px; background: var(--card); border: 1.5px dashed var(--line); border-radius: var(--radius); }
.empty .big { font-family: var(--serif); font-size: 26px; }
.empty p { color: var(--ink-faint); margin: 8px auto 0; max-width: 30em; }

/* --------------------------------------------------------------- */
/*  "How it works"                                                 */
/* --------------------------------------------------------------- */
.how { background: var(--ink); color: var(--paper); padding: 84px 0; }
.how h2 { font-size: clamp(30px, 4vw, 48px); color: var(--paper); }
.how .lede { color: #c9bfb0; max-width: 36em; margin: 14px 0 44px; font-size: 18px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.step { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 30px 26px; transition: transform .2s, background .2s; }
.step:hover { transform: translateY(-5px); background: rgba(255,255,255,.08); }
.step .n { font-family: var(--serif); font-size: 40px; color: var(--accent); line-height: 1; }
.step h3 { font-size: 22px; margin: 16px 0 8px; color: var(--paper); }
.step p { color: #c2b8a9; font-size: 15px; margin: 0; }

/* --------------------------------------------------------------- */
/*  Forms (give / auth)                                            */
/* --------------------------------------------------------------- */
.formpage { padding: 64px 0; }
.formcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 44px; max-width: 480px; margin-inline: auto; }
.formcard.wide { max-width: 680px; }
.formcard h1 { font-size: clamp(28px, 4vw, 40px); }
.formcard .sub { color: var(--ink-faint); margin: 10px 0 28px; font-size: 16px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 7px; color: var(--ink-soft); }
.field input, .field select, .field textarea {
  width: 100%; padding: 13px 15px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--sans); font-size: 15.5px; color: var(--ink); background: var(--paper); transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(31,157,107,.16); background: #fff;
}
.field textarea { min-height: 110px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.alt { text-align: center; margin-top: 20px; color: var(--ink-faint); font-size: 14.5px; }
.alt a { color: var(--accent-ink); font-weight: 700; }

/* One-time code input */
.code-input {
  width: 100%; text-align: center; font-family: var(--serif); font-size: 38px; font-weight: 600;
  letter-spacing: 14px; padding: 18px 10px; text-indent: 14px;
}
.code-hint { margin-top: 14px; padding: 13px 16px; border-radius: 13px; background: var(--paper-2); border: 1px dashed var(--gold); font-size: 14px; color: var(--ink-soft); }
.code-hint b { font-size: 22px; letter-spacing: 4px; color: var(--ink); }
.sent-to { background: var(--paper-2); border-radius: 13px; padding: 12px 16px; font-size: 14.5px; color: var(--ink-soft); margin-bottom: 24px; }
.sent-to b { color: var(--ink); }

/* --------------------------------------------------------------- */
/*  Book detail                                                    */
/* --------------------------------------------------------------- */
.detail { padding: 48px 0 20px; }
.back-link { color: var(--ink-faint); font-weight: 600; font-size: 14.5px; }
.back-link:hover { color: var(--ink); }
.detail-grid { display: grid; grid-template-columns: 360px 1fr; gap: 48px; align-items: start; }
.detail-grid .cover { border-radius: var(--radius); box-shadow: var(--shadow-lg); aspect-ratio: 3/4; }
.detail h1 { font-size: clamp(30px, 4.5vw, 50px); margin: 14px 0 0; }
.detail .by { font-family: var(--serif); font-style: italic; font-size: 21px; color: var(--ink-faint); margin-top: 8px; }
.facts { display: flex; flex-wrap: wrap; gap: 9px; margin: 24px 0; }
.fact { font-size: 13.5px; font-weight: 600; color: var(--ink-soft); background: var(--paper-2); border-radius: 999px; padding: 7px 14px; }
.desc { font-size: 17px; line-height: 1.7; color: var(--ink-soft); max-width: 40em; }

.giver { display: flex; align-items: center; gap: 13px; margin: 26px 0; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); width: fit-content; }
.giver .av { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 19px; font-family: var(--serif); }
.giver .gx small { display: block; color: var(--ink-faint); font-size: 12.5px; }
.giver .gx b { font-size: 16px; }

.request-box { background: var(--ink); color: var(--paper); border-radius: var(--radius); padding: 26px; margin-top: 22px; max-width: 460px; }
.request-box h3 { color: var(--paper); font-size: 22px; }
.request-box p { color: #c4bbac; font-size: 15px; margin: 8px 0 16px; }
.request-box textarea { width: 100%; padding: 13px; border-radius: var(--radius-sm); border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: var(--paper); font-family: var(--sans); font-size: 15px; min-height: 90px; margin-bottom: 14px; resize: vertical; }
.request-box textarea::placeholder { color: #9a8f80; }
.request-box textarea:focus { outline: none; border-color: var(--accent); }

/* --------------------------------------------------------------- */
/*  Shelf (dashboard)                                              */
/* --------------------------------------------------------------- */
.shelf { padding: 52px 0; }
.shelf h1 { font-size: clamp(32px, 4.5vw, 50px); }

.tabs { display: inline-flex; gap: 4px; background: var(--paper-2); border-radius: 999px; padding: 5px; margin: 26px 0 30px; }
.tab { padding: 10px 22px; border-radius: 999px; font-weight: 700; font-size: 14.5px; color: var(--ink-faint); cursor: pointer; transition: all .15s; user-select: none; }
.tab:hover { color: var(--ink); }
.tab.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

.tabpane { display: none; animation: fadein .35s; }
.tabpane.active { display: block; }
@keyframes fadein { from { opacity: 0; transform: translateY(8px); } }

.row-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; display: flex; gap: 18px; align-items: center; }
.mini { width: 58px; height: 78px; flex: none; border-radius: 8px; overflow: hidden; background: var(--ink); color: var(--paper); font-size: 10px; padding: 6px; display: flex; align-items: flex-end; box-shadow: var(--shadow); }
.mini img { width: 100%; height: 100%; object-fit: cover; }
.info { flex: 1; min-width: 0; }
.info .t { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.info .meta { color: var(--ink-faint); font-size: 14px; margin-top: 3px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline { display: inline; margin: 0; }

.pill { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 6px 12px; border-radius: 999px; background: var(--paper-2); color: var(--ink-soft); }
.pill.available { background: rgba(31,157,107,.16); color: var(--forest); }
.pill.approved { background: rgba(31,157,107,.16); color: var(--forest); }
.pill.reserved { background: rgba(228,178,74,.20); color: #8a6310; }
.pill.given { background: var(--forest); color: #fff; }
.pill.pending { background: rgba(228,178,74,.20); color: #8a6310; }
.pill.declined { background: var(--paper-2); color: var(--ink-faint); }

.req-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 13px 15px; border: 1px dashed var(--line); border-radius: var(--radius-sm); background: var(--paper); }
.req-line .msg { color: var(--ink-faint); font-style: italic; font-size: 14px; }

/* --------------------------------------------------------------- */
/*  Responsive                                                     */
/* --------------------------------------------------------------- */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 30px; padding: 60px 0 70px; }
  .hero-art { display: none; }
  .detail-grid { grid-template-columns: 1fr; gap: 28px; }
  .detail-grid .cover { max-width: 300px; }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  .nav-links { gap: 14px; }
  .nav-links a:not(.btn) { display: none; }
  .nav-links a.btn { display: inline-flex; }
  .row2 { grid-template-columns: 1fr; }
  .stats { gap: 26px; }
  .formcard { padding: 30px 22px; }
  .row-card { flex-wrap: wrap; }
  .flashes { left: 14px; right: 14px; max-width: none; }
}
