/* =============================================================================
   Alef Info Systems — Design System
   Aesthetic: academic publishing house — warm whites, deep navy, restrained gold
   ============================================================================= */

:root {
    /* Color */
    --bg:           #fafaf6;   /* warm off-white */
    --surface:      #ffffff;   /* card / nav surface */
    --ink:          #1a1a1a;   /* primary text */
    --ink-muted:    #5a5a5a;   /* secondary text */
    --ink-faint:    #8a8a8a;   /* tertiary text / meta */
    --brand:        #0f2540;   /* deep navy — primary brand */
    --brand-soft:   #2a4f86;   /* lighter brand for links */
    --accent:       #8b6f3a;   /* warm tan / gold — sparingly */
    --accent-soft:  #b8985a;
    --accent-hover: #d6b25e;   /* brighter gold for interactive states */
    --rule:         #d8d4c8;   /* warm muted border */
    --rule-soft:    #ebe7db;
    --tint-blue:    #eaf2fb;
    --tint-green:   #e7f3eb;
    --tint-gold:    #fdf2e3;

    /* Typography */
    --serif:  'Charter','Iowan Old Style','Iowan Old Style W01','Georgia',serif;
    --sans:   'Inter','Helvetica Neue','Arial',sans-serif;
    --mono:   ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

    /* Spacing scale */
    --gutter:       1.5rem;
    --container:    760px;
    --container-wide: 1100px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--serif);
    font-feature-settings: "kern", "liga", "onum";
    line-height: 1.62;
    color: var(--ink);
    background: var(--bg);
    margin: 0;
    padding: 0;
}

.container { max-width: var(--container); margin: 10px auto 0; padding: 0 var(--gutter); }
.container-wide { max-width: var(--container-wide); margin: 10px auto 0; padding: 0 var(--gutter); }

/* -------------------------------------------------------------------------- */
/* Header                                                                     */
header {
    background: var(--brand);
    color: #ffffff;
    padding: 1.1rem 0;
}
.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}
header .container { max-width: var(--container-wide); }
.brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    color: #ffffff;
}
.brand-mark { height: 49px; width: auto; display: block; }

nav { display: flex; gap: 1.6rem; }
nav a {
    color: #ffffff;
    text-decoration: none;
    font-family: var(--sans);
    font-size: 0.92rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: color 120ms ease, border-color 120ms ease;
}
nav a:hover, nav a:focus {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
}
@media (max-width: 760px) {
    nav { gap: 0.75rem 1.1rem; flex-wrap: wrap; }
    nav a { font-size: 0.86rem; }
}

/* -------------------------------------------------------------------------- */
/* Hero (Home page)                                                           */
.hero {
    padding: 4.5rem 0 3rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 3rem;
}
.hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr);
    gap: 1.75rem;
    align-items: start;
}
.hero-glyph {
    font-family: 'Times New Roman','Charter','Iowan Old Style','Georgia',serif;
    font-weight: 600;
    font-size: clamp(7rem, 16vw, 12rem);
    line-height: 1;
    color: var(--brand);
    margin: 0;
    padding-top: 3rem; /* drops glyph top to align with .lede, leaving h1 as the anchor */
    text-align: center;
}
.hero-text h1 {
    font-family: var(--sans);
    font-size: clamp(1.6rem, 3.5vw, 2.2rem);
    font-weight: 600;
    line-height: 1.2;
    margin: 0 0 1rem;
    color: var(--brand);
    letter-spacing: -0.01em;
}
.hero-text p {
    font-size: 1.05rem;
    line-height: 1.6;
    color: var(--ink);
    margin: 0 0 0.85rem;
}
.hero-text p.lede {
    font-size: 1.18rem;
    color: var(--ink);
}
@media (max-width: 640px) {
    .hero-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .hero-glyph { font-size: 5.5rem; text-align: left; padding-top: 0; }
}

/* -------------------------------------------------------------------------- */
/* Main content                                                               */
main { padding: 2.5rem 0 5rem; }

.content > h1:first-child,
.content > h1:first-of-type {
    margin-top: 0;
}

.content h1, .content h2, .content h3, .content h4 {
    font-family: var(--sans);
    font-weight: 600;
    line-height: 1.25;
    color: var(--brand);
    margin-top: 2.4rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.005em;
}
.content h1 { font-size: 2.1rem; }
.content h2 {
    font-size: 1.4rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--rule-soft);
}
.content h3 { font-size: 1.15rem; }
.content h4 { font-size: 1rem; font-family: var(--serif); font-style: italic; color: var(--ink); }

.content p { margin: 0 0 1.15rem; }
.content ul, .content ol { padding-left: 1.5rem; margin: 0 0 1.15rem; }
.content li { margin-bottom: 0.4rem; }

.content a {
    color: var(--brand-soft);
    text-decoration-color: var(--accent-soft);
    text-underline-offset: 2px;
}
.content a:hover, .content a:focus {
    color: var(--brand);
    text-decoration-color: var(--accent-hover);
}

.content hr {
    border: none;
    height: 1px;
    background: var(--rule);
    margin: 3rem 0;
    position: relative;
}
.content hr::after {
    content: "";
    position: absolute;
    left: 50%;
    top: -3px;
    transform: translateX(-50%);
    width: 24px;
    height: 7px;
    background: var(--bg);
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px var(--accent);
}

.content blockquote {
    margin: 1.5rem 0;
    padding: 0.25rem 0 0.25rem 1.25rem;
    border-left: 3px solid var(--accent);
    color: var(--ink-muted);
    font-style: italic;
}

.content code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--tint-gold);
    padding: 0.08em 0.35em;
    border-radius: 3px;
    color: var(--ink);
}
.content pre {
    background: #f4f1e8;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    font-family: var(--mono);
    font-size: 0.88rem;
    line-height: 1.5;
}
.content pre code { background: none; padding: 0; }

/* -------------------------------------------------------------------------- */
/* Publications list                                                          */
.publications-list { list-style: none; padding: 0; margin: 1.5rem 0; }
.publications-list > li {
    margin-bottom: 1.75rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule-soft);
}
.publications-list > li:last-child { border-bottom: none; }
.publication-title {
    font-family: var(--sans);
    font-size: 1.08rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    color: var(--brand);
}
.publication-title a { text-decoration: none; color: inherit; }
.publication-title a:hover { color: var(--brand-soft); text-decoration: underline; text-decoration-color: var(--accent); }
.publication-meta { font-family: var(--sans); font-size: 0.85rem; color: var(--ink-muted); margin: 0 0 0.55rem; }
.publication-abstract { font-size: 0.97rem; color: var(--ink); line-height: 1.55; margin: 0; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
    font-family: var(--sans);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    vertical-align: middle;
}
.badge-preprint     { background: var(--tint-blue);  color: var(--brand-soft); }
.badge-published    { background: var(--tint-green); color: #2c6b3c; }
.badge-forthcoming  { background: var(--tint-gold);  color: #6f5022; }
.badge-draft        { background: #ebe9e2;            color: #666; }
.muted { color: var(--ink-faint); }

/* -------------------------------------------------------------------------- */
/* Books grid                                                                 */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 1.5rem 0 3rem;
}
.book-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--rule-soft);
    border-radius: 0.3rem;
    overflow: hidden;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
.book-card:hover { border-color: var(--rule); box-shadow: 0 4px 16px rgba(15, 37, 64, 0.06); }
.book-cover {
    background: linear-gradient(135deg, #f4f1e8 0%, #ece8da 100%);
    text-align: center;
    padding: 1rem;
    border-bottom: 1px solid var(--rule-soft);
}
.book-cover img {
    max-height: 280px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 14px rgba(15, 37, 64, 0.18);
}
.book-body { padding: 1.1rem 1.2rem 1.3rem; flex: 1; display: flex; flex-direction: column; }
.book-title {
    font-family: var(--sans);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.3rem;
    line-height: 1.3;
    color: var(--brand);
}
.book-subtitle {
    font-size: 0.95rem;
    font-style: italic;
    color: var(--ink-muted);
    margin: 0 0 0.7rem;
    line-height: 1.4;
}
.book-meta { font-family: var(--sans); font-size: 0.82rem; color: var(--ink-muted); margin: 0 0 0.8rem; }
.book-description { font-size: 0.94rem; color: var(--ink); margin: 0 0 1.1rem; flex: 1; line-height: 1.55; }
.book-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    padding-top: 0.6rem;
    border-top: 1px solid var(--rule-soft);
}
.book-isbn { font-size: 0.76rem; font-family: var(--sans); }

/* -------------------------------------------------------------------------- */
/* Buttons                                                                    */
.btn {
    display: inline-block;
    padding: 0.45rem 1rem;
    border-radius: 0.25rem;
    font-family: var(--sans);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid transparent;
    letter-spacing: 0.01em;
    transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-primary  { background: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus { background: var(--brand-soft); }
.btn-secondary { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.btn-secondary:hover, .btn-secondary:focus { background: var(--tint-blue); }

/* -------------------------------------------------------------------------- */
/* Forms                                                                      */
form { margin: 1.75rem 0; }
.form-row { margin-bottom: 1.15rem; display: flex; flex-direction: column; gap: 0.4rem; }
.form-row label {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.form-row input, .form-row select, .form-row textarea {
    font-family: var(--serif);
    font-size: 1rem;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--rule);
    border-radius: 0.2rem;
    background: var(--surface);
    color: var(--ink);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.form-row select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--brand) 50%),
                      linear-gradient(135deg, var(--brand) 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px, 5px 5px;
    background-repeat: no-repeat;
    padding-right: 2.5rem;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 37, 64, 0.10);
}
.form-row button {
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.65rem 1.6rem;
    border: none;
    border-radius: 0.25rem;
    background: var(--brand);
    color: #fff;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: background 120ms ease;
}
.form-row button:hover, .form-row button:focus { background: var(--brand-soft); }
.form-errors {
    background: #fdecea;
    border: 1px solid #e9b8b3;
    color: #8a2018;
    padding: 0.85rem 1.1rem;
    border-radius: 0.25rem;
    margin: 0 0 1.2rem;
    font-family: var(--sans);
    font-size: 0.92rem;
}
.contact-thanks {
    background: var(--tint-green);
    border: 1px solid #b8d8c2;
    color: #2c6b3c;
    padding: 1.4rem 1.6rem;
    border-radius: 0.3rem;
}
.contact-thanks h3 {
    margin: 0 0 0.5rem;
    font-family: var(--sans);
    color: #2c6b3c;
}

/* HTMX request indicator */
.htmx-indicator {
    display: none;
    margin-left: 0.75rem;
    color: var(--ink-faint);
    font-family: var(--sans);
    font-size: 0.88rem;
    font-style: italic;
}
.htmx-request .htmx-indicator { display: inline; }

/* -------------------------------------------------------------------------- */
/* Footer                                                                     */
footer {
    background: var(--brand);
    padding: 2rem 0;
    margin-top: 5rem;
    font-family: var(--sans);
    font-size: 0.83rem;
    color: #ffffff;
}
footer p { margin: 0.3rem 0; }
footer .muted { color: rgba(255, 255, 255, 0.7); }
footer a { color: #ffffff; text-decoration: none; }
footer a:hover { color: var(--accent-hover); text-decoration: underline; text-decoration-color: var(--accent-hover); }
.footer-rule {
    width: 40px;
    height: 2px;
    background: var(--accent);
    margin: 0 0 1rem;
}
