/* ==========================================================================
 * style.css — Editorial dark theme for an academic knowledge base.
 * Palette is warm-dark (#0f1115) with a single muted scholarly blue accent.
 * Headings use a serif for editorial feel; body uses a clean sans.
 * ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,600;0,700;0,800;1,600;1,700&display=swap');

/* --- Design tokens ------------------------------------------------------- */
:root {
    --bg:            #000000;
    --surface:       #0a0a0a;
    --surface-2:     #141414;
    --border:        #1f1f1f;
    --border-strong: #2e2e2e;

    --text:          #e6e6e6;
    --text-muted:    #a0a6b0;
    --text-subtle:   #6b7180;

    --accent:        #7aa7ff;
    --accent-hover:  #a5c4ff;
    --accent-quiet:  #3f5a8a;

    --warn:          #d4a85a;
    --success:       #7db68a;

    --code-bg:       #0b0d11;
    --code-fg:       #e6e6e6;

    --content-width: 960px;

    --font-serif:   'Newsreader', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
    --font-sans:    'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', Consolas, 'Courier New', monospace;
    --font-display: 'Playfair Display', 'Georgia', 'Times New Roman', serif;

    /* Site-wide H1 — sunset coral, used everywhere h1 appears */
    --h1-color:       #FF6F61;
    --h1-color-hover: #FF8F84;
    --h1-glow:        rgba(255, 111, 97, 0.18);
}

/* --- Base ---------------------------------------------------------------- */
* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    max-width: 1600px;
    padding: 0 40px 60px;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.7;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 720px) {
    body { padding: 0 20px 48px; }
}

/* --- Typography ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 600;
    color: var(--text);
    line-height: 1.25;
    letter-spacing: -0.01em;
    margin: 1.8em 0 0.6em;
}

/* All H1 — Playfair Display in sunset coral.
   Distinct from body Newsreader serif so page titles read as travel-magazine. */
h1 {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 700;
    margin-top: 0.4em;
    color: var(--h1-color);
    letter-spacing: -0.005em;
    transition: color 0.15s ease;
}
h1:hover { color: var(--h1-color-hover); }

/* Primary page title (the one with id="top" used by back-to-top). */
h1#top {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.015em;
    color: var(--h1-color);
    text-shadow: 0 0 30px var(--h1-glow);
    padding-bottom: 0.15em;
}
h1#top:hover { color: var(--h1-color-hover); }
h2 { font-size: 1.55rem; font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 0.35em; }
h3 { font-size: 1.2rem; font-weight: 600; color: var(--text); }
h4 { font-size: 1.02rem; font-weight: 600; color: var(--text-muted); text-transform: none; }

p {
    color: var(--text);
    margin: 0 0 1.1em;
}

ul, ol {
    color: var(--text);
    margin: 0 0 1.2em 0;
    padding-left: 1.4em;
}

li {
    margin-bottom: 0.45em;
    color: var(--text);
}

strong {
    color: var(--text);
    font-weight: 600;
}

em { color: var(--text-muted); font-style: italic; }

blockquote {
    margin: 1.5em 0;
    padding: 0.6em 1.2em;
    border-left: 3px solid var(--accent-quiet);
    background: var(--surface);
    color: var(--text-muted);
    font-style: italic;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2em 0;
}

/* --- Links --------------------------------------------------------------- */
a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.15s ease, color 0.15s ease;
}

a:hover {
    color: var(--accent-hover);
    border-bottom-color: var(--accent-hover);
    background: transparent;
}

/* --- Code ---------------------------------------------------------------- */
code {
    font-family: var(--font-mono);
    font-size: 0.9em;
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 0.12em 0.4em;
    border-radius: 3px;
    border: 1px solid var(--border);
}

pre {
    background: var(--code-bg);
    color: var(--code-fg);
    padding: 1em 1.2em;
    border-radius: 6px;
    border: 1px solid var(--border);
    overflow-x: auto;
    line-height: 1.55;
    font-family: var(--font-mono);
    font-size: 0.88rem;
    margin: 1.2em 0;
}

pre code {
    background: transparent;
    border: 0;
    padding: 0;
}

/* Prism code block sizing override — higher specificity than theme CSS */
body pre[class*="language-"] {
    font-size: 0.95rem;
    line-height: 1.5;
    font-family: var(--font-mono);
}

body code[class*="language-"] {
    font-size: 0.8rem;
    font-family: var(--font-mono);
}

body pre[class*="language-"] {
    padding: 0.9em 1.1em;
    border-radius: 6px;
    margin: 1.2em 0;
}

/* --- Tables -------------------------------------------------------------- */
table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.4em 0;
    font-size: 0.95rem;
}

th, td {
    text-align: left;
    padding: 10px 14px;
    border: 1px solid var(--border);
    vertical-align: top;
}

th {
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: 0.01em;
}

td { background: var(--surface); color: var(--text); }

tr:hover td { background: var(--surface-2); }

/* Legacy class aliases used across content pages */
.table,
.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.4em 0;
    background: var(--surface);
}
.table th, .comparison-table th {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
}
.table td, .comparison-table td {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 14px;
}
.table tr:hover td,
.comparison-table tr:hover td { background: var(--surface-2); }

/* --- Profile / hero blocks (homepage) ------------------------------------ */
.profile-photo {
    border-radius: 4px;
    border: 1px solid var(--border);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}

.hero {
    margin: 2.4em 0 2.2em;
    padding: 0;
}

.hero-title {
    font-family: var(--font-display);
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 0.15em;
    color: var(--h1-color);
    text-shadow: 0 0 30px var(--h1-glow);
}
.hero-title:hover { color: var(--h1-color-hover); }

.hero-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 1.25rem;
    color: var(--text-muted);
    margin: 0 0 1.4em;
    font-weight: 400;
}

.hero-meta {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 6px 18px;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin: 0;
    padding: 0;
}

.hero-meta dt {
    font-weight: 600;
    color: var(--text);
    font-variant: small-caps;
    letter-spacing: 0.04em;
    font-size: 0.85rem;
    padding-top: 3px;
}

.hero-meta dd {
    margin: 0;
    color: var(--text);
}

/* --- Document Intelligence banner (homepage) -----------------------------
   Size and position (max-width, margin) are set inline in index.html so
   they can be tweaked without touching CSS or running cache-bust.
   ------------------------------------------------------------------------ */
.doc-intel-banner {
    display: block;
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.doc-intel-banner:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(122, 167, 255, 0.18);
    transform: translateY(-1px);
}

.doc-intel-banner img {
    display: block;
    width: 100%;
    height: auto;
}

/* --- Search input (kept functional, restyled) ---------------------------- */
.search-box { margin-bottom: 24px; }

input[type="text"] {
    width: 100%;
    max-width: 720px;
    height: 44px;
    padding: 8px 14px;
    font-size: 1rem;
    font-family: var(--font-sans);
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(122, 167, 255, 0.15);
}

input[type="submit"] {
    height: 44px;
    padding: 0 22px;
    font-size: 0.95rem;
    font-family: var(--font-sans);
    font-weight: 500;
    background: var(--accent-quiet);
    color: var(--text);
    border: 1px solid var(--accent-quiet);
    border-radius: 4px;
    cursor: pointer;
    margin-left: 6px;
}

input[type="submit"]:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
}

/* --- Footer -------------------------------------------------------------- */
.footer {
    text-align: center;
    margin-top: 4em;
    padding: 1.4em 0 0.6em;
    border-top: 1px solid var(--border);
    color: var(--text-subtle);
    font-size: 0.82rem;
    background: transparent;
    font-weight: 400;
}

.footer p { margin: 3px 0; color: var(--text-subtle); }

/* --- Q&A blocks (used on some pages) ------------------------------------- */
.question { font-weight: 600; color: var(--accent); }
.answer   { margin-bottom: 1.2em; color: var(--text); }

/* --- Tagline / emphasis styles preserved from prior design --------------- */
.tagline {
    color: var(--warn);
    font-size: 1.15rem;
    font-family: var(--font-serif);
    font-style: italic;
}

.expertise-area {
    margin-bottom: 1.8em;
    padding: 1.1em 1.3em;
    background: var(--surface);
    border-left: 3px solid var(--accent-quiet);
    border-radius: 3px;
}

.expertise-area h3 { margin-top: 0; }
.expertise-area p  { margin-bottom: 0.8em; line-height: 1.7; }

.experience-block {
    margin-bottom: 1.5em;
    padding: 1.1em 1.3em;
    background: var(--surface);
    border-left: 3px solid var(--warn);
    border-radius: 3px;
}

.experience-block h3 { margin-top: 0; margin-bottom: 0.5em; }

.tech-category {
    margin-bottom: 1.2em;
    padding: 0.8em 1.1em;
    background: var(--surface);
    border-left: 3px solid var(--success);
    border-radius: 3px;
}

.tech-category h4 { margin-top: 0; margin-bottom: 0.45em; }
.tech-category p  { margin: 0; color: var(--text); }

.education-item {
    margin-bottom: 1.6em;
    padding: 1.1em 1.3em;
    background: var(--surface);
    border-left: 3px solid var(--accent);
    border-radius: 3px;
}

.education-item h3 { margin-top: 0; margin-bottom: 0.3em; color: var(--text); }
.education-item p  { margin: 0.3em 0; line-height: 1.6; }
.education-item strong { color: var(--warn); font-weight: 600; }

/* --- Counter / video helpers kept intact --------------------------------- */
.counter-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 240px;
    margin-top: 0;
    background: var(--bg);
    color: var(--text);
}

.video-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.video-item { display: flex; flex-direction: column; }

.video-item img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.55);
    display: block;
}

.video-item a {
    text-decoration: none;
    color: var(--accent);
    font-weight: 500;
}

.video-item a:hover { border-bottom-color: var(--accent-hover); }

.video-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
    border-radius: 6px;
    border: 1px solid var(--border);
}

.video-media img,
.video-media iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
}

.video-description {
    margin: 1.2em 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* --- Images -------------------------------------------------------------- */
img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

img.raw { border-radius: 0; }

/* --- Page hero (single feature image at top of a destination page) ------- */
.page-hero {
    margin: 0.6em auto 2em;
    max-width: 760px;
    text-align: center;
}
.page-hero img {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--border);
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.55);
    display: block;
}
.page-hero figcaption {
    margin-top: 0.65em;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-style: italic;
}

/* --- Photo grid (responsive 3-up gallery for destination sections) ------- */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 1.4em 0 2.2em;
}
.photo-grid figure {
    margin: 0;
    display: flex;
    flex-direction: column;
}
.photo-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: block;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}
.photo-grid figure:hover img {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}
.photo-grid figcaption {
    margin-top: 0.5em;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}
@media (max-width: 900px) {
    .photo-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}
@media (max-width: 540px) {
    .photo-grid { grid-template-columns: 1fr; gap: 14px; }
}

/* --- Utility ------------------------------------------------------------- */
.green-text { color: var(--success); }

/* --- 2026-04-25: Mobile responsive additions ----------------------------- */
@media (max-width: 768px) {
    /* Reduce body left/right padding for phones */
    body {
        padding: 0 16px 48px;
        font-size: 15px;
        line-height: 1.6;
    }

    /* Headings: scale down so they fit on narrow viewports */
    h1, .hero-title { font-size: 1.6rem !important; line-height: 1.2; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.08rem; }
    .hero-subtitle { font-size: 1rem; }

    /* Hero homepage table: stack image above text.
       Targets the inline-styled <td>s inside the hero <table>. */
    .hero table,
    .hero table tr,
    .hero table tbody { display: block; width: 100% !important; }
    .hero table td {
        display: block !important;
        width: 100% !important;
        padding: 0 0 1em 0 !important;
        text-align: left;
    }
    .hero table td img.profile-photo {
        width: 160px !important;
        height: auto;
    }

    /* Tables: allow horizontal scrolling rather than blowing out the layout */
    table,
    .table,
    .comparison-table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.88rem;
    }
    th, td,
    .table th, .table td,
    .comparison-table th, .comparison-table td {
        padding: 8px 10px;
    }

    /* Code blocks: keep horizontal scroll and shrink slightly */
    pre,
    body pre[class*="language-"] {
        font-size: 0.78rem;
        padding: 0.7em 0.85em;
        overflow-x: auto;
        word-wrap: break-word;
    }
    body code[class*="language-"] { font-size: 0.78rem; }
    code { word-break: break-word; }

    /* Inline-styled fixed-width <hr> (e.g. <hr width=1100>) — scale to viewport */
    hr[width],
    hr[width="1100"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Images never overflow */
    img { max-width: 100%; height: auto; }

    /* Hero meta: stack labels above values for small widths */
    .hero-meta {
        grid-template-columns: 1fr;
        gap: 2px 0;
    }
    .hero-meta dt { padding-top: 8px; }

    /* TOC nav blocks (inline-styled) — tighten padding */
    nav[aria-label="Table of contents"] {
        padding: 0.8em 1em !important;
        font-size: 0.92rem;
    }

    /* Aggressive override: any element using inline width:1100 / wide fixed widths */
    [style*="width: 1100"],
    [style*="width:1100"] {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Aggressive override: large inline left padding on hero <td> */
    .hero table td[style*="padding: 0 0 0 60px"] {
        padding: 1em 0 0 0 !important;
    }
}

/* ==========================================================================
 * Connections bar — horizontal pill-nav for related pages
 * ========================================================================== */
.connections-bar {
    margin: 1.2em 0 2em;
    padding: 12px 16px;
    background: var(--surface);
    border-left: 3px solid var(--accent);
    border-radius: 4px;
}
.connections-bar .connections-label {
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    margin-right: 10px;
}
.connections-bar a {
    display: inline-block;
    padding: 4px 12px;
    margin: 3px 4px 3px 0;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    color: var(--text) !important;
    text-decoration: none;
    font-size: 0.9em;
    white-space: nowrap;
    transition: all 0.2s ease;
}
.connections-bar a:hover {
    background: var(--bg);
    color: var(--accent-hover) !important;
    border-color: var(--accent);
}

/* ==========================================================================
 * Table of Contents — 3-column newspaper-flow layout
 * ========================================================================== */
ol.toc-grid, ul.toc-grid {
    display: block;
    column-count: 3;
    column-gap: 40px;
    padding-left: 1.6em;
    margin: 0 0 1.8em 0;
}
ol.toc-grid li, ul.toc-grid li {
    break-inside: avoid;
    margin: 0 0 8px 0;
    padding-left: 4px;
    line-height: 1.45;
}
@media (max-width: 900px) {
    ol.toc-grid, ul.toc-grid { column-count: 2; }
}
@media (max-width: 500px) {
    ol.toc-grid, ul.toc-grid { column-count: 1; }
}

/* ==========================================================================
 * Deep-dive cards — 3-across grid for "popular tourist destinations"
 * ========================================================================== */
.deep-dive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 1.4em 0 2.4em;
}
.deep-dive-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--h1-color);
    border-radius: 6px;
    padding: 18px 20px 16px;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    text-decoration: none;
}
.deep-dive-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-strong);
    border-left-color: var(--h1-color-hover);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
    background: var(--surface-2);
}
.deep-dive-card .card-eyebrow {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 6px;
}
.deep-dive-card h3 {
    font-family: var(--font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--h1-color);
    margin: 0 0 8px;
    line-height: 1.2;
    border-bottom: 0;
    padding-bottom: 0;
}
.deep-dive-card:hover h3 { color: var(--h1-color-hover); }
.deep-dive-card p {
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
    margin: 0 0 12px;
}
.deep-dive-card .card-cta {
    margin-top: auto;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}
.deep-dive-card:hover .card-cta { color: var(--accent-hover); }

@media (max-width: 900px) {
    .deep-dive-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}
@media (max-width: 560px) {
    .deep-dive-grid { grid-template-columns: 1fr; gap: 12px; }
    .deep-dive-card { padding: 14px 16px 12px; }
}

@media (max-width: 480px) {
    body {
        padding: 0 10px 40px;
        font-size: 14.5px;
    }

    h1, .hero-title { font-size: 1.4rem !important; }
    h2 { font-size: 1.15rem; }
    h3 { font-size: 1rem; }
    .hero-subtitle { font-size: 0.95rem; }

    pre,
    body pre[class*="language-"] {
        font-size: 0.72rem;
        padding: 0.55em 0.7em;
    }
    body code[class*="language-"] { font-size: 0.72rem; }

    th, td,
    .table th, .table td,
    .comparison-table th, .comparison-table td {
        padding: 6px 8px;
        font-size: 0.82rem;
    }

    nav[aria-label="Table of contents"] {
        padding: 0.65em 0.8em !important;
        font-size: 0.88rem;
    }
    nav[aria-label="Table of contents"] ol { padding-left: 1.1em; }

    .expertise-area,
    .experience-block,
    .tech-category,
    .education-item {
        padding: 0.85em 0.95em;
    }

    .hero table td img.profile-photo {
        width: 130px !important;
    }
}

/* Lightbox */
.photo-grid figure img { cursor: zoom-in; }
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; cursor: zoom-out;
}
.lightbox img {
  max-width: 95vw; max-height: 95vh;
  display: block;
}
