/* =========================================================================
   InsideRabat — editorial theme
   Palette inspired by Rabat: Moroccan red, Atlantic ink, Oudayas blue, sand.
   ========================================================================= */

:root {
    --brand-red: #C1272D;
    --brand-red-dark: #97161B;
    --ink: #10202E;
    --ink-soft: #1B3346;
    --blue: #2A6F97;
    --sand: #F6F1E7;
    --paper: #FFFFFF;
    --gold: #D9A441;
    --text: #18181A;
    --muted: #6A6A70;
    --line: rgba(16, 32, 46, 0.10);
    --line-strong: rgba(16, 32, 46, 0.16);

    --font-display: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --maxw: 1180px;
    --maxw-narrow: 720px;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16,32,46,.04), 0 8px 24px rgba(16,32,46,.06);
    --shadow-lg: 0 4px 12px rgba(16,32,46,.08), 0 18px 48px rgba(16,32,46,.10);
}

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

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
    background: var(--sand);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.inner { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.inner-narrow { max-width: var(--maxw-narrow); }

.site-wrapper { display: flex; flex-direction: column; min-height: 100vh; }
.site-main { flex: 1 0 auto; padding-bottom: 80px; }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(246,241,231,.86);
    backdrop-filter: saturate(160%) blur(12px);
    -webkit-backdrop-filter: saturate(160%) blur(12px);
    border-bottom: 1px solid var(--line);
}
.site-header-inner {
    display: flex; align-items: center; gap: 28px;
    height: 72px;
}
.site-brand { display: flex; align-items: center; gap: 12px; margin-right: auto; }
.site-brand-mark { display: flex; }
.site-brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.site-brand-name {
    font-family: var(--font-display);
    font-weight: 900; font-size: 22px; letter-spacing: -.01em; color: var(--ink);
}
.site-brand-name span { color: var(--brand-red); }
.site-brand-tag { font-size: 11px; color: var(--muted); letter-spacing: .02em; margin-top: 2px; max-width: 240px; }

.site-nav .nav { display: flex; gap: 26px; list-style: none; margin: 0; padding: 0; }
.site-nav a {
    font-size: 14.5px; font-weight: 600; color: var(--ink-soft);
    padding: 6px 0; position: relative; transition: color .15s ease;
}
.site-nav a::after {
    content: ""; position: absolute; left: 0; right: 100%; bottom: 0; height: 2px;
    background: var(--brand-red); transition: right .2s ease;
}
.site-nav a:hover { color: var(--brand-red); }
.site-nav a:hover::after { right: 0; }

.site-header-right { display: flex; align-items: center; gap: 14px; }
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; }
.lang-btn { font-size: 12px; font-weight: 700; letter-spacing: .03em; padding: 6px 12px; color: var(--muted); transition: all .15s ease; }
.lang-btn.is-active, .lang-btn:hover { background: var(--ink); color: #fff; }

.nav-toggle { display: none; flex-direction: column; gap: 4px; background: none; border: 0; cursor: pointer; padding: 8px; }
.nav-toggle span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; transition: .2s; }

/* ---------- Masthead ---------- */
.masthead { padding: 64px 0 40px; }
.masthead-ticker { display: flex; align-items: center; gap: 12px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--brand-red); margin-bottom: 22px; }
.ticker-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-red); position: relative; }
.ticker-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--brand-red); opacity: .5; animation: pulse 2s infinite; }
@keyframes pulse { 0%{ transform: scale(.7); opacity: .7 } 100%{ transform: scale(1.6); opacity: 0 } }
.ticker-date { color: var(--muted); text-transform: none; letter-spacing: 0; font-weight: 500; }
.masthead-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(38px, 6vw, 68px); line-height: 1.02; letter-spacing: -.02em; color: var(--ink); margin: 0 0 18px; }
.masthead-title em { font-style: italic; color: var(--brand-red); font-weight: 500; }
.masthead-sub { font-size: 18px; color: var(--ink-soft); max-width: 600px; margin: 0; }

/* ---------- Lead grid ---------- */
.lead-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 28px; padding: 16px 0 56px; }
.lead-side { display: flex; flex-direction: column; gap: 18px; }

/* ---------- Cards ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: transparent; }
.card-link { display: block; height: 100%; }
.card-body { padding: 22px; }
.card-image { aspect-ratio: 16/9; overflow: hidden; background: var(--ink); }
.card-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-image img { transform: scale(1.04); }

/* Placeholder cards (no feature image) — zellige-inspired gradient */
.card-image-placeholder { position: relative; display: flex; align-items: flex-end; padding: 18px; background: linear-gradient(135deg, var(--ink) 0%, var(--ink-soft) 55%, var(--blue) 100%); }
.card-image-placeholder::before {
    content: ""; position: absolute; inset: 0; opacity: .14;
    background-image: radial-gradient(circle at 20% 30%, #fff 1.5px, transparent 1.6px), radial-gradient(circle at 70% 70%, #fff 1.5px, transparent 1.6px);
    background-size: 26px 26px;
}
.card-image-placeholder::after {
    content: attr(data-letter); position: relative;
    font-family: var(--font-display); font-weight: 700; font-style: italic;
    font-size: 15px; color: rgba(255,255,255,.9); letter-spacing: .01em;
    border: 1px solid rgba(255,255,255,.3); padding: 4px 12px; border-radius: 999px;
}

.card-tag { display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--brand-red); margin-bottom: 10px; }
.card-title { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; color: var(--ink); margin: 0 0 10px; line-height: 1.18; }
.card-excerpt { color: var(--muted); font-size: 15px; margin: 0 0 14px; }
.card-meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 500; }
.card-meta-sep { opacity: .5; }

.card-lead .card-title { font-size: clamp(26px, 3vw, 34px); font-weight: 700; }
.card-lead .card-excerpt { font-size: 16.5px; }
.card-side { display: flex; }
.card-side .card-image-placeholder { display: none; }
.card-side .card-title { font-size: 18px; }
.card-side .card-body { padding: 18px 20px; }

.card-feed .card-title { font-size: 20px; }

/* ---------- Section head ---------- */
.section-head { display: flex; align-items: center; gap: 20px; margin: 8px 0 26px; }
.section-title { font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--ink); margin: 0; white-space: nowrap; }
.section-rule { flex: 1; height: 1px; background: var(--line-strong); }

/* ---------- Feed grid ---------- */
.feed-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.feed-grid-full { padding-top: 8px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 80px 20px; }
.empty-state h2 { font-family: var(--font-display); font-size: 28px; color: var(--ink); margin: 0 0 12px; }
.empty-state p { color: var(--muted); max-width: 440px; margin: 0 auto; }

/* ---------- Post ---------- */
.post-header { padding: 56px 0 26px; }
.post-meta-top { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.post-tag { font-size: 12.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #fff; background: var(--brand-red); padding: 5px 12px; border-radius: 999px; }
.post-date { font-size: 14px; color: var(--muted); font-weight: 500; }
.post-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(32px, 4.5vw, 50px); line-height: 1.08; letter-spacing: -.02em; color: var(--ink); margin: 0 0 20px; }
.post-lede { font-size: 21px; line-height: 1.5; color: var(--ink-soft); font-family: var(--font-display); font-weight: 400; margin: 0 0 28px; }
.post-byline { display: flex; align-items: center; gap: 12px; padding-top: 22px; border-top: 1px solid var(--line); }
.byline-avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.byline-text { display: flex; flex-direction: column; line-height: 1.3; }
.byline-name { font-weight: 600; font-size: 14.5px; color: var(--ink); }
.byline-detail { font-size: 13px; color: var(--muted); }

.post-feature { margin: 8px 0 40px; }
.post-feature img { width: 100%; border-radius: var(--radius); }
.post-feature figcaption { text-align: center; font-size: 13px; color: var(--muted); margin-top: 10px; }

.post-content { font-size: 18.5px; line-height: 1.72; color: #25252A; }
.post-content p { margin: 0 0 1.45em; }
.post-content h2 { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1.2; color: var(--ink); margin: 1.8em 0 .6em; letter-spacing: -.01em; }
.post-content h3 { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--ink); margin: 1.6em 0 .5em; }
.post-content a { color: var(--brand-red); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.post-content a:hover { color: var(--brand-red-dark); }
.post-content ul, .post-content ol { padding-left: 1.3em; margin: 0 0 1.45em; }
.post-content li { margin-bottom: .5em; }
.post-content blockquote { margin: 1.6em 0; padding: 6px 0 6px 24px; border-left: 4px solid var(--brand-red); font-family: var(--font-display); font-style: italic; font-size: 22px; color: var(--ink); }
.post-content img { border-radius: var(--radius); margin: 1.6em 0; }
.post-content hr { border: 0; border-top: 1px solid var(--line-strong); margin: 2.4em 0; }
.post-content strong { color: var(--ink); }

/* Koenig editor card widths */
.post-content :not(.kg-width-full) { }
.kg-width-wide { position: relative; width: 85vw; min-width: 100%; margin-left: calc(50% - 42.5vw); transform: none; }
.kg-width-full { position: relative; width: 100vw; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; max-width: 100vw; }
.kg-width-full img { border-radius: 0; }
@media (max-width: 720px) {
    .kg-width-wide { width: 100%; min-width: 0; margin-left: 0; }
}
/* Koenig card defaults */
.kg-card { margin: 1.6em 0; }
.kg-image-card img { margin: 0 auto; }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-bookmark-card a { text-decoration: none; }
.kg-bookmark-container { display: flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; color: var(--text); }
.kg-callout-card { padding: 16px 20px; border-radius: var(--radius-sm); margin: 1.6em 0; display: flex; gap: 12px; }
.kg-callout-card-grey { background: rgba(16,32,46,.05); }

.post-footer { padding: 44px 0 10px; }
.post-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.post-tag-chip { font-size: 13px; font-weight: 600; color: var(--ink-soft); background: rgba(16,32,46,.05); padding: 7px 14px; border-radius: 999px; transition: .15s; }
.post-tag-chip:hover { background: var(--ink); color: #fff; }
.post-disclaimer { font-size: 14px; line-height: 1.6; color: var(--muted); background: rgba(217,164,65,.10); border: 1px solid rgba(217,164,65,.3); border-radius: var(--radius-sm); padding: 16px 18px; }
.post-disclaimer strong { color: var(--ink); }

/* ---------- Related ---------- */
.related { margin-top: 48px; padding-top: 48px; border-top: 1px solid var(--line); }

/* ---------- Archive ---------- */
.archive-header { padding: 64px 0 36px; text-align: center; }
.archive-kicker { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-red); }
.archive-title { font-family: var(--font-display); font-weight: 900; font-size: clamp(36px, 5vw, 56px); color: var(--ink); margin: 12px 0 10px; letter-spacing: -.02em; }
.archive-desc { color: var(--ink-soft); max-width: 540px; margin: 0 auto 8px; }
.archive-count { font-size: 14px; color: var(--muted); }

/* ---------- Error ---------- */
.error-page { text-align: center; padding: 120px 20px; }
.error-code { font-family: var(--font-display); font-weight: 900; font-size: 90px; color: var(--brand-red); line-height: 1; }
.error-title { font-family: var(--font-display); font-size: 30px; color: var(--ink); margin: 12px 0; }
.error-desc { color: var(--muted); margin-bottom: 28px; }
.btn-primary { display: inline-block; background: var(--ink); color: #fff; font-weight: 600; padding: 12px 26px; border-radius: 999px; transition: .15s; }
.btn-primary:hover { background: var(--brand-red); }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 24px; max-width: var(--maxw); margin: 12px auto 0; padding: 40px 24px; }
.pagination a, .pagination .page-number { font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.pagination a { padding: 10px 20px; border: 1px solid var(--line-strong); border-radius: 999px; transition: .15s; }
.pagination a:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination .page-number { color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { flex-shrink: 0; background: var(--ink); color: rgba(255,255,255,.78); padding: 52px 0; }
.site-footer-inner { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.site-footer .site-brand-name { color: #fff; font-size: 24px; }
.site-footer .site-brand-name span { color: var(--gold); }
.footer-desc { font-size: 14px; max-width: 320px; margin: 12px 0 0; color: rgba(255,255,255,.6); }
.footer-meta { text-align: right; font-size: 13px; }
.footer-meta p { margin: 0 0 6px; }
.footer-fineprint { color: rgba(255,255,255,.5); max-width: 320px; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
    .lead-grid { grid-template-columns: 1fr; }
    .feed-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
    body { font-size: 16px; }
    .site-nav { position: fixed; inset: 72px 0 auto 0; background: var(--sand); border-bottom: 1px solid var(--line); flex-direction: column; padding: 16px 24px 24px; transform: translateY(-120%); transition: transform .25s ease; box-shadow: var(--shadow); }
    .site-nav.is-open { transform: translateY(0); }
    .site-nav .nav { flex-direction: column; gap: 4px; }
    .site-nav a { padding: 12px 0; font-size: 17px; border-bottom: 1px solid var(--line); }
    .nav-toggle { display: flex; }
    .feed-grid { grid-template-columns: 1fr; }
    .masthead { padding: 40px 0 24px; }
    .post-content { font-size: 17.5px; }
    .footer-meta { text-align: left; }
    .site-footer-inner { flex-direction: column; }
}
