/* ==============================================================
   Chronition Publication — Design System
   Fresh premium academic-publisher identity. Hand-written, no
   build step required — deploy as-is.
   ============================================================== */

:root {
    --ink:        #10203E;
    --ink-soft:   #1B3363;
    --gold:       #B8863A;
    --gold-soft:  #E7C989;
    --paper:      #FAF6EE;
    --paper-alt:  #F1EADA;
    --white:      #FFFFFF;
    --text:       #1F2430;
    --text-muted: #5B6472;
    --border:     #E4DCC8;
    --success:    #2E7D4F;
    --success-bg: #E7F5EC;
    --danger:     #B3351F;
    --danger-bg:  #FBEAE6;
    --info-bg:    #EAF1FB;
    --shadow-sm:  0 1px 3px rgba(16, 32, 62, 0.08);
    --shadow-md:  0 8px 24px rgba(16, 32, 62, 0.10);
    --shadow-lg:  0 20px 45px rgba(16, 32, 62, 0.16);
    --radius:     10px;
    --radius-lg:  16px;
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    color: var(--text);
    background: var(--paper);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, .font-serif { font-family: var(--font-serif); color: var(--ink); font-weight: 600; line-height: 1.25; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1rem; }
a { color: var(--ink-soft); text-decoration: none; }
a:hover { color: var(--gold); }
img { max-width: 100%; display: block; }
ul, ol { padding-left: 1.2rem; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 24px; border-radius: 999px; font-weight: 600; font-size: 0.95rem;
    border: 1.5px solid transparent; cursor: pointer; transition: all .15s ease;
    text-align: center;
}
.btn-primary { background: var(--ink); color: var(--white); }
.btn-primary:hover { background: var(--ink-soft); color: var(--white); }
.btn-gold { background: var(--gold); color: var(--white); }
.btn-gold:hover { background: #a5762f; color: var(--white); }
.btn-outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-outline:hover { background: var(--ink); color: var(--white); }
.btn-ghost { background: transparent; color: var(--ink); padding: 10px 16px; }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-sm { padding: 7px 16px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- Header / Nav ---------------- */
.site-header { background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 10px; background: var(--ink);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--font-serif); color: var(--ink); font-size: 1.15rem; }
.brand-text span { font-size: 0.7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--gold); font-weight: 600; }

.brand { flex-shrink: 0; }
.main-nav { display: flex; align-items: center; gap: 20px; flex-shrink: 1; min-width: 0; }
.main-nav a { color: var(--text); font-weight: 500; font-size: 0.93rem; white-space: nowrap; }
.main-nav a.active { color: var(--gold); }
.nav-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; }
.icon-link { position: relative; display: inline-flex; }
.cart-badge {
    position: absolute; top: -8px; right: -10px; background: var(--gold); color: #fff;
    font-size: 0.68rem; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px;
    display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.nav-toggle { display: none; background: none; border: none; cursor: pointer; flex-shrink: 0; }

/* Switch to the mobile drawer well before the row runs out of room — a
   signed-in editor/admin has two extra buttons ("My Account" + "Admin")
   competing with the five nav links for the same space, so this needs a
   wider threshold than a simple content-fit would suggest. */
@media (max-width: 1140px) {
    .main-nav { position: fixed; inset: 72px 0 0 0; background: var(--white); flex-direction: column;
        align-items: flex-start; padding: 24px; gap: 18px; transform: translateY(-110%); transition: transform .2s ease; overflow-y: auto; z-index: 49; }
    .main-nav.open { transform: translateY(0); }
    .main-nav a { white-space: normal; }
    .nav-toggle { display: block; }
}
@media (max-width: 480px) {
    .brand-text span { display: none; }
    .site-header .container { gap: 8px; padding-left: 16px; padding-right: 16px; flex-wrap: wrap; row-gap: 10px; }
    .brand { gap: 8px; }
    .brand-mark { width: 34px; height: 34px; }
    .brand-mark svg { width: 18px; height: 18px; }
    .brand-text strong { font-size: 0.92rem; }
    .nav-actions { gap: 6px; }
    .nav-actions .btn { padding: 7px 12px; font-size: 0.8rem; }
    /* Signed in as staff: "My Account" + "Admin" together no longer fit
       next to the brand + hamburger — drop them to their own line rather
       than let them overflow. */
    .nav-actions-wide { flex-basis: 100%; justify-content: flex-end; }
}

/* ---------------- Hero ---------------- */
.hero { background: linear-gradient(135deg, var(--ink) 0%, var(--ink-soft) 100%); color: #fff; padding: 76px 0; position: relative; overflow: hidden; }
.hero::after {
    content: ''; position: absolute; right: -80px; top: -80px; width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(184,134,58,.35) 0%, transparent 70%);
}
.hero .container { position: relative; z-index: 1; }
.hero-eyebrow { color: var(--gold-soft); text-transform: uppercase; letter-spacing: .1em; font-size: 0.8rem; font-weight: 700; margin-bottom: 14px; display: inline-block; }
.hero h1 { color: #fff; max-width: 720px; }
.hero p.lead { color: rgba(255,255,255,.82); max-width: 560px; font-size: 1.1rem; margin-top: 14px; }
.hero-actions { margin-top: 28px; display: flex; gap: 14px; flex-wrap: wrap; }

/* ---------------- Sections ---------------- */
.section { padding: 64px 0; }
.section-alt { background: var(--paper-alt); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; gap: 16px; flex-wrap: wrap; }
.section-head p { color: var(--text-muted); margin: 6px 0 0; max-width: 560px; }

/* ---------------- Subject / feature cards ---------------- */
.grid { display: grid; gap: 24px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.subject-card {
    background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 28px 24px; transition: transform .15s ease, box-shadow .15s ease;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.subject-card .icon { width: 46px; height: 46px; border-radius: 12px; background: var(--paper-alt); display: flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.subject-card h3 { margin-bottom: 6px; }
.subject-card .count { color: var(--gold); font-weight: 700; font-size: 0.85rem; }

/* ---------------- Book cards ---------------- */
.book-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; transition: box-shadow .15s ease, transform .15s ease; }
.book-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.book-cover { aspect-ratio: 3/4; background: var(--ink); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.book-cover img { width: 100%; height: 100%; object-fit: cover; }
.book-cover .placeholder { font-family: var(--font-serif); color: var(--ink); text-align: center; padding: 20px; font-size: 0.95rem; }

/* Generated jacket cover — shown for books with no uploaded cover image,
   so the catalog never shows a blank box. Colored per subject so titles
   in the same discipline read as a matching series, the way a real
   academic imprint's covers do. */
.cover-generated {
    --cv-1: #23407A; --cv-2: #0D1B33; --cv-accent: #E7C989;
    width: 100%; height: 100%; position: relative; overflow: hidden; box-sizing: border-box;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 40px 18px 44px; text-align: center;
    background: linear-gradient(155deg, var(--cv-1) 0%, var(--cv-2) 100%);
}
.cover-generated::before {
    content: ''; position: absolute; inset: 10px; border: 1px solid rgba(255,255,255,.22); pointer-events: none;
}
.cover-generated::after {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
    background: linear-gradient(rgba(0,0,0,.28), rgba(0,0,0,0) 40%, rgba(0,0,0,0) 60%, rgba(0,0,0,.28));
}
.cover-generated .cv-body { position: relative; }
.cover-generated .cv-rule { width: 34px; height: 2px; background: var(--cv-accent); margin: 0 auto 12px; opacity: .85; }
.cover-generated .cv-title { display: block; font-family: var(--font-serif); color: #fff; font-size: 1.08rem; font-weight: 600; line-height: 1.32; }
.cover-generated .cv-author { display: block; font-family: var(--font-sans); font-size: 0.66rem; letter-spacing: .06em; text-transform: uppercase; color: rgba(255,255,255,.75); margin-top: 10px; }
.cover-generated .cv-subject {
    position: absolute; left: 12px; right: 12px; bottom: 16px;
    font-family: var(--font-sans); font-size: 0.6rem; letter-spacing: .16em; text-transform: uppercase;
    color: var(--cv-accent); font-weight: 700;
}

.book-cover[data-subject="political-science"] .cover-generated { --cv-1: #2A4884; --cv-2: #0D1B33; --cv-accent: #E7C989; }
.book-cover[data-subject="history"] .cover-generated { --cv-1: #6E4030; --cv-2: #2A1712; --cv-accent: #E9CB9C; }
.book-cover[data-subject="geography"] .cover-generated { --cv-1: #1F5E53; --cv-2: #0E2E28; --cv-accent: #CFE7B8; }
.book-cover[data-subject="economics"] .cover-generated { --cv-1: #6B4E22; --cv-2: #2E220E; --cv-accent: #F0D9A3; }
.book-badge { position: absolute; top: 10px; left: 10px; background: var(--gold); color: #fff; font-size: 0.68rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.book-body { padding: 18px; display: flex; flex-direction: column; gap: 6px; flex-grow: 1; }
.book-subject { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--gold); font-weight: 700; }
.book-title { font-family: var(--font-serif); font-size: 1.05rem; color: var(--ink); font-weight: 600; }
.book-author { color: var(--text-muted); font-size: 0.88rem; }
.book-price-row { margin-top: auto; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; }
.price { font-weight: 700; color: var(--ink); font-size: 1.05rem; }
.price-strike { color: var(--text-muted); text-decoration: line-through; font-size: 0.85rem; margin-left: 6px; }
.stars { color: var(--gold); font-size: 0.85rem; }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; color: var(--ink); }
.hint { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px;
    font-family: var(--font-sans); font-size: 0.95rem; background: var(--white); color: var(--text);
}
textarea { resize: vertical; min-height: 120px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,134,58,.15); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .form-row { grid-template-columns: 1fr; } }
.field-error { color: var(--danger); font-size: 0.82rem; margin-top: 4px; display: block; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.card-form { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-sm); }

/* ---------------- Alerts ---------------- */
.alert { padding: 14px 18px; border-radius: 10px; margin-bottom: 20px; font-size: 0.92rem; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bfe3cc; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #f0c4ba; }
.alert-info { background: var(--info-bg); color: var(--ink-soft); border: 1px solid #cfe0f7; }

/* ---------------- Badges / status pills ---------------- */
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; text-transform: capitalize; }
.badge-submitted, .badge-pending { background: #EAF1FB; color: #22548F; }
.badge-under_review, .badge-processing { background: #FBF3D9; color: #8A6A0E; }
.badge-revision_requested { background: #FDE8D6; color: #A35019; }
.badge-accepted, .badge-published, .badge-delivered, .badge-paid { background: var(--success-bg); color: var(--success); }
.badge-rejected, .badge-cancelled, .badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-shipped { background: #E6ECFB; color: #33459C; }
.badge-draft, .badge-refunded { background: #EFEFEF; color: #555; }
.badge-out_of_stock, .badge-out_of_print { background: var(--danger-bg); color: var(--danger); }

/* ---------------- Footer ---------------- */
.site-footer { background: var(--ink); color: rgba(255,255,255,.78); padding: 56px 0 24px; margin-top: 60px; }
.site-footer .brand-text strong, .site-footer .brand-text span { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 40px; }
@media (max-width: 780px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
.site-footer h4 { color: #fff; font-family: var(--font-sans); font-size: 0.85rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 14px; }
.site-footer a { color: rgba(255,255,255,.78); display: block; margin-bottom: 8px; font-size: 0.92rem; }
.site-footer a:hover { color: var(--gold-soft); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding-top: 20px; font-size: 0.82rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; color: rgba(255,255,255,.6); }

/* ---------------- Responsive two-column layouts ----------------
   Replaces one-off inline grid-template-columns styles (which never
   collapsed on mobile) with reusable, responsive classes. */
.layout-narrow-right { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: flex-start; }
.layout-wide-left { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: flex-start; }
.layout-detail { display: grid; grid-template-columns: 340px 1fr; gap: 44px; align-items: flex-start; }
.layout-filter-sidebar { display: grid; grid-template-columns: 230px 1fr; gap: 32px; align-items: flex-start; }
.layout-checkout { display: grid; grid-template-columns: 1.4fr 1fr; gap: 40px; align-items: flex-start; }
.layout-split { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; align-items: flex-start; }
@media (max-width: 900px) {
    .layout-narrow-right, .layout-wide-left, .layout-detail,
    .layout-filter-sidebar, .layout-checkout, .layout-split {
        grid-template-columns: 1fr;
    }
}

/* ---------------- Account area ---------------- */
.account-nav { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--border); margin: 20px 0 28px; }
.account-nav a {
    padding: 10px 16px; font-weight: 600; font-size: 0.9rem; color: var(--text-muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.account-nav a:hover { color: var(--ink); }
.account-nav a.active { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------------- Misc utilities ---------------- */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; }
.divider { height: 1px; background: var(--border); margin: 24px 0; border: none; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--white); }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
th { background: var(--paper-alt); font-weight: 700; color: var(--ink); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .03em; }
.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 32px; }
.pagination a, .pagination span { padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); font-size: 0.9rem; }
.pagination .active { background: var(--ink); color: #fff; border-color: var(--ink); }
.breadcrumb { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumb a { color: var(--text-muted); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }

/* ---------------- Admin layout ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar { width: 246px; background: var(--ink); color: rgba(255,255,255,.85); flex-shrink: 0; padding: 24px 0; }
.admin-sidebar .brand-text strong, .admin-sidebar .brand-text span { color: #fff; }
.admin-sidebar .brand { padding: 0 22px 24px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 12px; }
.admin-nav a { display: flex; align-items: center; gap: 10px; padding: 11px 22px; color: rgba(255,255,255,.75); font-size: 0.92rem; font-weight: 500; }
.admin-nav a:hover, .admin-nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav .nav-group-label { padding: 18px 22px 6px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.4); }
.admin-main { flex-grow: 1; background: var(--paper); min-width: 0; }
.admin-topbar { background: var(--white); border-bottom: 1px solid var(--border); padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; }
.admin-content { padding: 28px 32px 60px; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat-card .label { color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-card .value { font-family: var(--font-serif); font-size: 1.8rem; color: var(--ink); font-weight: 700; margin-top: 6px; }
.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
@media (max-width: 900px) {
    .admin-sidebar { position: fixed; z-index: 60; height: 100vh; transform: translateX(-100%); transition: transform .2s ease; }
    .admin-sidebar.open { transform: translateX(0); }
}
