/* ==========================================================================
   Sumila Books — Design Tokens
   Palette: warm ledger paper, deep forest ink, ochre stamp gold, rust accent
   Type: Fraunces (display) / Inter (body) / IBM Plex Mono (figures & data)
   Signature: "ledger rule" double-line dividers + circular stamp badges,
   echoing bookkeeping ledgers and library due-date stamps.
   ========================================================================== */

:root {
    --paper: #F6F1E4;
    --paper-deep: #EDE4CE;
    --ink: #221F19;
    --forest: #1E3B31;
    --forest-dark: #142822;
    --teal: #3E6259;
    --gold: #C4922E;
    --gold-light: #E8C77A;
    --rust: #9B4227;
    --line: rgba(34, 31, 25, 0.14);
    --white: #FFFDF8;

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

    --radius: 6px;
    --shadow-soft: 0 10px 30px rgba(20, 40, 34, 0.10);
    --shadow-strong: 0 16px 40px rgba(20, 40, 34, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

.wrap {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--forest-dark);
    line-height: 1.15;
    margin: 0 0 .5em;
}
h1 { font-size: clamp(2.1rem, 4vw, 3.4rem); font-weight: 600; }
h2 { font-size: clamp(1.6rem, 3vw, 2.3rem); font-weight: 600; }
h3 { font-size: 1.3rem; font-weight: 600; }
p { margin: 0 0 1em; }

.eyebrow {
    font-family: var(--font-mono);
    font-size: .74rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--rust);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.eyebrow::before {
    content: '';
    width: 22px;
    height: 1px;
    background: var(--rust);
}

/* Ledger-rule divider: signature structural device */
.ledger-rule {
    border: none;
    border-top: 2px solid var(--forest-dark);
    border-bottom: 1px solid var(--forest-dark);
    height: 3px;
    width: 64px;
    margin: 14px 0 28px;
}
.section-head { margin-bottom: 36px; }
.section-head--center { text-align: center; }
.section-head--center .ledger-rule { margin-left: auto; margin-right: auto; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 26px;
    border-radius: 3px;
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
}
.btn--primary { background: var(--forest); color: var(--white); }
.btn--primary:hover { background: var(--forest-dark); box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.btn--gold { background: var(--gold); color: var(--forest-dark); }
.btn--gold:hover { background: var(--gold-light); transform: translateY(-1px); }
.btn--outline { border-color: var(--forest); color: var(--forest); background: transparent; }
.btn--outline:hover { background: var(--forest); color: var(--white); }
.btn--outline-nav { border: 1px solid var(--forest); padding: 9px 18px; border-radius: 3px; }
.btn--sm { padding: 8px 16px; font-size: .85rem; }
.btn--block { width: 100%; }
.btn--download { background: var(--rust); color: var(--white); }
.btn--download:hover { background: #7f351f; }

/* ---------- Topbar & Header ---------- */
.topbar { background: var(--forest-dark); color: rgba(255,255,255,.85); font-size: .82rem; }
.topbar__inner { display: flex; justify-content: space-between; padding: 8px 24px; flex-wrap: wrap; gap: 6px; }
.topbar__contact a { margin-left: 16px; color: var(--gold-light); }
.topbar__contact a:hover { text-decoration: underline; }

.site-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 40; }
.site-header__inner { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { height: 44px; width: auto; }
.brand__mark {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--forest); color: var(--gold-light);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; font-size: 1.1rem;
    border: 2px solid var(--gold);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-family: var(--font-display); font-size: 1.2rem; color: var(--forest-dark); }
.brand__text em { font-style: normal; font-size: .72rem; color: var(--teal); font-family: var(--font-mono); letter-spacing: .04em; }

.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a { padding: 10px 14px; font-weight: 500; font-size: .93rem; color: var(--ink); border-radius: 3px; }
.main-nav a:hover, .main-nav a.active { color: var(--forest); background: rgba(30,59,49,.08); }
.main-nav a.btn--outline-nav:hover { background: var(--forest); color: var(--white); }

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span { width: 24px; height: 2px; background: var(--ink); }

/* ---------- Hero ---------- */
.hero {
    background: linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
    border-bottom: 1px solid var(--line);
    position: relative;
    overflow: hidden;
}
.hero__inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; padding: 72px 24px; }
.hero__stats { display: flex; gap: 28px; margin-top: 34px; flex-wrap: wrap; }
.hero__stat strong { display: block; font-family: var(--font-mono); font-size: 1.6rem; color: var(--forest-dark); }
.hero__stat span { font-size: .82rem; color: var(--teal); }
.hero__actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.hero__art {
    background: var(--forest);
    border-radius: 10px;
    padding: 34px;
    box-shadow: var(--shadow-strong);
    position: relative;
}
.hero__ledger { background: var(--paper); border-radius: 6px; padding: 26px; }
.hero__ledger-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px dashed var(--line); font-family: var(--font-mono); font-size: .85rem; }
.hero__ledger-row:last-child { border-bottom: none; }
.hero__stamp {
    position: absolute; top: -18px; right: -14px;
    width: 86px; height: 86px; border-radius: 50%;
    background: var(--gold); color: var(--forest-dark);
    display: flex; align-items: center; justify-content: center;
    text-align: center; font-family: var(--font-mono); font-size: .68rem;
    font-weight: 700; letter-spacing: .06em; line-height: 1.3;
    border: 3px dashed var(--forest-dark);
    transform: rotate(8deg);
    box-shadow: var(--shadow-soft);
}

/* ---------- Cards: services / categories / books ---------- */
.grid { display: grid; gap: 26px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-soft); }
.card__media { aspect-ratio: 4/3; background: var(--paper-deep) center/cover no-repeat; position: relative; }
.card__body { padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__body h3 { margin: 0; }
.card__body h3 a:hover { color: var(--forest); }
.card__meta { font-family: var(--font-mono); font-size: .74rem; color: var(--teal); text-transform: uppercase; letter-spacing: .05em; }
.card__desc { color: #514c40; font-size: .93rem; flex: 1; }
.card__footer { margin-top: auto; padding-top: 8px; }

.service-icon {
    width: 54px; height: 54px; border-radius: 50%;
    background: var(--forest); color: var(--gold-light);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; font-size: 1.3rem;
    border: 2px solid var(--gold);
}

/* Book cover cards */
.book-card__media { aspect-ratio: 3/4; }
.book-card__badge {
    position: absolute; top: 10px; left: 10px;
    background: var(--forest-dark); color: var(--gold-light);
    font-family: var(--font-mono); font-size: .68rem; letter-spacing: .04em;
    padding: 4px 10px; border-radius: 3px;
}

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section--muted { background: var(--paper-deep); }
.section--dark { background: var(--forest-dark); color: rgba(255,255,255,.92); }
.section--dark h2, .section--dark h3 { color: var(--white); }
.section--dark .ledger-rule { border-color: var(--gold); }

/* ---------- Breadcrumb ---------- */
.breadcrumb { font-family: var(--font-mono); font-size: .78rem; color: var(--teal); padding: 18px 0; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 6px; }

/* ---------- Book single ---------- */
.book-detail { display: grid; grid-template-columns: .8fr 1.2fr; gap: 48px; align-items: start; }
.book-detail__cover { border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-strong); border: 1px solid var(--line); }
.book-detail__meta { display: flex; gap: 18px; flex-wrap: wrap; margin: 18px 0; font-family: var(--font-mono); font-size: .82rem; color: var(--teal); }
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { background: var(--paper-deep); border: 1px solid var(--line); padding: 5px 12px; border-radius: 20px; font-size: .78rem; font-family: var(--font-mono); }

/* ---------- Forms ---------- */
.form-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow-soft); }
.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.field input, .field textarea, .field select {
    width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 4px;
    font-family: var(--font-body); font-size: .95rem; background: var(--paper);
}
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--forest); outline-offset: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.alert { padding: 14px 18px; border-radius: 4px; margin-bottom: 22px; font-size: .92rem; }
.alert--success { background: #E4F0E8; color: var(--forest-dark); border: 1px solid #B9D8C3; }
.alert--error { background: #F7E4DE; color: var(--rust); border: 1px solid #EBC0B2; }

/* ---------- Contact page layout ---------- */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 44px; }
.contact-info-card { background: var(--forest); color: var(--white); border-radius: var(--radius); padding: 34px; }
.contact-info-card a { color: var(--gold-light); }
.contact-info-row { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px dashed rgba(255,255,255,.2); }
.contact-info-row:last-child { border-bottom: none; }

/* ---------- Footer ---------- */
.site-footer { background: var(--forest-dark); color: rgba(255,255,255,.78); padding: 60px 0 0; margin-top: 40px; }
.footer__grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding-bottom: 40px; border-bottom: 1px solid rgba(255,255,255,.12); }
.footer__grid h4 { color: var(--white); font-size: 1rem; margin-bottom: 14px; }
.footer__grid a, .footer__grid p { display: block; color: rgba(255,255,255,.72); font-size: .9rem; margin-bottom: 8px; }
.footer__grid a:hover { color: var(--gold-light); }
.footer__social a { display: inline-block; margin-right: 12px; }
.footer__bottom { display: flex; justify-content: space-between; padding: 20px 24px; font-size: .78rem; font-family: var(--font-mono); flex-wrap: wrap; gap: 8px; }

/* ---------- WhatsApp floating widget (left side) ---------- */
.whatsapp-widget { position: fixed; left: 22px; bottom: 24px; z-index: 60; display: flex; align-items: center; }
.whatsapp-widget__toggle {
    width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer;
    background: #25D366; color: var(--white); display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-strong);
}
.whatsapp-widget__panel {
    position: absolute; left: 68px; bottom: 4px;
    background: var(--white); border: 1px solid var(--line); border-radius: 8px;
    padding: 14px 18px; box-shadow: var(--shadow-strong); white-space: nowrap;
    opacity: 0; transform: translateX(-8px); pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
}
.whatsapp-widget__panel strong { display: block; color: var(--forest-dark); font-size: .9rem; }
.whatsapp-widget__panel span { font-size: .76rem; color: var(--teal); }
.whatsapp-widget.is-open .whatsapp-widget__panel { opacity: 1; transform: translateX(0); pointer-events: auto; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--teal); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero__inner { grid-template-columns: 1fr; padding: 48px 24px; }
    .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
    .book-detail { grid-template-columns: 1fr; }
    .contact-grid { grid-template-columns: 1fr; }
    .footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
    .main-nav { position: fixed; top: 78px; left: 0; right: 0; background: var(--paper); flex-direction: column; align-items: stretch; padding: 12px 24px; border-bottom: 1px solid var(--line); transform: translateY(-130%); transition: transform .25s ease; }
    .main-nav.is-open { transform: translateY(0); }
    .nav-toggle { display: flex; }
    .grid--3, .grid--4 { grid-template-columns: 1fr; }
    .field-row { grid-template-columns: 1fr; }
    .footer__grid { grid-template-columns: 1fr; }
    .whatsapp-widget { left: 14px; bottom: 16px; }
}