/* ==========================================================================
   Bokari.se — "Kvällsläsning"
   Warm paper, espresso ink, rust accent. Fraunces + Alegreya Sans.
   Base layout, header, homepage sections, footer.
   ========================================================================== */

:root {
    /* Palette */
    --paper: #F6EFE2;
    --card: #FDF9F0;
    --ink: #33261A;
    --ink-soft: #7A6A57;
    --line: #E6DAC5;
    --line-strong: #D2C1A3;
    --accent: #B04A25;
    --accent-deep: #8F3A1B;
    --accent-wash: #F3E1D4;
    --green: #4C614F;
    --green-deep: #3B4D3E;
    --green-wash: #E7EBE0;
    --gold: #D9A441;
    --gold-wash: #F8F0DC;
    --gold-line: #E4D2A8;

    /* Type */
    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Alegreya Sans", "Segoe UI", Tahoma, sans-serif;

    /* Shape & depth */
    --radius: 14px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(72, 52, 32, .10);
    --shadow-md: 0 10px 30px -12px rgba(72, 52, 32, .28);
    --shadow-lift: 0 16px 40px -14px rgba(72, 52, 32, .35);
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--ink);
    background-color: var(--paper);
    position: relative;
}

/* Subtle paper grain across the whole site */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.site-wrapper {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-main {
    flex: 1;
    padding: 2.5rem 0 4rem;
}

.container {
    width: min(1160px, 100% - 3rem);
    margin-inline: auto;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.2;
    color: var(--ink);
}

h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.25rem; }

p { color: var(--ink); }

/* Links are calm deep green; rust is reserved for buttons and CTAs
   so the page never reads as a wall of warnings */
a {
    color: var(--green-deep);
    text-decoration: none;
    transition: color .18s ease;
}

a:hover { color: var(--accent-deep); }

img { max-width: 100%; display: block; }

::selection {
    background: var(--accent-wash);
    color: var(--accent-deep);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-block;
    padding: .7rem 1.6rem;
    border: 2px solid transparent;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: .02em;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--accent);
    color: #FDF9F0;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--accent-deep);
    color: #FDF9F0;
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border-color: var(--line-strong);
}

.btn-secondary:hover {
    border-color: var(--ink);
    color: var(--ink);
    transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
    background: var(--paper);
    padding: 1.25rem 0 1rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.logo a {
    display: inline-flex;
    flex-direction: column;
    gap: .15rem;
}

.site-logo {
    height: 46px;
    width: auto;
}

.logo .tagline {
    font-size: .8rem;
    font-weight: 500;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--ink-soft);
    padding-left: 56px; /* aligns under the wordmark, past the icon */
}

/* Search */
.search-box {
    display: flex;
    align-items: stretch;
    background: var(--card);
    border: 1.5px solid var(--line-strong);
    border-radius: 999px;
    overflow: hidden;
    min-width: 260px;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    padding: .6rem 1.1rem;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--ink);
    outline: none;
}

.search-box input::placeholder { color: var(--ink-soft); }

.search-box button {
    border: none;
    background: var(--accent);
    color: #FDF9F0;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: .95rem;
    padding: 0 1.3rem;
    margin: 3px;
    border-radius: 999px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.search-box button:hover { background: var(--accent-deep); }

/* --------------------------------------------------------------------------
   Breadcrumbs
   -------------------------------------------------------------------------- */

.breadcrumbs {
    border-top: 1px solid var(--line);
    padding: .6rem 0;
    font-size: .9rem;
}

.breadcrumb-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
}

.breadcrumb-item a { color: var(--ink-soft); }
.breadcrumb-item a:hover { color: var(--accent); }
.breadcrumb-item.current { color: var(--ink); font-weight: 500; }
.breadcrumb-separator { color: var(--line-strong); }

/* --------------------------------------------------------------------------
   Homepage — hero
   -------------------------------------------------------------------------- */

.hero-section {
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    align-items: center;
    gap: 3rem;
    padding: 3rem 0 4rem;
}

.hero-content h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    font-weight: 700;
    margin-bottom: 1.2rem;
}

.hero-content h1 em {
    font-style: italic;
    color: var(--accent);
}

.hero-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.35rem;
    color: var(--green);
    margin-bottom: 1rem;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--ink-soft);
    max-width: 54ch;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.hero-illustration {
    justify-self: center;
    width: min(340px, 80%);
    animation: hero-float 7s ease-in-out infinite;
}

@keyframes hero-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

/* Staggered entrance */
.hero-content > * {
    animation: rise-in .7s cubic-bezier(.2, .7, .3, 1) both;
}

.hero-content > *:nth-child(2) { animation-delay: .08s; }
.hero-content > *:nth-child(3) { animation-delay: .16s; }
.hero-content > *:nth-child(4) { animation-delay: .24s; }

@keyframes rise-in {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   Homepage — featured books
   -------------------------------------------------------------------------- */

.featured-section { padding: 2rem 0 3rem; }

.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

/* Decorative rule after section titles */
.featured-section > h2,
.shelf-section > h2,
.section-header h2 {
    position: relative;
    padding-bottom: .6rem;
    margin-bottom: 1.5rem;
}

.featured-section > h2::after,
.shelf-section > h2::after,
.section-header h2::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 64px;
    border-bottom: 3px double var(--accent);
}

.section-header h2 { margin-bottom: 0; }

.section-link {
    font-weight: 700;
    white-space: nowrap;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.1rem;
}
@media (min-width: 640px) { .featured-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1000px) { .featured-grid { grid-template-columns: repeat(6, 1fr); } }

.featured-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .22s ease, box-shadow .22s ease;
}

.featured-item:hover {
    transform: translateY(-5px) rotate(-.4deg);
    box-shadow: var(--shadow-lift);
}

.featured-image {
    position: relative;
    aspect-ratio: 2 / 3;
    width: 100%;
    background: linear-gradient(160deg, var(--accent-wash), var(--green-wash));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.featured-image img {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Shown when no cover image exists (or fails to load) */
.cover-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1.25rem;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.35;
    color: var(--accent-deep);
}

.featured-content { padding: 1.1rem 1.25rem 1.35rem; }

.featured-content h3 {
    font-size: 1.15rem;
    margin-bottom: .25rem;
}

.featured-content h3 a { color: var(--ink); }
.featured-content h3 a:hover { color: var(--accent); }

.featured-content .author {
    font-style: italic;
    color: var(--green);
    font-size: .95rem;
    margin-bottom: .5rem;
}

.featured-content .description {
    font-size: .92rem;
    line-height: 1.5;
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Homepage — Dagens bok
   -------------------------------------------------------------------------- */

.dotd-section { margin: 2.5rem 0 1rem; }

.dotd-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 860px) {
    .dotd-layout { grid-template-columns: minmax(0, 2.2fr) minmax(0, 1fr); align-items: start; }
}

.dotd-main {
    display: flex;
    gap: 1.5rem;
    background: linear-gradient(150deg, var(--accent-wash), var(--green-wash));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem 1.75rem;
}

.dotd-cover {
    position: relative;
    flex: 0 0 130px;
    align-self: flex-start;
    aspect-ratio: 2 / 3;
    border-radius: calc(var(--radius) - 4px);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    background: var(--card);
    display: flex; align-items: center; justify-content: center;
}
.dotd-cover img { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 1; }
@media (max-width: 480px) { .dotd-cover { flex-basis: 96px; } }

.dotd-body { min-width: 0; }
.dotd-date {
    display: block;
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: .35rem;
}
.dotd-body h3 { font-size: 1.5rem; line-height: 1.15; margin-bottom: .2rem; }
.dotd-body h3 a { color: var(--ink); }
.dotd-body h3 a:hover { color: var(--accent); }
.dotd-body .author { font-style: italic; color: var(--green); font-size: .95rem; margin-bottom: .7rem; }
.dotd-text {
    font-size: 1.02rem;
    line-height: 1.6;
    color: var(--ink);
    margin-bottom: .8rem;
}
.dotd-link { font-weight: 600; font-size: .95rem; color: var(--accent); }
.dotd-link:hover { color: var(--accent-deep); }

.dotd-week {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.4rem;
}
.dotd-week h4 {
    font-size: .82rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: .8rem;
}
.dotd-week ul { list-style: none; margin: 0; padding: 0; }
.dotd-week li + li { border-top: 1px solid var(--line); }
.dotd-week li a {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .55rem 0;
}
.dotd-week-date { font-size: .78rem; color: var(--green); }
.dotd-week-title { color: var(--ink); font-weight: 600; line-height: 1.25; }
.dotd-week li a:hover .dotd-week-title { color: var(--accent); }

/* --------------------------------------------------------------------------
   Homepage — Senast tillagda (horizontal cards)
   -------------------------------------------------------------------------- */

.recent-section { margin: 2.5rem 0 1rem; }

.recent-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.1rem;
}
@media (min-width: 720px) { .recent-list { grid-template-columns: repeat(2, 1fr); } }

.recent-item {
    display: flex;
    gap: 1.1rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem 1.25rem;
    transition: transform .22s ease, box-shadow .22s ease;
}
.recent-item:hover { transform: translateY(-4px) rotate(-.3deg); box-shadow: var(--shadow-lift); }

.recent-cover {
    position: relative;
    flex: 0 0 96px;
    align-self: flex-start;
    aspect-ratio: 2 / 3;
    border-radius: calc(var(--radius) - 5px);
    overflow: hidden;
    background: linear-gradient(160deg, var(--accent-wash), var(--green-wash));
    display: flex; align-items: center; justify-content: center;
}
.recent-cover img { width: 100%; height: 100%; object-fit: contain; position: relative; z-index: 1; }

.recent-body { min-width: 0; }
.recent-body h3 { font-size: 1.12rem; line-height: 1.2; margin-bottom: .2rem; }
.recent-body h3 a { color: var(--ink); }
.recent-body h3 a:hover { color: var(--accent); }
.recent-body .author { font-style: italic; color: var(--green); font-size: .9rem; margin-bottom: .45rem; }
.recent-body .description {
    font-size: .9rem;
    line-height: 1.5;
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-more {
    display: inline-block;
    margin-top: .5rem;
    font-size: .88rem;
    font-weight: 600;
    color: var(--accent);
}
.recent-more:hover { color: var(--accent-deep); }

/* --------------------------------------------------------------------------
   Homepage — browse-the-shelves band
   -------------------------------------------------------------------------- */

.shelf-section {
    background: var(--green-wash);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 2.25rem 2.5rem 2rem;
    margin: 2rem 0 1rem;
}

.shelf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
}

.shelf-section .sub-chip {
    background: var(--card);
    font-size: .95rem;
    padding: .32rem 1rem;
}

.shelf-meta {
    margin: 1.4rem 0 0;
    font-size: .95rem;
    font-style: italic;
    color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    background: var(--ink);
    color: #E9DFCE;
    padding: 3rem 0 1.5rem;
    margin-top: 3rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 2.5rem;
    padding-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.3rem;
    color: #FDF9F0;
    margin-bottom: .75rem;
}

.footer-section h4 {
    font-size: .85rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: .9rem;
    font-family: var(--font-body);
    font-weight: 700;
}

.footer-section p {
    color: #C9BBA4;
    font-size: .95rem;
    max-width: 36ch;
}

/* Brand column: light logo variant over the description */
.footer-logo { display: inline-block; margin-bottom: 1rem; }

.footer-logo .site-logo { width: 190px; height: auto; display: block; }

/* Recolor the inline logo for the dark footer */
.footer-logo [stroke="#33261A"] { stroke: #F1E7D2; }
.footer-logo [fill="#FDF9F0"] { fill: transparent; }
.footer-logo text { fill: #F6EFE2; }
.footer-logo tspan { fill: var(--gold); }

.footer-brand p { font-style: italic; line-height: 1.6; }

.footer-section ul { list-style: none; }

.footer-section ul li { margin-bottom: .45rem; }

.footer-section a {
    color: #E9DFCE;
    font-size: .95rem;
}

.footer-section a:hover { color: var(--gold); }

.social-links { display: flex; flex-direction: column; gap: .45rem; }

.footer-bottom {
    border-top: 1px solid rgba(233, 223, 206, .18);
    padding-top: 1.25rem;
    text-align: center;
}

.footer-bottom p {
    color: #A5947B;
    font-size: .85rem;
}

.footer-disclosure {
    margin-top: .3rem;
    font-size: .78rem !important;
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
    .hero-section { grid-template-columns: 1fr; padding-top: 1.5rem; }
    .hero-illustration { order: -1; width: min(240px, 60%); }
    .footer-content { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .logo { align-self: center; text-align: center; }
    .logo .tagline { padding-left: 0; }
    .search-box { min-width: 0; }
    .site-main { padding-top: 1.5rem; }
}

@media (max-width: 540px) {
    .footer-content { grid-template-columns: 1fr; gap: 1.75rem; }
    .stats-section { padding: 1.75rem 1.25rem 2rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
