/*
Theme Name:  Tower of Destiny
Theme URI:   https://quatscho.com
Author:      Quatscho Games
Author URI:  https://quatscho.com
Description: Official WordPress theme for Tower of Destiny — a browser-based roguelike dungeon crawler. Styled to match the game's dark fantasy aesthetic.
Version:     1.0.70
License:     GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: tower-of-destiny-theme
Tags:        dark, fantasy, game, custom-background, custom-logo, full-width-template
*/

/* ============================================================
   CSS CUSTOM PROPERTIES — mirrors the game's design tokens
   ============================================================ */
:root {
    --tod-bg:           #0d0d0d;
    --tod-bg-panel:     #141414;
    --tod-bg-overlay:   rgba(0, 0, 0, 0.88);
    --tod-border:       #2a2a2a;
    --tod-border-gold:  #8B6914;
    --tod-text:         #c8c8c8;
    --tod-text-dim:     #888;
    --tod-text-bright:  #ffffff;
    --tod-gold:         #FFD700;
    --tod-gold-dark:    #b8960a;
    --tod-green:        #4CAF50;
    --tod-red:          #F44336;
    --tod-blue:         #4488FF;
    --tod-orange:       #FFC107;
    --tod-purple:       #9C27B0;
    --tod-font-mono:    "Courier New", Courier, monospace;
    --tod-font-ui:      -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --tod-radius:       4px;
    --tod-transition:   0.15s ease;
    --tod-header-h:     72px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--tod-bg);
    color: var(--tod-text);
    font-family: var(--tod-font-ui);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
}

body.has-background-image {
    background-image: url('assets/images/tod-page-background.png');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

body.has-background-image::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--tod-bg-overlay);
    pointer-events: none;
    z-index: 0;
}

body.has-background-image > * {
    position: relative;
    z-index: 1;
}

/* Game UI elements appended directly to body must not have their
   position overridden by the rule above. The tooltip, overlays, and
   other fixed-position game elements need position:fixed to work.
   IMPORTANT: #tod-wrapper is intentionally excluded from this rule.
   The broad [id^="tod-"] selector previously matched #tod-wrapper,
   giving it position:fixed and creating a stacking context that
   intercepted hover events and caused the header avatar dropdown
   to flash and disappear on the Play Now page. Only true floating
   elements (tooltips, overlays) need position:fixed here. */
body.has-background-image > .tod-item-tooltip,
body.has-background-image > .tod-overlay {
    position: fixed !important;
    z-index: auto;
}
/* The site header must keep its sticky positioning and a z-index
   high enough to stack above all page content, including #tod-wrapper,
   so the avatar dropdown is always accessible on every page. */
body.has-background-image > .site-header {
    position: sticky !important;
    z-index: 100 !important;
}

a {
    color: var(--tod-gold);
    text-decoration: none;
    transition: color var(--tod-transition);
}
a:hover { color: #fff; }

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

h1, h2, h3, h4, h5, h6 {
    color: var(--tod-text-bright);
    font-family: var(--tod-font-ui);
    line-height: 1.3;
    margin-bottom: 0.5em;
}

p { margin-bottom: 1em; }

ul, ol { padding-left: 1.5em; margin-bottom: 1em; }

/* ============================================================
   SITE HEADER
   ============================================================ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--tod-header-h);
    background: rgba(13, 13, 13, 0.97);
    border-bottom: 1px solid var(--tod-border-gold);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 1.5rem;
}

.site-header__logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    flex-shrink: 1;
    min-width: 0;
}

.site-header__logo img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.site-header__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tod-gold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.site-header__nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.site-header__nav a {
    padding: 0.4rem 0.9rem;
    border-radius: var(--tod-radius);
    font-size: 0.9rem;
    color: var(--tod-text);
    transition: background var(--tod-transition), color var(--tod-transition);
}
.site-header__nav a:hover,
.site-header__nav a.current-menu-item {
    background: rgba(255, 215, 0, 0.12);
    color: var(--tod-gold);
}

/* ============================================================
   SITE FOOTER
   ============================================================ */
.site-footer {
    border-top: 1px solid var(--tod-border-gold);
    background: rgba(13, 13, 13, 0.97);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--tod-text-dim);
    font-size: 0.85rem;
}

.site-footer a { color: var(--tod-text-dim); }
.site-footer a:hover { color: var(--tod-gold); }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.site-main {
    max-width: none;
    margin: 0;
    padding: 0;
}

.site-main--wide {
    max-width: 100%;
    padding: 0;
}

/* ============================================================
   CONTENT PANEL (card-like container)
   ============================================================ */
.tod-panel {
    background: var(--tod-bg-panel);
    border: 1px solid var(--tod-border-gold);
    border-radius: var(--tod-radius);
    padding: 0;
    margin-bottom: 1.5rem;
    display: inline-block;
}

.tod-panel h2 {
    color: var(--tod-gold);
    border-bottom: 1px solid var(--tod-border-gold);
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-size: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.tod-btn {
    display: inline-block;
    padding: 0.55rem 1.4rem;
    border-radius: var(--tod-radius);
    border: 1px solid var(--tod-border-gold);
    background: #1a1200;
    color: var(--tod-gold);
    font-family: var(--tod-font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: background var(--tod-transition), color var(--tod-transition), border-color var(--tod-transition);
    text-decoration: none;
    letter-spacing: 0.03em;
}
.tod-btn:hover {
    background: var(--tod-gold);
    color: #000;
    border-color: var(--tod-gold);
}
.tod-btn--primary {
    background: var(--tod-gold);
    color: #000;
    border-color: var(--tod-gold);
}
.tod-btn--primary:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
}
.tod-btn--full { width: 100%; }

/* ============================================================
   FORM INPUTS
   ============================================================ */
.tod-input {
    display: block;
    width: 100%;
    padding: 0.55rem 0.85rem;
    background: #1a1a1a;
    border: 1px solid var(--tod-border);
    border-radius: var(--tod-radius);
    color: var(--tod-text-bright);
    font-family: var(--tod-font-ui);
    font-size: 0.95rem;
    transition: border-color var(--tod-transition);
    outline: none;
}
.tod-input:focus { border-color: var(--tod-border-gold); }
.tod-input::placeholder { color: var(--tod-text-dim); }

.tod-form-group {
    margin-bottom: 1.1rem;
}
.tod-form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
    color: var(--tod-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tod-form-error {
    color: var(--tod-red);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ============================================================
   AUTH PAGES (login / register)
   ============================================================ */
.tod-auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background-image: url('assets/images/tod-page-background.png');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
}

.tod-auth-wrap::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    pointer-events: none;
}

.tod-auth-box {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: var(--tod-bg-panel);
    border: 1px solid var(--tod-border-gold);
    border-radius: var(--tod-radius);
    padding: 2.5rem 2rem;
}

.tod-auth-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.tod-auth-logo img {
    max-width: 260px;
    margin: 0 auto 0.75rem;
    border-radius: var(--tod-radius);
}

.tod-auth-logo h1 {
    font-size: 1.4rem;
    color: var(--tod-gold);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.tod-auth-box h2 {
    color: var(--tod-gold);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--tod-border-gold);
    padding-bottom: 0.5rem;
    margin-bottom: 1.25rem;
}

.tod-auth-switch {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--tod-text-dim);
}
.tod-auth-switch a { color: var(--tod-gold); }
.tod-auth-switch a:hover { color: #fff; }

.tod-auth-messages {
    margin-bottom: 1rem;
}
.tod-auth-messages .tod-msg {
    padding: 0.6rem 0.85rem;
    border-radius: var(--tod-radius);
    font-size: 0.88rem;
    margin-bottom: 0.5rem;
}
.tod-msg--error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid var(--tod-red);
    color: #ff8a80;
}
.tod-msg--success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid var(--tod-green);
    color: #a5d6a7;
}

/* ============================================================
   HERO BANNER (front page)
   ============================================================ */

/* The hero fills the full viewport minus the sticky header so the
   background image is never cropped and the footer sits below the fold. */
.tod-hero {
    position: relative;
    width: 100%;
    min-height: calc( 100vh - var(--tod-header-h) );
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    text-align: center;
    /* Background positioned so the dragon near the top of the image is visible */
    background-image: url('assets/images/tod-page-background.png');
    background-size: cover;
    background-position: center 15%;
    background-repeat: no-repeat;
}

/* Dark overlay so the title and buttons remain legible */
.tod-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba( 0, 0, 0, 0.52 );
    pointer-events: none;
    z-index: 0;
}

.tod-hero__content {
    position: relative;
    z-index: 1;
    padding: 3rem 1.5rem;
    /* Allow the content to be as wide as the viewport needs so the
       nowrap title is never clipped. Horizontal padding provides
       breathing room on the sides. */
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* ── Styled title banner — mirrors the game board tod-page-title ── */
.tod-page-title-wrap {
    display:    block;
    width:      100%;
    text-align: center;
    padding:    0 1rem 1rem;
    margin:     0;
}

.tod-page-title {
    font-family:    'Cinzel Decorative', 'MedievalSharp', 'Palatino Linotype', Palatino, serif;
    /* 3.8vw keeps the full title on one line across common desktop widths;
       the clamp floor keeps it readable on narrow screens. */
    font-size:      clamp( 1.4rem, 3.8vw, 4rem );
    font-weight:    700;
    letter-spacing: 0.06em;
    line-height:    1.15;
    margin:         0;
    padding:        0 2vw;
    white-space:    nowrap; /* force single line */

    /* Layered gold / amber gradient text */
    background: linear-gradient(
        180deg,
        #fff5c0 0%,
        #f0c040 25%,
        #c8860a 55%,
        #7a4800 80%,
        #3d1f00 100%
    );
    -webkit-background-clip: text;
    background-clip:         text;
    -webkit-text-fill-color: transparent;
    color: #c8860a; /* fallback */

    /* Warm glow + deep shadow */
    filter: drop-shadow( 0 0 18px rgba(255, 200, 50, 0.65) )
            drop-shadow( 0 4px  8px rgba(  0,   0,  0, 0.90) );

    text-transform: uppercase;
}

.tod-page-title__ornament {
    display:        inline-block;
    font-size:      0.72em;
    vertical-align: middle;
    margin:         0 0.35em;
    opacity:        0.85;
    background:     inherit;
    -webkit-background-clip: text;
    background-clip:         text;
    -webkit-text-fill-color: transparent;
}

.tod-hero__tagline {
    font-size: 1.15rem;
    color: var(--tod-text);
    margin-bottom: 2rem;
    line-height: 1.7;
    text-shadow: 0 1px 4px rgba(0,0,0,0.9);
}

.tod-hero__cta {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============================================================
   AUTH-GATE NOTICE
   Shown on the front page hero when a logged-out visitor is
   redirected from a restricted page.
   ============================================================ */
.tod-auth-gate-notice {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(20, 10, 0, 0.78);
    border: 1px solid var(--tod-gold);
    border-radius: 6px;
    padding: 0.65rem 1.2rem;
    margin-bottom: 1.4rem;
    max-width: 520px;
    text-align: left;
    box-shadow: 0 0 18px rgba(212, 160, 23, 0.25);
}

.tod-auth-gate-notice__icon {
    font-size: 1.3rem;
    color: var(--tod-gold);
    flex-shrink: 0;
    line-height: 1;
}

.tod-auth-gate-notice__text {
    font-size: 0.95rem;
    color: #f0d98a;
    font-family: var(--tod-font-body, sans-serif);
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

/* ============================================================
   STICKY POST ANNOUNCEMENT
   Displayed on the front page hero between the title and the
   CTA buttons when a sticky post is published.
   ============================================================ */
.tod-hero__announcement {
    background: rgba(10, 8, 25, 0.80);
    border: 1px solid rgba(212, 160, 23, 0.55);
    border-radius: 8px;
    padding: 1.2rem 1.8rem;
    margin: 0 auto 1.8rem;
    max-width: 640px;
    width: 100%;
    text-align: center;
    box-shadow: 0 0 24px rgba(212, 160, 23, 0.18), inset 0 0 40px rgba(0,0,0,0.4);
}

.tod-hero__announcement-label {
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tod-gold);
    margin: 0 0 0.5rem;
    opacity: 0.85;
}

.tod-hero__announcement-title {
    font-family: 'Cinzel Decorative', serif;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    margin: 0 0 0.6rem;
    line-height: 1.3;
}

.tod-hero__announcement-title a {
    background: linear-gradient(135deg, #f5d060 0%, #c8860a 50%, #f5d060 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-decoration: none;
    transition: opacity 0.2s;
}

.tod-hero__announcement-title a:hover {
    opacity: 0.8;
}

.tod-hero__announcement-excerpt {
    font-size: 0.9rem;
    color: #c8bfa0;
    line-height: 1.6;
    margin: 0 0 0.8rem;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
}

.tod-hero__announcement-readmore {
    font-size: 0.82rem;
    color: var(--tod-gold);
    text-decoration: none;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(212,160,23,0.4);
    padding-bottom: 1px;
    transition: border-color 0.2s, color 0.2s;
}

.tod-hero__announcement-readmore:hover {
    color: #f5d060;
    border-color: #f5d060;
}

.tod-hero__announcement-body {
    font-size: 0.9rem;
    color: #c8bfa0;
    line-height: 1.7;
    text-shadow: 0 1px 3px rgba(0,0,0,0.9);
    text-align: left;
}

.tod-hero__announcement-body p {
    margin: 0 0 0.8rem;
}

.tod-hero__announcement-body p:last-child {
    margin-bottom: 0;
}

.tod-hero__announcement-body a {
    color: var(--tod-gold);
    text-decoration: underline;
}

.tod-hero__announcement-body a:hover {
    color: #f5d060;
}

/* ============================================================
   NAVIGATION MENUS
   ============================================================ */
.main-navigation ul {
    list-style: none;
    padding: 0;           /* override global ul padding-left */
    margin: 0;            /* override global ul margin-bottom */
    display: inline-flex; /* inline so it doesn't break to a new flex row */
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.1rem;
    flex-shrink: 0;
    min-width: max-content; /* prevent items from wrapping */
}

.main-navigation li {
    flex-shrink: 0;
    white-space: nowrap;
    position: relative;
}

/* Hide sub-menus in the header nav — they don't work in a single-line bar */
.main-navigation .sub-menu {
    display: none;
}

.main-navigation li a {
    padding: 0.35rem 0.6rem;
    border-radius: var(--tod-radius);
    font-size: 0.9rem;   /* match Log Out button */
    font-weight: 600;    /* match Log Out button bold */
    color: var(--tod-text);
    display: block;
    white-space: nowrap;
    transition: background var(--tod-transition), color var(--tod-transition);
}
.main-navigation li a:hover,
.main-navigation li.current-menu-item > a {
    background: rgba(255, 215, 0, 0.12);
    color: var(--tod-gold);
}

/* ============================================================
   WORDPRESS CORE OVERRIDES
   ============================================================ */
.wp-block-image figcaption,
.gallery-caption {
    color: var(--tod-text-dim);
    font-size: 0.85rem;
}

blockquote {
    border-left: 3px solid var(--tod-border-gold);
    padding: 0.5rem 1rem;
    color: var(--tod-text-dim);
    font-style: italic;
    margin: 1rem 0;
}

code, pre {
    font-family: var(--tod-font-mono);
    background: #1a1a1a;
    border: 1px solid var(--tod-border);
    border-radius: var(--tod-radius);
    font-size: 0.9em;
}
code { padding: 0.1em 0.4em; }
pre { padding: 1rem; overflow-x: auto; }
/* Hide stray empty <code> elements that appear as visible boxes */
.entry-content code:empty { display: none; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}
th, td {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--tod-border);
    text-align: left;
    font-size: 0.9rem;
}
th {
    background: #1a1a1a;
    color: var(--tod-gold);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.8rem;
}
tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination, .nav-links {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
    flex-wrap: wrap;
}
.page-numbers {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--tod-border);
    border-radius: var(--tod-radius);
    color: var(--tod-text);
    font-size: 0.9rem;
    transition: all var(--tod-transition);
}
.page-numbers.current,
.page-numbers:hover {
    border-color: var(--tod-border-gold);
    color: var(--tod-gold);
    background: rgba(255,215,0,0.08);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .site-header { padding: 0 1rem; }
    .site-header__title { display: none; }
    .tod-auth-box { padding: 1.75rem 1.25rem; }
    .site-main { padding: 1.5rem 1rem; }
    .tod-hero { min-height: calc( 100vh - var(--tod-header-h) ); }
    /* On narrow screens allow the title to shrink further but stay on one line */
    .tod-page-title { font-size: clamp( 1.1rem, 5.5vw, 2rem ); }
}

/* ============================================================
   SUGGESTED PASSWORD
   ============================================================ */
.tod-btn--sm {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
    line-height: 1.4;
}

.tod-suggested-pw-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,215,0,0.06);
    border: 1px solid var(--tod-border-gold);
    border-radius: var(--tod-radius);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
}

.tod-suggested-pw-value {
    flex: 1;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.95rem;
    color: var(--tod-gold);
    letter-spacing: 0.04em;
    word-break: break-all;
    background: none;
    border: none;
    padding: 0;
}

.tod-suggested-pw-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
