/* ═══════════════════════════════════════════════════════════
   article.css — Learn Ahom article page
   Uses site CSS variables throughout
═══════════════════════════════════════════════════════════ */

/* ── Base ────────────────────────────────────────────────── */
html, body { overflow-x: hidden; max-width: 100%; }
* { box-sizing: border-box; }

/* ── Article container ───────────────────────────────────── */
.article-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 28px 20px 80px;
}

table { min-width: 700px; }
section p { text-align: justify; }

/* ── Back link ───────────────────────────────────────────── */
.pg-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 22px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 140ms, background 140ms;
}
.pg-back:hover { color: var(--accent); background: var(--bg-hover); }

/* ── Article header ──────────────────────────────────────── */
.article-header {
    margin-bottom: 24px;
}

.article-header h1 {
    font-size: clamp(22px, 5vw, 36px);
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
    letter-spacing: -.02em;
    margin-bottom: 12px;
}

.article-header .subtitle {
    font-size: clamp(15px, 2.5vw, 18px);
    color: var(--text-muted);
    line-height: 1.65;
    font-weight: 400;
    /* No clamping — let it wrap naturally and breathe */
    max-width: 640px;
    text-align: left;
    text-wrap: pretty;
}

/* ── Hero image ──────────────────────────────────────────── */
.article-hero {
    margin: 0 0 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-soft);
}

.article-hero img {
    width: 100%;
    display: block;
    aspect-ratio: 16/9;
    object-fit: cover;
    transition: transform 300ms ease;
}
.article-hero:hover img { transform: scale(1.01); }

.article-hero figcaption {
    padding: 9px 14px;
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    line-height: 1.55;
    /* Allow long captions to wrap — never clamp */
    text-wrap: pretty;
    font-style: italic;
}

/* ── Meta line ───────────────────────────────────────────── */
.meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.meta a {
    color: var(--text-soft);
    text-decoration: none;
    font-weight: 500;
    transition: color 140ms;
}
.meta a:hover { color: var(--accent); }

/* ── Ad unit ─────────────────────────────────────────────── */
.ad-unit {
    margin: 24px 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-soft);
    padding: 8px 0;
}

.ad-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-muted);
    opacity: .4;
    text-align: center;
    margin-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════
   ARTICLE CONTENT — typography
═══════════════════════════════════════════════════════════ */
.article-content {
    font-size: 16px;
    line-height: 1.85;
    color: var(--text-soft);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Paragraphs */
.article-content p {
    margin-top:15px;
    /*margin: 0 0 20px;*/
    /*color: var(--text-soft);*/
}

/* Headings */
.article-content h2 {
    font-size: clamp(18px, 3.5vw, 24px);
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.25;
    letter-spacing: -.01em;
    margin-top: 30px;
    border-left: 4px solid var(--border-accent);
    padding-left: 10px;
}

.article-content h3 {
    font-size: clamp(16px, 3vw, 20px);
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.3;
    margin: 30px 0 10px;
}

.article-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
    margin: 24px 0 8px;
}

/* Links */
.article-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 140ms, text-decoration-color 140ms;
}
.article-content a:hover {
    color: var(--accent-soft);
    text-decoration-color: var(--accent-soft);
}

/* Bold / Italic */
.article-content strong, .article-content b { color: var(--text-main); font-weight: 700; }
.article-content em, .article-content i { font-style: italic; }

/* Lists */
.article-content ul,
.article-content ol {
    padding-left: 24px;
    margin: 0 0 20px;
}

.article-content li {
    margin-bottom: 8px;
    color: var(--text-soft);
    line-height: 1.7;
}

.article-content ul li::marker { color: var(--accent); }
.article-content ol li::marker { color: var(--accent); font-weight: 600; }

/* Blockquote */
.article-content blockquote {
    margin: 28px 0;
    padding: 14px 20px;
    background: var(--bg-soft);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    color: var(--text-soft);
    font-style: italic;
    line-height: 1.75;
}
.article-content blockquote p { margin: 0; color: inherit; }

/* Code */
.article-content code {
    font-family: 'Courier New', monospace;
    font-size: 13.5px;
    background: var(--bg-mark);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-main);
}

.article-content pre {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px 18px;
    overflow-x: auto;
    margin: 0 0 20px;
    font-size: 13.5px;
    line-height: 1.65;
}
.article-content pre code { background: none; padding: 0; border-radius: 0; }

/* Mark / highlight */
.article-content mark {
    background: var(--bg-mark);
    color: var(--text-main);
    border-radius: 3px;
    padding: 0 3px;
}
body.light .article-content mark { background: #fef08a; color: #1a1a1a; }

/* Horizontal rule */
.article-content hr,
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 36px 0;
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 0 0 24px;
    font-size: 14px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.article-content th {
    background: var(--bg-soft);
    color: var(--text-main);
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.article-content td {
    padding: 10px 14px;
    color: var(--text-soft);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.article-content tr:last-child td { border-bottom: none; }
.article-content tr:hover td     { background: var(--bg-hover); }

/* Images inside content */
.article-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    display: block;
    margin: 24px auto;
    border: 1px solid var(--border);
}

/* Figures inside content */
.article-content figure,
.article-content .article-figure {
    margin: 28px 0;
    text-align: center;
}

.article-content figure img,
.article-content .article-figure img {
    max-width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    margin: 0 auto;
}

.article-content figcaption {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    font-style: italic;
    line-height: 1.55;
    text-align: center;
    text-wrap: balance;
}

/* Ahom script spans */
.article-content .AhomFont {
    font-family: Ahom;
    font-size: 32px;
    line-height: 1.6;
}
.article-content .AhomUnicode {
    font-family: AhomUnicode;
    font-size: 22px;
    line-height: 1.6;
}

/* Manuscript blockquote styles */
.article-content .rawmanuscript {
    font-family: monospace;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.9;
    letter-spacing: .02em;
    word-spacing: .4em;
}

.article-content blockquote .ahom {
    font-family: Ahom, AhomUnicode, serif;
    font-size: 26px;
    line-height: 1.6;
    color: var(--text-main);
    letter-spacing: .03em;
    font-style: normal;
}

/* ═══════════════════════════════════════════════════════════
   AUTHOR CARD
═══════════════════════════════════════════════════════════ */
.author-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin: 40px 0 32px;
}

.author-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.author-info {
    flex: 1;
    min-width: 0;
}

.author-info h3 {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.author-info h3 + h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: 0;
    text-transform: none;
    margin-bottom: 6px;
}

.author-info p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 10px;
}

.author-link {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    transition: color 140ms;
}
.author-link:hover { color: var(--accent-soft); }

/* ═══════════════════════════════════════════════════════════
   RELATED ARTICLES
═══════════════════════════════════════════════════════════ */
.related-section {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 1px solid var(--border);
}

.related-section h2 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.related-section h2::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
}

.related-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    transition: border-color 160ms, box-shadow 160ms, transform 140ms;
}
.related-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    transform: translateY(-2px);
}

.related-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
    transition: transform 300ms ease;
}
.related-card:hover img { transform: scale(1.03); }

.related-card-body {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    /*gap: 5px;*/
}

.related-card-body h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom:0px;
    margin-top: 7px;
}

.related-card-body p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.rel-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: auto;
    padding-top: 4px;
    opacity: .65;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    .article-container { padding: 18px 14px 60px; }

    .article-header h1     { font-size: 22px; }
    .article-header .subtitle { font-size: 15px; }

    .article-content       { font-size: 15px; }
    .article-content h2    { font-size: 19px; margin-top: 32px; }
    .article-content h3    { font-size: 17px; }
    .article-content table { font-size: 13px; }

    /*.author-card { flex-direction: column; align-items: flex-start; }*/
    /*.author-avatar { width: 48px; height: 48px; }*/

    .related-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
    .article-content .AhomFont    { font-size: 24px; }
    .article-content .AhomUnicode { font-size: 18px; }
}