/* =====================================================
   TAIWAN GRANDDAD — Global Stylesheet v9
   Mobile-first. Dark theme. No framework.
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Shojumaru&family=Open+Sans:wght@400;600;700&family=Gochi+Hand&display=swap');

/* === CSS CUSTOM PROPERTIES === */
:root {
    --bg:            #1A1428;
    --bg-card:       #241934;
    --bg-tile:       #2A1F3A;
    --bg-hover:      #332244;

    --text-primary:  #FFFFFF;
    --text-secondary:#B3B3B3;
    --text-muted:    #7A7080;

    --orange:        #C4714A;
    --col-explorer:  #1D9E75;
    --col-kitchen:   #E87A40;
    --col-stories:   #8B79B8;
    --col-games:     #E85A20;
    --col-lantern:   #C4964A;

    --font-hero: 'Shojumaru', serif;
    --font-body: 'Open Sans', sans-serif;
    --font-hand: 'Gochi Hand', cursive;

    --pad:      14px;
    --radius:   8px;
    --radius-sm:4px;
    --nav-h:    64px;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    padding-bottom: var(--nav-h);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: var(--font-body); color: inherit; }
ul, ol { list-style: none; }

/* === PAGE WRAPPER === */
.page-wrap {
    max-width: 640px;
    margin: 0 auto;
}

/* =====================================================
   SITE HEADER
   ===================================================== */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px var(--pad) 0;
}
.site-greeting {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}
.site-header-actions {
    display: flex;
    gap: 14px;
    align-items: center;
}
.site-header-actions svg {
    opacity: 0.7;
}
.site-header-actions svg:hover {
    opacity: 1;
}

/* =====================================================
   FILTER PILLS
   ===================================================== */
.filter-pills {
    display: flex;
    gap: 8px;
    padding: 14px var(--pad) 12px;
    overflow-x: auto;
    scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }

.filter-pill {
    padding: 7px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    background: #2A2438;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.filter-pill.active {
    background: #FFFFFF;
    color: #000000;
}
.filter-pill:hover:not(.active) {
    background: #382A4A;
}

/* =====================================================
   FILTER VIEWS
   ===================================================== */
.filter-view { display: none; }
.filter-view.active { display: block; }

/* =====================================================
   QUICK TILES  (2-column grid)
   ===================================================== */
.quick-tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 0 var(--pad) 22px;
}
.quick-tile {
    background: var(--bg-tile);
    border-radius: var(--radius-sm);
    height: 52px;
    display: flex;
    align-items: center;
    overflow: hidden;
    cursor: pointer;
    transition: background 0.15s;
}
.quick-tile:hover,
.quick-tile:focus {
    background: var(--bg-hover);
    outline: none;
}
.quick-tile-img {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background-size: cover;
    background-position: center;
}
.quick-tile-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0 10px;
    line-height: 1.3;
}

/* =====================================================
   CONTENT ROW  (section + horizontal track)
   ===================================================== */
.content-row {
    padding: 0 var(--pad) 24px;
}
.content-row-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 3px solid var(--row-accent, rgba(255,255,255,0.07));
}
.content-row-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
}
.content-row-sub {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}
.content-row-see-all {
    font-size: 12px;
    font-weight: 600;
    color: var(--row-accent, var(--text-secondary));
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    opacity: 0.85;
    text-decoration: none;
}
.content-row-see-all:hover { opacity: 1; }

/* =====================================================
   HORIZONTAL SCROLL TRACK
   ===================================================== */
.h-scroll {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(to right, #000 75%, transparent 100%);
    mask-image: linear-gradient(to right, #000 75%, transparent 100%);
}
.h-scroll::-webkit-scrollbar { display: none; }

/* =====================================================
   LARGE CARD  (in horizontal scroll)
   ===================================================== */
.card-large {
    flex-shrink: 0;
    width: 160px;
    cursor: pointer;
}
.card-large-img {
    width: 160px;
    height: 160px;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-card);
    margin-bottom: 8px;
    transition: opacity 0.15s;
    position: relative;
    overflow: hidden;
}

.card-new-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--row-accent, var(--orange));
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.card-bilingual-tag {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.5px;
}
.card-large:hover .card-large-img { opacity: 0.8; }
.card-large-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 3px;
}
.card-large-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

/* =====================================================
   WIDE CARD  (single featured row)
   ===================================================== */
.card-wide {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 12px;
    display: flex;
    gap: 14px;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 10px;
}
.card-wide:hover { background: var(--bg-tile); }
.card-wide:last-child { margin-bottom: 0; }

.card-wide-img {
    width: 68px;
    height: 68px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-tile);
}
.card-wide-body { flex: 1; min-width: 0; }
.card-wide-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 4px;
    text-transform: uppercase;
}
.card-wide-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-wide-sub {
    font-size: 11px;
    color: var(--text-secondary);
}

/* =====================================================
   PAIR CARDS  (side by side)
   ===================================================== */
.cards-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.card-pair {
    cursor: pointer;
}
.card-pair-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-card);
    margin-bottom: 7px;
    transition: opacity 0.15s;
}
.card-pair:hover .card-pair-img { opacity: 0.8; }
.card-pair-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 2px;
}
.card-pair-sub {
    font-size: 10px;
    color: var(--text-secondary);
}

/* =====================================================
   SECTION HERO  (at top of filter views)
   ===================================================== */
.section-hero {
    margin: 0 var(--pad) 18px;
    padding: 14px 16px;
    border-radius: var(--radius);
    border-left: 3px solid;
}
.section-hero-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 5px;
}
.section-hero-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.4;
}

.section-hero.explorer  { background: #091510; border-color: var(--col-explorer); }
.section-hero.explorer .section-hero-label { color: var(--col-explorer); }
.section-hero.kitchen   { background: #160A04; border-color: var(--col-kitchen); }
.section-hero.kitchen .section-hero-label  { color: var(--col-kitchen); }
.section-hero.stories   { background: #0D0A18; border-color: var(--col-stories); }
.section-hero.stories .section-hero-label  { color: var(--col-stories); }
.section-hero.games     { background: #160700; border-color: var(--col-games); }
.section-hero.games .section-hero-label    { color: var(--col-games); }
.section-hero.lantern   { background: #161004; border-color: var(--col-lantern); }
.section-hero.lantern .section-hero-label  { color: var(--col-lantern); }

/* =====================================================
   2-COLUMN CARD GRID  (section detail view)
   ===================================================== */
.card-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 0 var(--pad);
    margin-bottom: 24px;
}
.card-grid-2-item { cursor: pointer; }
.card-grid-2-img {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius);
    background-size: cover;
    background-position: center;
    background-color: var(--bg-card);
    margin-bottom: 7px;
    transition: opacity 0.15s;
}
.card-grid-2-item:hover .card-grid-2-img { opacity: 0.8; }
.card-grid-2-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 2px;
}
.card-grid-2-sub {
    font-size: 10px;
    color: var(--text-secondary);
}

/* =====================================================
   BOTTOM NAVIGATION
   ===================================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: #0E0A1A;
    border-top: 1px solid #2A1F3A;
    display: flex;
    align-items: flex-start;
    justify-content: space-around;
    padding-top: 10px;
    z-index: 200;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 0 10px;
    text-decoration: none;
    color: var(--text-muted);
    border: none;
    background: none;
}
.bottom-nav-item svg { transition: opacity 0.15s; }
.bottom-nav-label {
    font-size: 10px;
    font-family: var(--font-body);
    transition: color 0.15s;
}
.bottom-nav-item.active .bottom-nav-label {
    color: var(--text-primary);
}
.bottom-nav-item.active svg path,
.bottom-nav-item.active svg rect,
.bottom-nav-item.active svg circle,
.bottom-nav-item.active svg ellipse {
    stroke: var(--text-primary);
    opacity: 1;
}
.bottom-nav-item.active .nav-fill {
    fill: var(--text-primary);
}

/* =====================================================
   INNER PAGE TOP NAV
   ===================================================== */
.page-top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(26, 20, 40, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    padding: 0 var(--pad);
    gap: 14px;
    z-index: 200;
    border-bottom: 1px solid #2A1F3A;
}
.page-top-nav-back {
    color: var(--orange);
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.page-top-nav-logo { height: 28px; }
.page-top-nav-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

/* =====================================================
   SECTION LIST PAGES  (asia-explorer.php etc.)
   ===================================================== */
.section-page {
    padding-top: 66px;
}
.section-page-header {
    padding: 20px var(--pad) 16px;
    border-bottom: 1px solid #2A1F3A;
    margin-bottom: 16px;
}
.section-page-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.section-page-title {
    font-family: var(--font-hero);
    font-size: 26px;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.section-page-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

/* =====================================================
   ARTICLE / CONTENT VIEW
   ===================================================== */
.article-hero-img {
    width: 100%;
    aspect-ratio: 16/9;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-card);
}
.article-header {
    padding: 20px var(--pad) 16px;
}
.article-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 10px;
}
.article-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 10px;
}
.article-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 12px;
}
.article-body {
    padding: 0 var(--pad) 32px;
    font-size: 16px;
    line-height: 1.75;
    color: #DDD5EE;
}
.article-body p { margin-bottom: 1.2em; }
.article-body h2, .article-body h3 {
    color: var(--text-primary);
    margin: 1.8em 0 0.6em;
    font-size: 20px;
}
.article-body h3 { font-size: 17px; }
.article-body img {
    border-radius: var(--radius);
    margin: 1.5em 0;
}
.article-body blockquote {
    border-left: 3px solid var(--orange);
    padding-left: 16px;
    margin: 1.5em 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* Bilingual word callout */
.bilingual-callout {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px var(--pad);
    margin: 0 var(--pad) 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.bilingual-word {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.bilingual-romanisation {
    font-size: 14px;
    color: var(--orange);
    margin-top: 2px;
}
.bilingual-language {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Granddad tip box */
.granddad-tip {
    background: var(--bg-card);
    border-left: 3px solid var(--orange);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 16px;
    margin: 0 var(--pad) 20px;
}
.granddad-tip-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--orange);
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}
.granddad-tip p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* =====================================================
   ABOUT / STATIC PAGES
   ===================================================== */
.content-page {
    padding: 20px var(--pad) 32px;
    font-size: 15px;
    line-height: 1.75;
    color: #DDD5EE;
    max-width: 640px;
    margin: 0 auto;
}
.content-page p { margin-bottom: 1.2em; }
.content-page img { border-radius: var(--radius); margin: 1.2em 0; }
.content-page h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 1.8em 0 0.6em;
}

.page-hero {
    padding: 80px var(--pad) 24px;
    text-align: center;
    border-bottom: 1px solid #2A1F3A;
    margin-bottom: 8px;
}
.page-title {
    font-family: var(--font-hero);
    font-size: 30px;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    font-family: var(--font-hand);
}

/* Safety badges on parents page */
.safety-badges {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 20px 0;
}
.safety-badge {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    border: 1px solid #2A1F3A;
}

/* =====================================================
   FOOTER
   ===================================================== */
.site-footer {
    padding: 32px var(--pad) 20px;
    text-align: center;
    border-top: 1px solid #2A1F3A;
}
.footer-logo { height: 44px; margin: 0 auto 12px; }
.footer-tagline {
    font-family: var(--font-hand);
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}
.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
    margin-bottom: 20px;
}
.footer-links a {
    font-size: 13px;
    color: var(--text-secondary);
}
.footer-links a:hover { color: var(--text-primary); }
.footer-safe {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* =====================================================
   ADMIN OVERRIDE  (keep admin panel readable)
   ===================================================== */
body.admin-body {
    background: #f5f5f5;
    color: #222;
    padding-bottom: 0;
}
body.admin-body input,
body.admin-body textarea,
body.admin-body select {
    color: #222;
    background: #fff;
}

/* =====================================================
   UTILITY
   ===================================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}
.hero-font { font-family: var(--font-hero); }

/* =====================================================
   EMPTY STATES
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 40px var(--pad);
    color: var(--text-secondary);
    font-family: var(--font-hand);
    font-size: 16px;
}

/* =====================================================
   ARTICLE VIEW ADDITIONS
   ===================================================== */
.article-wrap {
    padding-bottom: 100px;
}
.article-hero-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.article-hero-gradient {
    min-height: 200px;
}
.article-section-label {
    display: block;
    margin-bottom: 10px;
}
.article-back {
    padding: 8px var(--pad) 32px;
}
.article-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}
.article-back-link:hover { opacity: 0.75; }

/* =====================================================
   CARD LARGE — body / icon additions
   ===================================================== */
.card-large-img {
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-large-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
}
.card-large-icon {
    font-size: 36px;
    line-height: 1;
}
.card-large-body {
    padding-top: 8px;
}
.card-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* =====================================================
   SECTION PAGE HERO  (full-width banner on section pages)
   ===================================================== */
.section-page-hero {
    padding: 48px var(--pad) 28px;
    text-align: center;
    margin-bottom: 4px;
}
.section-page-hero-icon {
    font-size: 44px;
    line-height: 1;
    margin-bottom: 10px;
}
.section-page-hero-title {
    font-family: var(--font-hero);
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.section-page-hero-sub {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 320px;
    margin: 0 auto;
}

/* =====================================================
   SECTION EMPTY STATE
   ===================================================== */
.section-empty {
    text-align: center;
    padding: 80px var(--pad) 100px;
}
.section-empty-msg {
    font-family: var(--font-hand);
    font-size: 20px;
    color: var(--text-secondary);
    line-height: 1.5;
}
