/*
Theme Name:  ePotala
Template:    melos
Description: Professional child theme for ETSI Resource Center
Version:     2.0.0
Author:      ePotala
*/

/* ============================================================
   FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Serif:ital,wght@0,400;0,600;1,400&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
    /* Palette */
    --navy:        #162039;
    --navy-dark:   #0c1526;
    --navy-mid:    #1d2f50;
    --navy-hover:  #233460;
    --gold:        #c4893f;
    --gold-hover:  #a8722e;
    --gold-light:  #dfaa6a;
    --gold-pale:   #fdf4e8;
    --white:       #ffffff;
    --surface:     #f5f7fa;
    --surface2:    #eaeff5;
    --border:      #dde4ed;
    --border2:     #c4cfd9;
    --text:        #1a2535;
    --text2:       #485a6e;
    --text3:       #8898aa;

    /* Scale */
    --radius:      5px;
    --radius-lg:   10px;
    --radius-xl:   14px;

    /* Shadows */
    --shadow-xs:   0 1px 3px rgba(16,30,58,0.07);
    --shadow-sm:   0 2px 8px rgba(16,30,58,0.09);
    --shadow-md:   0 6px 24px rgba(16,30,58,0.11);
    --shadow-lg:   0 12px 40px rgba(16,30,58,0.16);

    /* Motion */
    --ease:        all 0.22s ease;
    --ease-slow:   all 0.36s ease;
}

/* ============================================================
   RESET / BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    background: var(--surface);
}
body, p, li, td, caption, input, select, textarea, button,
#header .header-links li a,
#header-sticky .header-links li a,
#pre-header .header-links li a,
.main-navigation { font-family: 'Inter', system-ui, sans-serif; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Noto Serif', Georgia, serif;
    color: var(--navy);
    line-height: 1.3;
    letter-spacing: -0.2px;
}

a { color: var(--navy); transition: var(--ease); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: none; }

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

/* ============================================================
   PAGE SHELL
   ============================================================ */
#body-core { background: var(--surface); }

/* ============================================================
   PRE-HEADER — hidden (search removed)
   ============================================================ */
#pre-header { display: none !important; }

/* ============================================================
   MAIN HEADER
   ============================================================ */
#header,
#header-sticky {
    background: var(--white) !important;
    border-bottom: 1px solid var(--border) !important;
    box-shadow: var(--shadow-sm) !important;
}

/* ——— Header: stacked two-row layout ——— */
#header-core,
#header-sticky-core {
    display: block !important;
    padding: 0 !important;
}

/* Row 1 — Logo image + text */
#logo,
#logo-sticky {
    float: none !important;
    display: flex !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 14px 0 !important;
    border-bottom: 1px solid var(--border);
    margin: 0 !important;
}

/* Row 2 — Nav menu spans full width */
#header-links,
#header-sticky-links {
    float: none !important;
    width: 100% !important;
    clear: both;
}
#header-links-inner,
#header-sticky-links-inner {
    float: none !important;
    width: 100% !important;
}
/* Nav row: flex so ul + search sit side by side */
#header-links-inner,
#header-sticky-links-inner {
    display: flex !important;
    align-items: center !important;
}
/* Nav list left-aligned, horizontal */
#header .main-navigation ul,
#header-sticky .main-navigation ul {
    float: none !important;
    display: flex !important;
    flex-wrap: wrap;
    margin: 0 !important;
    padding: 0 !important;
}

/* ——— Inline header search (after Contact) ——— */
#ep-header-search {
    display: flex !important;
    align-items: stretch;
    padding: 0 !important;
    height: 46px;
    border-left: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    width: 200px !important;
}
#ep-header-search .search {
    background: var(--white) !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 36px 0 16px !important;
    font-size: 13px !important;
    font-family: 'Inter', sans-serif;
    color: var(--text) !important;
    width: 100% !important;
    height: 100% !important;
    outline: none;
    display: block;
}
#ep-header-search .search:focus {
    background: var(--surface) !important;
}
#ep-header-search .fa-search {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text3) !important;
    font-size: 13px;
    pointer-events: none;
}
#ep-header-search .searchsubmit { display: none; }
#ep-header-search ::-webkit-input-placeholder,
#ep-header-search ::placeholder { color: var(--text3); }

/* ——— Logo image ——— */
.ep-logo-img {
    height: 75px !important;
    width: auto !important;
    display: block !important;
    flex-shrink: 0;
    object-fit: contain;
}

/* #logo flex row is set in the header-core block above */

/* ——— Logo / Brand ——— */

/* Tibetan site name — small secondary label above the main brand */
#logo h1,
#logo-sticky h1 {
    font-family: 'Qomolangma-UchenSarchen', sans-serif !important;
    font-size: 13px !important;
    font-weight: 400 !important;
    color: var(--text3) !important;
    letter-spacing: 0.2px;
    line-height: 1.5;
    margin: 0 0 4px !important;
}

/* "ETSI Resource Center" — the PRIMARY brand identity */
.site-description {
    font-family: 'Noto Serif', Georgia, serif !important;
    font-size: 26px !important;
    font-weight: 600 !important;
    color: var(--navy) !important;
    letter-spacing: -0.5px !important;
    line-height: 1.15 !important;
    text-transform: none !important;
    display: block;
    margin-top: 0 !important;
}
.custom-logo { max-height: 52px !important; width: auto; }

/* ——— Navigation ——— */
/* Tibetan font listed after Inter so Latin → Inter, Tibetan → Qomolangma */
#header .header-links li a,
#header-sticky .header-links li a {
    color: var(--text2) !important;
    font-size: 12px !important;
    font-weight: 500;
    font-family: 'Inter', 'Qomolangma-UchenSarchen', system-ui, sans-serif !important;
    letter-spacing: 0.05px;
    padding: 0 11px !important;
    height: 46px !important;
    line-height: 46px !important;
    display: block;
    transition: var(--ease);
    white-space: nowrap;
}
#header .menu > li.menu-hover > a,
#header .menu > li.current_page_item > a,
#header .menu > li.current-menu-item > a,
#header .menu > li.current-menu-ancestor > a,
#header .menu > li > a:hover,
#header-sticky .menu > li.menu-hover > a,
#header-sticky .menu > li.current_page_item > a,
#header-sticky .menu > li.current-menu-item > a,
#header-sticky .menu > li.current-menu-ancestor > a,
#header-sticky .menu > li > a:hover {
    color: var(--white) !important;
    background: var(--navy) !important;
}

/* Dropdown */
#header .header-links .sub-menu,
#header-sticky .header-links .sub-menu {
    background: var(--white) !important;
    border-top: 2px solid var(--gold) !important;
    border-left: 1px solid var(--border) !important;
    border-right: 1px solid var(--border) !important;
    border-bottom: none !important;
    box-shadow: var(--shadow-md);
    border-radius: 0 0 var(--radius) var(--radius);
}
#header .header-links .sub-menu a,
#header-sticky .header-links .sub-menu a {
    color: var(--text2) !important;
    font-size: 12.5px;
    line-height: 1.4 !important;
    padding: 10px 18px !important;
    height: auto !important;
    border-left: none !important;
    font-weight: 400;
}
#header .header-links .sub-menu li,
#header-sticky .header-links .sub-menu li {
    border-left: none !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
    padding: 0;
}
#header .header-links .sub-menu li:last-child,
#header-sticky .header-links .sub-menu li:last-child { border-bottom: none; }
#header .header-links .sub-menu a:hover,
#header-sticky .header-links .sub-menu a:hover {
    color: var(--navy) !important;
    background: var(--surface) !important;
}

/* ——— Responsive nav ——— */
#header-responsive-link,
.header-responsive-inner {
    background: var(--white) !important;
    border-bottom: 1px solid var(--border);
}
#header-responsive-link a { color: var(--navy) !important; font-weight: 600; }

/* ============================================================
   SLIDER
   ============================================================ */
#slider {
    border-bottom: 3px solid var(--gold);
    position: relative;
}
/* Subtle gradient overlay at bottom of slider for bleed into content */
#slider::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 60px;
    background: linear-gradient(to bottom, transparent, rgba(245,247,250,0.5));
    pointer-events: none;
    z-index: 2;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
#content { padding: 28px 0 0; }
#content-core { background: transparent; }

/* The article card */
article.hentry {
    background: var(--white) !important;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: none;
}
/* Glossary heading — it's a <span style="font-size:20px"> inside a <p> */
.entry-content > p:first-child {
    font-family: 'Noto Serif', Georgia, serif !important;
    font-size: 22px !important;
    font-weight: 600 !important;
    color: var(--navy) !important;
    margin-bottom: 20px !important;
    line-height: 1.3;
}
.entry-content > p:first-child span {
    font-family: 'Noto Serif', Georgia, serif !important;
    font-size: 22px !important;
    font-weight: 600 !important;
    color: var(--navy) !important;
}
/* Tibetan span in heading uses Qomolangma (set directly in post content) */
.entry-content > p:first-child span[style*="Qomolangma"] {
    font-family: 'Qomolangma-UchenSarchen', sans-serif !important;
}

/* Headings inside content */
.entry-content h2 {
    font-size: 20px;
    color: var(--navy);
    margin: 28px 0 12px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}
.entry-content h3 {
    font-size: 17px;
    color: var(--navy);
    margin: 20px 0 8px;
}
/* First h2 on homepage — the Glossary title */
.entry-content > h2:first-child,
.entry-content > p:first-child + h2,
.entry-content h2.page-title {
    font-size: 21px;
    margin-top: 0;
    border-bottom-color: var(--gold);
}
.entry-content p {
    color: var(--text2);
    line-height: 1.75;
    margin-bottom: 14px;
}

/* ============================================================
   GLOSSARY (Participants Database search)
   ============================================================ */
.pdb-searchform { margin-bottom: 0; }

.pdb-searchform .control-group {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
}
.pdb-searchform .control-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text3);
    margin-right: 4px;
    margin-bottom: 0;
    float: none;
    width: auto;
}
.pdb-searchform .controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    float: none;
    margin: 0;
}
/* Search text input */
#participant_search_term,
.pdb-searchform input.search-item[type="text"] {
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius) !important;
    padding: 9px 16px !important;
    font-size: 14px !important;
    font-family: 'Inter', sans-serif;
    color: var(--text) !important;
    background: var(--white) !important;
    box-shadow: var(--shadow-xs);
    outline: none;
    transition: var(--ease);
    min-width: 260px;
    height: auto !important;
}
#participant_search_term:focus,
.pdb-searchform input.search-item[type="text"]:focus {
    border-color: var(--navy) !important;
    box-shadow: 0 0 0 3px rgba(22,32,57,0.07) !important;
}
/* Search button */
.search-form-submit {
    background: var(--navy) !important;
    color: var(--white) !important;
    border: none !important;
    border-radius: var(--radius) !important;
    padding: 9px 22px !important;
    font-size: 13px !important;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: var(--ease);
    height: auto !important;
    line-height: 1.4 !important;
}
.search-form-submit:hover {
    background: var(--navy-hover) !important;
}
/* Clear button */
.search-form-clear {
    background: transparent !important;
    color: var(--text3) !important;
    border: 1.5px solid var(--border) !important;
    border-radius: var(--radius) !important;
    padding: 9px 18px !important;
    font-size: 13px !important;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: var(--ease);
    height: auto !important;
    line-height: 1.4 !important;
}
.search-form-clear:hover {
    background: var(--surface2) !important;
    border-color: var(--border2) !important;
    color: var(--text2) !important;
}

/* ============================================================
   ENTRY CONTENT
   ============================================================ */
article.hentry .entry-content {
    display: block;
    padding: 36px 40px 40px;
}

/* ============================================================
   GLOSSARY ROW — HTML wrapper in post content, clean flex layout
   ============================================================ */
.ep-glossary-row {
    display: flex;
    align-items: stretch;
    gap: 20px;
    margin-bottom: 24px;
    clear: both;
}
/* Search form shrinks to content; plugin width is irrelevant inside flex */
.ep-glossary-row > .participants-database,
.ep-glossary-row > .pdb-list,
.ep-glossary-row > [id^="participants-list-"] {
    flex: 0 0 auto;
    min-width: 0;
    width: auto !important;
    float: none !important;
    margin: 0 !important;
}
/* Dict card fills remaining width */
.ep-dict-link {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: stretch;
    margin: 0 !important;
    padding: 0 !important;
}
.ep-dict-link a {
    font-family: 'Inter', 'Qomolangma-UchenSarchen', sans-serif !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: var(--gold-pale) !important;
    border: 1px solid rgba(196,137,63,0.25) !important;
    border-left: 4px solid var(--gold) !important;
    border-radius: var(--radius);
    padding: 14px 20px !important;
    color: var(--navy) !important;
    font-size: 13.5px;
    font-weight: 500;
    line-height: 1.4;
    transition: var(--ease);
    text-decoration: none !important;
    box-sizing: border-box;
}
.ep-dict-link a::before {
    content: "→";
    font-size: 16px;
    color: var(--gold);
    flex-shrink: 0;
}
.ep-dict-link a:hover {
    background: rgba(196,137,63,0.12) !important;
    border-left-color: var(--gold-hover) !important;
    color: var(--navy) !important;
}

/* ============================================================
   SUBJECT TILES — 2×2 card grid
   ============================================================ */
.section.group {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    float: none !important;
    clear: both; /* clears the pdb-list float above */
}
/* Remove pseudo clearfixes */
.section.group::before,
.section.group::after { display: none !important; }

.col.span_1_of_4 {
    float: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    margin-left: 0 !important;
}
/* Hide the trailing empty placeholder column */
.col.span_1_of_4:empty { display: none !important; }
.col.span_1_of_4 > p { margin: 0 !important; padding: 0 !important; line-height: 0; }

/* Card link wrapping each tile */
.col.span_1_of_4 > p > a,
.col.span_1_of_4 > a {
    display: block !important;
    overflow: hidden;
    border-radius: var(--radius-lg) !important;
    box-shadow: var(--shadow-sm);
    transition: var(--ease-slow);
    line-height: 0;
    border: 1px solid rgba(22,32,57,0.07);
}
.col.span_1_of_4 > p > a:hover,
.col.span_1_of_4 > a:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}
/* Tile image — natural ratio, no cropping (text is baked into the image) */
.col.span_1_of_4 > p > a img,
.col.span_1_of_4 > a img {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    transition: transform 0.4s ease;
    margin: 0 !important;
}
.col.span_1_of_4 > p > a:hover img,
.col.span_1_of_4 > a:hover img {
    transform: scale(1.04);
}

/* ============================================================
   SIDEBAR WIDGETS (card style only in sidebar, not footer)
   ============================================================ */
#sidebar .widget {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
}
.widget-title,
.widgettitle {
    font-family: 'Inter', sans-serif !important;
    font-size: 11px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--navy) !important;
    padding-bottom: 10px;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--gold);
}

/* ============================================================
   FOOTER — hidden in CSS immediately (avoids flash before JS runs)
   ============================================================ */
#footer { display: none !important; }

/* Keep the sub-footer gold top border since #footer is gone */
#sub-footer {
    border-top: 3px solid var(--gold) !important;
}

/* *** Fix: strip the sidebar card style from footer widgets *** */
#footer .widget,
#footer-core .widget {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 0;
}

/* Footer widget headings */
#footer h3.footer-widget-title,
#footer-core h3.footer-widget-title,
#footer-core h3 {
    color: var(--white) !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 10.5px !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    padding-bottom: 12px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12) !important;
    border-bottom-color: rgba(255,255,255,0.12) !important;
}
/* Override widget-title in footer too */
#footer .widget-title,
#footer-core .widget-title,
#footer .widgettitle,
#footer-core .widgettitle {
    color: var(--white) !important;
    font-size: 10.5px !important;
    letter-spacing: 1.4px;
    border-bottom-color: rgba(255,255,255,0.12);
    padding-bottom: 12px;
    margin-bottom: 18px;
}

/* Footer text and links */
#footer-core, #footer-core p { color: #8faabb; font-family: 'Inter', sans-serif; font-size: 14px; }
#footer-core a,
#footer .widget a,
#footer .widget li a {
    color: #8faabb !important;
    transition: var(--ease);
    font-size: 13.5px;
}
#footer-core a:hover,
#footer .widget a:hover,
#footer .widget li a:hover { color: var(--gold-light) !important; }

/* Footer nav menu list items */
#footer .widget li {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    padding: 7px 0 !important;
    list-style: none;
    font-size: 13.5px;
}
#footer .widget ul { margin: 0; padding: 0; }
#footer .widget li:last-child { border-bottom: none; }
#footer .widget li a::before { content: "—  "; color: var(--gold); font-size: 11px; }

/* Hide the footer menu column */
#footer-col1 { display: none !important; }

/* Copyright — full width, right-aligned */
#footer-col2 {
    width: 100% !important;
    float: none !important;
    text-align: right;
}
#footer-col2 .textwidget { color: #8faabb; font-size: 13px; line-height: 1.6; }
#footer-col2 .textwidget a { color: var(--gold-light) !important; }
#footer-col2 .textwidget a:hover { color: var(--white) !important; }

/* Sub-footer-widgets */
#sub-footer-widgets {
    background: var(--navy-mid);
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 20px 10px;
}
#sub-footer-widgets h3 { color: var(--white) !important; }
#sub-footer-widgets p, #sub-footer-widgets li { color: #8faabb; }
#sub-footer-widgets a { color: #8faabb; }
#sub-footer-widgets a:hover { color: var(--gold-light); }

/* Sub-footer copyright bar */
#sub-footer {
    background: var(--navy-dark) !important;
    padding: 14px 10px;
    border-top: 1px solid rgba(255,255,255,0.05);
}
#sub-footer, #sub-footer p { color: #8aa4b8; font-size: 12px; font-family: 'Inter', sans-serif; }
#sub-footer a { color: #8aa4b8 !important; font-weight: 500; }
#sub-footer a:hover { color: var(--gold-light) !important; }

/* Emory copyright — right-hand table-cell in sub-footer-core */
.ep-emory-copyright {
    display: table-cell;
    vertical-align: middle;
    text-align: right;
    white-space: nowrap;
    padding-left: 24px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    color: #8aa4b8;
}
.ep-emory-copyright a { color: #a8c4d8 !important; font-weight: 500; }
.ep-emory-copyright a:hover { color: var(--gold-light) !important; }

#footer-menu a {
    color: #8aa4b8;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.6px;
    padding: 0 10px;
    transition: var(--ease);
}
#footer-menu a:hover { color: var(--gold-light); }

/* ============================================================
   GLOBAL BUTTONS
   ============================================================ */
.button,
input[type="submit"],
button[type="submit"] {
    background: var(--navy) !important;
    color: var(--white) !important;
    border: none;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    padding: 10px 22px;
    cursor: pointer;
    transition: var(--ease);
}
.button:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
    background: var(--navy-hover) !important;
    color: var(--white) !important;
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
#breadcrumbs, .breadcrumbs {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    color: var(--text3);
    font-size: 12px;
    padding: 9px 0;
    font-family: 'Inter', sans-serif;
}
#breadcrumbs a, .breadcrumbs a { color: var(--navy); font-weight: 500; }
#breadcrumbs a:hover, .breadcrumbs a:hover { color: var(--gold); }

/* ============================================================
   SCROLL-UP
   ============================================================ */
#scrollUp {
    background: var(--navy);
    border-radius: 50%;
    width: 38px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--ease);
}
#scrollUp:hover { background: var(--gold); }

/* ============================================================
   MISC
   ============================================================ */
body.layout-fixed,
body.layout-fixed #body-core { background: var(--surface); }

/* Sticky footer — #body-core is a flex column so #content grows
   to fill the viewport, footer always flush at the bottom, no gap */
html, body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100% !important;
}
#body-core {
    min-height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    padding: 0 !important;
}
#content {
    flex: 1 !important;
}
#sub-footer {
    margin: 0 !important;
    padding: 14px 10px !important;
}
#sub-footer-widgets { display: none !important; }
