/* ================================================= */
/* FONTS                                             */
/* ================================================= */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Marcellus+SC&family=Cormorant+Garamond:wght@300;400;600&family=IM+Fell+English@0;1&display=swap');

/* ================================================= */
/* GLOBAL THEME VARIABLES                            */
/* ================================================= */
/*
   HOW TO RESKIN FOR A NEW CITY — city page only needs
   to override these variables in its own <style> block.

   Example:
     --city-primary:   #4ab3ff;
     --city-secondary: #0077cc;
     --city-accent:    #c8e6ff;
     --city-glow:      rgba(74, 179, 255, 0.35);
     --city-border:    rgba(74, 179, 255, 0.25);
     --city-bg-deep:   #010508;
     --city-bg-mid:    #020a10;
     --city-bg-card:   #061018;
     --city-ink:       #02101a;
     --city-parchment: #dbeeff;
*/

:root {
    /* Accent colors — primary buttons/glows, secondary gradients */
    --city-primary:   #ff7a00;
    --city-secondary: #ff3c00;

    /* Main highlight/text color */
    --city-accent:    #f1d7a1;

    /* Derived helpers */
    --city-glow:   rgba(255, 122, 0, 0.35);
    --city-border: rgba(255, 122, 0, 0.25);

    /* Background layers: page → mid → cards */
    --city-bg-deep: #050302;
    --city-bg-mid:  #0a0604;
    --city-bg-card: #100806;

    /* Parchment panel */
    --city-parchment: #e8d5b0;
    --city-ink:       #2a1a0e;

    /* Typography */
    --font-title: 'Marcellus SC', 'Cinzel', serif;
    --font-body:  'Cormorant Garamond', serif;
    --font-lore:  'IM Fell English', serif;

    /* Motion */
    --transition: 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ================================================= */
/* RESET & BASE                                      */
/* ================================================= */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html { scroll-behavior: smooth; }

body {
    background-color: var(--city-bg-deep);
    color: var(--city-accent);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
}

img { display: block; max-width: 100%; }
a   { color: inherit; text-decoration: none; }

/* === CUSTOM CURSOR === */

html, body, * {
    cursor: url("/images/mouse/normal3.png") 0 0, auto !important;
}

*:hover {
    cursor: url("/images/mouse/normal3.png") 0 0, auto !important;
}

*:active {
    cursor: url("/images/mouse/point2.png") 0 0, auto !important;
}

/* ================================================= */
/* TYPOGRAPHY                                        */
/* ================================================= */

h1, h2, h3, h4 {
    font-family: var(--font-title);
    letter-spacing: 0.18em;
    line-height: 1.2;
    color: var(--city-accent);
}

h1 { font-size: clamp(64px, 13vw, 140px); font-weight: 700; }
h2 { font-size: clamp(24px, 4vw, 34px);   font-weight: 600; text-align: center; }
h3 { font-size: clamp(15px, 2vw, 18px);   font-weight: 400; letter-spacing: 0.3em; text-transform: uppercase; }

.eyebrow {
    display: block;
    font-size: 13px;
    letter-spacing: 0.45em;
    text-transform: uppercase;
    color: var(--city-primary);
    opacity: 0.85;
    margin-bottom: 10px;
}

/* ================================================= */
/* SITE-WIDE NAV                                     */
/* ================================================= */

nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 18px 30px;
    background: rgba(5, 10, 25, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
}

nav a {
    color: #d6e1ff;
    letter-spacing: 2px;
    font-size: 14px;
    transition: 0.3s;
}

nav a:hover {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(180, 200, 255, 0.8);
}

/* Dropdown */
.dropdown { position: relative; }

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(5, 10, 25, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 15px 0;
    min-width: 180px;
    display: none;
    flex-direction: column;
    border: 1px solid rgba(150, 180, 255, 0.2);
    box-shadow: 0 0 20px rgba(100, 150, 255, 0.3);
}

.dropdown-content a {
    padding: 10px 20px;
    display: block;
    font-size: 14px;
    letter-spacing: 1px;
    color: #d6e1ff;
    transition: 0.3s;
}

.dropdown-content a:hover {
    background: rgba(100, 150, 255, 0.15);
    color: #ffffff;
}

.dropdown:hover .dropdown-content { display: flex; }

/* ================================================= */
/* DIVIDERS                                          */
/* ================================================= */

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px auto;
    max-width: 480px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--city-primary), transparent);
}

.divider-gem {
    width: 8px;
    height: 8px;
    background: var(--city-primary);
    transform: rotate(45deg);
    flex-shrink: 0;
    box-shadow: 0 0 12px var(--city-primary);
}

/* ================================================= */
/* HERO                                              */
/* ================================================= */

.hero {
    padding-top: 70px;
    position: relative;
    height: 72vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(to bottom, rgba(0,0,0,0.2) 0%, var(--city-bg-deep) 100%),
                var(--hero-image, linear-gradient(160deg, var(--city-bg-card), var(--city-bg-deep))) center / cover no-repeat;
}

.hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 50% 120%, rgba(0,0,0,0) 0%, var(--city-bg-deep) 75%),
        linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, transparent 40%, transparent 60%, var(--city-bg-deep) 100%);
    pointer-events: none;
    z-index: 1;
}

.hero::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 600px; height: 300px;
    background: radial-gradient(ellipse, var(--city-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
    animation: heroGlow 4s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    from { opacity: 0.6; transform: translate(-50%, -50%) scale(1);    }
    to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.15); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 20px;
}

.hero h1 {
    color: #fff;
    text-shadow:
        0 0 20px var(--city-primary),
        0 0 60px var(--city-secondary),
        0 0 100px var(--city-glow);
    animation: titleFlicker 6s ease-in-out infinite alternate;
}

@keyframes titleFlicker {
    0%   { text-shadow: 0 0 20px var(--city-primary), 0 0 60px var(--city-secondary), 0 0 100px var(--city-glow); }
    50%  { text-shadow: 0 0 30px var(--city-primary), 0 0 80px var(--city-secondary), 0 0 140px var(--city-glow); }
    100% { text-shadow: 0 0 18px var(--city-primary), 0 0 55px var(--city-secondary), 0 0  90px var(--city-glow); }
}

.hero-tagline {
    font-family: var(--font-lore);
    font-style: italic;
    font-size: clamp(15px, 2.2vw, 20px);
    color: rgba(241, 215, 161, 0.75);
    margin-top: 8px;
    letter-spacing: 0.12em;
}

.hero-rule {
    width: clamp(120px, 25vw, 220px);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--city-primary), transparent);
    margin: 14px auto;
}

/* ================================================= */
/* STICKY CITY NAV                                   */
/* ================================================= */

.city-nav {
    position: sticky;
    top: 0;
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(20px, 4vw, 60px);
    padding: 18px 30px;
    background: rgba(5, 3, 2, 0.92);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-top:    1px solid var(--city-border);
    border-bottom: 1px solid var(--city-border);
}

.city-nav a {
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--city-accent);
    opacity: 0.55;
    transition: var(--transition);
    position: relative;
    padding-bottom: 4px;
    white-space: nowrap;
}

.city-nav a::after {
    content: '';
    position: absolute;
    bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 1px;
    background: var(--city-primary);
    transition: width var(--transition);
}

.city-nav a:hover,
.city-nav a.active {
    opacity: 1;
    color: var(--city-primary);
    text-shadow: 0 0 10px var(--city-primary);
}

.city-nav a:hover::after,
.city-nav a.active::after { width: 100%; }

/* ================================================= */
/* MAIN LAYOUT                                       */
/* ================================================= */

.main-content {
    max-width: 1040px;
    margin: 0 auto;
    padding: 80px 30px 120px;
}

.section {
    margin-bottom: 110px;
    position: relative;
}

/* ================================================= */
/* ORNATE FRAME / LORE BLOCK                         */
/* ================================================= */

.frame {
    position: relative;
    padding: 2px;
    background: linear-gradient(145deg, color-mix(in srgb, var(--city-primary) 25%, #000), var(--city-bg-deep), color-mix(in srgb, var(--city-primary) 25%, #000));
    box-shadow:
        0 0 0 1px rgba(0,0,0,0.8),
        0 30px 80px rgba(0,0,0,0.7),
        inset 0 1px 0 rgba(255, 160, 80, 0.15);
}

.frame-inner {
    background: var(--city-bg-mid);
    padding: clamp(36px, 5vw, 70px);
    border: 1px solid rgba(from var(--city-primary) r g b / 0.08);
    position: relative;
    overflow: hidden;
}

.frame-inner::before,
.frame-inner::after {
    content: '✦';
    position: absolute;
    font-size: 12px;
    color: var(--city-primary);
    opacity: 0.4;
}
.frame-inner::before { top: 14px;    left:  18px; }
.frame-inner::after  { bottom: 14px; right: 18px; }

.lore-text {
    font-family: var(--font-lore);
    font-size: clamp(17px, 2.2vw, 19px);
    font-style: normal;
    text-align: center;
    max-width: 680px;
    margin: 0 auto;
    color: var(--city-accent);
    line-height: 1.85;
}

/* ================================================= */
/* TRAIT CARDS                                       */
/* ================================================= */

.trait-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.trait-card {
    position: relative;
    background: var(--city-bg-card);
    border: 1px solid var(--city-border);
    padding: 44px 20px 36px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    overflow: hidden;
}

.trait-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--city-glow) 0%, transparent 100%);
    opacity: 0;
    transition: var(--transition);
}

.trait-card:hover {
    border-color: var(--city-primary);
    transform: translateY(-8px);
    box-shadow: 0 16px 40px var(--city-glow), 0 0 0 1px var(--city-border);
}

.trait-card:hover::before { opacity: 1; }

.trait-card .icon-box {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 10px var(--city-primary));
    transition: filter var(--transition);
}

.trait-card:hover .icon-box {
    filter: drop-shadow(0 0 18px var(--city-primary)) drop-shadow(0 0 35px var(--city-secondary));
}

.trait-card h3 {
    font-size: 13px;
    letter-spacing: 0.38em;
    color: var(--city-accent);
    transition: color var(--transition);
}

.trait-card:hover h3 { color: var(--city-primary); }

/* ================================================= */
/* CULTURE SECTION                                   */
/* ================================================= */

.section-heading {
    text-align: center;
    margin-bottom: 50px;
}

.culture-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    border: 1px solid var(--city-border);
}

/* Parchment panel on the left */
.culture-scroll {
    background: linear-gradient(160deg, #d4b882, #b8965e);
    padding: 50px 40px;
    color: var(--city-ink);
    overflow-y: auto;
    max-height: 520px;
    scrollbar-width: thin;
    scrollbar-color: rgba(42, 26, 14, 0.4) transparent;
}

.culture-scroll h3 {
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 0.4em;
    text-align: center;
    margin-bottom: 18px;
    color: var(--city-ink);
    text-transform: uppercase;
}

.rune-glyphs {
    font-family: var(--font-lore);
    font-size: 24px;
    text-align: center;
    letter-spacing: 0.15em;
    line-height: 1.5;
    color: #3a2010;
    margin-bottom: 20px;
    word-break: break-all;
}

#society-panel-title {
    font-family: var(--font-title);
    font-size: 14px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    text-align: center;
    color: var(--city-ink);
    margin-bottom: 16px;
    min-height: 1em;
}

.culture-panel-divider {
    width: 60%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(42,26,14,0.35), transparent);
    margin: 14px auto 18px;
}

#society-panel-body p {
    font-family: var(--font-lore);
    font-style: normal;
    font-size: 16px;
    color: #4a2f18;
    line-height: 1.75;
    margin-bottom: 12px;
    text-align: left;
}

#society-panel-body ol {
    font-family: var(--font-lore);
    font-size: 16px;
    color: #4a2f18;
    line-height: 1.75;
    padding-left: 20px;
}

#society-panel-body ol li {
    margin-bottom: 10px;
}

/* Sidebar on the right */
.culture-sidebar {
    background: var(--city-bg-card);
    border-left: 1px solid var(--city-border);
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 30px;
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--city-accent);
    opacity: 0.6;
    border-bottom: 1px solid rgba(42, 17, 8, 0.6);
    transition: var(--transition);
    cursor: pointer;
}

.sidebar-link:hover {
    opacity: 1;
    color: var(--city-primary);
    background: var(--city-glow);
    padding-left: 36px;
}

.sidebar-link.active {
    opacity: 1;
    color: var(--city-accent);
    background: color-mix(in srgb, var(--city-primary) 10%, transparent);
    border-left: 2px solid var(--city-primary);
}

.sidebar-link .arrow {
    font-size: 13px;
    opacity: 0.5;
    transition: var(--transition);
}

.sidebar-link:hover .arrow { opacity: 1; transform: translateX(4px); }

/* ================================================= */
/* CHARACTERISTICS TABLE                             */
/* ================================================= */

.char-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-lore);
    font-size: 16px;
    color: #4a2f18;
    margin-top: 20px;
}

.char-table th {
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--city-ink);
    padding: 10px 14px;
    border-bottom: 2px solid rgba(42, 26, 14, 0.3);
    text-align: left;
}

.char-table td {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(42, 26, 14, 0.15);
    vertical-align: top;
    line-height: 1.6;
}

.char-table tr:last-child td {
    border-bottom: none;
}

.char-table td:first-child {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(42, 26, 14, 0.7);
    white-space: nowrap;
    padding-right: 20px;
    width: 130px;
}

/* ================================================= */
/* RANKS & LAWS GRID                                 */
/* ================================================= */

.ranks-laws-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--city-border);
}

.rl-panel {
    background: var(--city-bg-card);
    display: flex;
    flex-direction: column;
}

.rl-panel + .rl-panel {
    border-left: 1px solid var(--city-border);
}

.rl-panel-title {
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    text-align: center;
    color: var(--city-primary);
    padding: 20px;
    border-bottom: 1px solid var(--city-border);
    flex-shrink: 0;
}

.rl-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    border-bottom: 1px solid rgba(42, 17, 8, 0.7);
    cursor: pointer;
    transition: background 0.3s ease, padding-left 0.3s ease;
    position: relative;
}

.rl-row:hover {
    background: color-mix(in srgb, var(--city-primary) 6%, transparent);
    padding-left: 30px;
}

.rl-row:hover .rl-row-arrow { opacity: 1; transform: translateX(0); }

.rl-row-icon {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.rl-row:hover .rl-row-icon { opacity: 1; }
.rl-row-icon img { width: 20px; height: 20px; }

.rl-row-label {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--city-accent);
    opacity: 0.65;
    flex: 1;
    transition: opacity 0.3s ease, color 0.3s ease;
}

.rl-row:hover .rl-row-label { opacity: 1; color: var(--city-primary); }

.rl-row-stat {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 0.22em;
    color: var(--city-primary);
    border: 1px solid var(--city-border);
    padding: 3px 9px;
    opacity: 0.7;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    white-space: nowrap;
}

.rl-row:hover .rl-row-stat {
    opacity: 1;
    box-shadow: 0 0 8px var(--city-glow);
}

.rl-row-arrow {
    font-size: 14px;
    color: var(--city-primary);
    opacity: 0;
    transform: translateX(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    margin-left: 4px;
}

/* ================================================= */
/* POPUP / MODAL                                     */
/* ================================================= */

.popup {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.91);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

.popup.is-open { display: flex; }

.popup-box {
    position: relative;
    max-width: 780px;
    width: 100%;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(160deg, var(--city-bg-card), var(--city-bg-mid), var(--city-bg-card));
    box-shadow:
        0 0 0 1px var(--city-bg-deep),
        0 0 0 3px rgba(241, 215, 161, 0.22),
        0 0 0 4px var(--city-bg-mid),
        0 0 0 5px rgba(241, 215, 161, 0.06),
        0 40px 80px rgba(0, 0, 0, 0.95),
        0 0 120px var(--city-glow),
        inset 0 0 60px rgba(0, 0, 0, 0.5);
    animation: tomoOpen 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes tomoOpen {
    from { opacity: 0; transform: scale(0.94) translateY(16px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.popup-box::before,
.popup-box::after {
    content: '✦';
    position: absolute;
    font-size: 12px;
    color: rgba(241, 215, 161, 0.3);
    pointer-events: none;
    z-index: 2;
}
.popup-box::before { top: 12px;    left:  16px; }
.popup-box::after  { bottom: 12px; right: 16px; }

.popup-arch {
    flex-shrink: 0;
    text-align: center;
    padding-top: 18px;
    position: relative;
}

.popup-arch::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(241,215,161,0.12) 10%,
        rgba(241,215,161,0.55) 50%,
        rgba(241,215,161,0.12) 90%,
        transparent
    );
}

.popup-arch::after {
    content: '';
    position: absolute;
    top: 4px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(241,215,161,0.08) 20%,
        rgba(241,215,161,0.2) 50%,
        rgba(241,215,161,0.08) 80%,
        transparent
    );
}

.popup-arch-gem {
    display: inline-block;
    width: 9px; height: 9px;
    background: var(--city-accent);
    transform: rotate(45deg);
    position: relative; top: -4px;
    box-shadow: 0 0 10px var(--city-accent), 0 0 22px rgba(241, 215, 161, 0.35);
}

.popup-close {
    position: absolute;
    top: 10px; right: 14px;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px;
    color: rgba(241, 215, 161, 0.45);
    background: rgba(241, 215, 161, 0.03);
    border: 1px solid rgba(241, 215, 161, 0.14);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 5;
}

.popup-close:hover {
    color: var(--city-accent);
    border-color: rgba(241, 215, 161, 0.5);
    box-shadow: 0 0 12px rgba(241, 215, 161, 0.12);
}

.popup-header {
    flex-shrink: 0;
    padding: 14px 50px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(241, 215, 161, 0.09);
}

.popup-header h2 {
    font-size: clamp(18px, 2.8vw, 26px);
    letter-spacing: 0.2em;
    color: var(--city-accent);
    text-shadow: 0 0 22px rgba(241, 215, 161, 0.18);
    margin-bottom: 0;
}

.popup-stat-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
}

.popup-stat-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    font-family: var(--font-title);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.28em;
    color: var(--city-primary);
    border: 1px solid color-mix(in srgb, var(--city-primary) 50%, transparent);
    background: color-mix(in srgb, var(--city-primary) 7%, transparent);
    box-shadow: 0 0 10px var(--city-glow);
}

.popup-stat-badge .stat-gem { font-size: 10px; opacity: 0.7; }

.popup-subtitle {
    font-family: var(--font-lore);
    font-size: 14px;
    color: rgba(241, 215, 161, 0.45);
    letter-spacing: 0.06em;
    margin-top: 4px;
    display: block;
}

.popup-body-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 24px 50px 36px;
    scrollbar-width: thin;
    scrollbar-color: rgba(241, 215, 161, 0.2) transparent;
}

.popup-body-scroll::-webkit-scrollbar       { width: 3px; }
.popup-body-scroll::-webkit-scrollbar-track { background: transparent; }
.popup-body-scroll::-webkit-scrollbar-thumb { background: rgba(241, 215, 161, 0.25); }

.popup-body-scroll p,
#popup-body {
    font-family: var(--font-lore);
    font-style: normal;
    color: var(--city-accent);
    line-height: 1.95;
    font-size: 17px;
    margin: 0 0 14px;
}

.popup-duties-title {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: var(--city-primary);
    margin: 20px 0 14px;
    opacity: 0.85;
}

.popup-duty {
    margin-bottom: 18px;
    padding-left: 16px;
    border-left: 2px solid var(--city-border);
}

.popup-duty-name {
    font-family: var(--font-title);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--city-accent);
    margin-bottom: 6px;
    opacity: 0.85;
}

.popup-duty p { font-size: 16px; margin-bottom: 0; }

.popup-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: rgba(241, 215, 161, 0.35);
    background: transparent;
    border: 1px solid rgba(241, 215, 161, 0.1);
    cursor: pointer;
    transition: color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    z-index: 6;
    line-height: 1;
}

.popup-nav:hover {
    color: var(--city-accent);
    border-color: rgba(241, 215, 161, 0.4);
    box-shadow: 0 0 12px rgba(241, 215, 161, 0.1);
}

.popup-nav.visible { display: flex; }

.popup-nav-prev { left: -46px; }
.popup-nav-next { right: -46px; }

.popup-footer {
    flex-shrink: 0;
    text-align: center;
    padding: 4px 0 14px;
    position: relative;
}

.popup-footer::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(241,215,161,0.12) 10%,
        rgba(241,215,161,0.45) 50%,
        rgba(241,215,161,0.12) 90%,
        transparent
    );
}

.popup-footer-gem {
    display: inline-block;
    width: 7px; height: 7px;
    background: rgba(241, 215, 161, 0.35);
    transform: rotate(45deg);
    position: relative; bottom: -8px;
}

/* ================================================= */
/* BUTTONS                                           */
/* ================================================= */

.city-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 28px;
    font-family: var(--font-title);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--city-accent);
    background: transparent;
    border: 1px solid rgba(241, 215, 161, 0.4);
    cursor: pointer;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    transition: color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.city-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(105deg, transparent 40%, rgba(241,215,161,0.07) 50%, transparent 60%);
    transform: translateX(-100%);
    transition: transform 0.55s ease;
}

.city-btn::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 0; height: 1px;
    background: linear-gradient(90deg, var(--city-primary), var(--city-accent));
    transition: width 0.4s ease;
}

.city-btn:hover {
    color: #fff;
    border-color: rgba(241, 215, 161, 0.7);
    box-shadow: 0 0 20px rgba(241,215,161,0.12), inset 0 0 16px rgba(241,215,161,0.03);
    text-shadow: 0 0 14px rgba(241, 215, 161, 0.5);
}

.city-btn:hover::before { transform: translateX(100%); }
.city-btn:hover::after  { width: 100%; }

.city-btn .btn-arrow {
    font-size: 16px;
    opacity: 0.55;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.city-btn:hover .btn-arrow { transform: translateX(4px); opacity: 1; }

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 28px;
}

/* ================================================= */
/* FOOTER                                            */
/* ================================================= */

.city-footer {
    text-align: center;
    padding: 36px 20px;
    border-top: 1px solid var(--city-border);
    font-family: var(--font-title);
    font-size: 13px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    color: var(--city-accent);
    opacity: 0.35;
}

/* ================================================= */
/* SCROLL REVEAL                                     */
/* ================================================= */

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ================================================= */
/* RESPONSIVE — TABLET (≤ 768px)                     */
/* ================================================= */

@media (max-width: 768px) {

    /* --- Site nav --- */
    nav {
        gap: 16px;
        padding: 14px 16px;
        flex-wrap: wrap;
    }

    nav a { font-size: 12px; letter-spacing: 1px; }

    /* Dropdowns go static so they don't overflow off screen */
    .dropdown-content {
        position: static;
        transform: none;
        width: 100%;
        min-width: unset;
        box-shadow: none;
        border: none;
        padding: 4px 0;
    }

    /* --- City sticky nav: scrollable row instead of wrapping --- */
    .city-nav {
        gap: 18px;
        padding: 14px 16px;
        overflow-x: auto;
        flex-wrap: nowrap;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .city-nav::-webkit-scrollbar { display: none; }
    .city-nav a { font-size: 11px; letter-spacing: 0.2em; flex-shrink: 0; }

    /* --- Hero --- */
    .hero { height: 60vh; min-height: 420px; padding-top: 56px; }
    .hero-content { padding: 0 16px; }
    /* h1 already uses clamp() so scales naturally */
    .hero-tagline { font-size: 14px; }

    /* --- Main content --- */
    .main-content { padding: 50px 16px 80px; }
    .section      { margin-bottom: 70px; }

    /* --- Frame / lore block --- */
    .frame-inner { padding: 28px 18px; }

    /* --- Trait cards: 2 columns --- */
    .trait-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .trait-card { padding: 30px 14px 24px; }

    /* --- Culture layout: stack vertically --- */
    .culture-layout { grid-template-columns: 1fr; }

    .culture-scroll {
        max-height: 400px;
        padding: 32px 20px;
        /* Sidebar moves below, so remove left border */
        border-bottom: 1px solid var(--city-border);
    }

    .culture-sidebar { border-left: none; border-top: 1px solid var(--city-border); }

    /* Sidebar links: horizontal scrollable row on mobile */
    .culture-sidebar {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .culture-sidebar::-webkit-scrollbar { display: none; }

    .sidebar-link {
        flex-shrink: 0;
        border-bottom: none;
        border-right: 1px solid rgba(42, 17, 8, 0.6);
        padding: 14px 18px;
        font-size: 11px;
        letter-spacing: 0.18em;
    }

    .sidebar-link:hover { padding-left: 18px; }  /* disable indent animation on mobile */
    .sidebar-link .arrow { display: none; }

    /* --- Ranks & Laws: stack vertically --- */
    .ranks-laws-grid { grid-template-columns: 1fr; }
    .rl-panel + .rl-panel { border-left: none; border-top: 1px solid var(--city-border); }
    .rl-row { padding: 13px 14px; gap: 10px; }
    .rl-row:hover { padding-left: 20px; }

    /* --- Popup: full-screen on mobile --- */
    .popup { padding: 0; align-items: flex-end; }

    .popup-box {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        animation: popupSlideUp 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    }

    @keyframes popupSlideUp {
        from { transform: translateY(100%); opacity: 0.6; }
        to   { transform: translateY(0);    opacity: 1;   }
    }

    .popup-header      { padding: 14px 20px 16px; }
    .popup-body-scroll { padding: 18px 20px 28px; }

    /* Nav arrows move inside popup at bottom */
    .popup-nav-prev { left: 8px;  top: auto; bottom: 16px; transform: none; }
    .popup-nav-next { right: 8px; top: auto; bottom: 16px; transform: none; }

    /* --- Buttons --- */
    .btn-row { flex-direction: column; align-items: center; }
    .city-btn { width: 100%; max-width: 320px; justify-content: center; }
}

/* ================================================= */
/* RESPONSIVE — SMALL PHONE (≤ 480px)               */
/* ================================================= */

@media (max-width: 480px) {

    /* Single-column trait cards */
    .trait-grid { grid-template-columns: 1fr; }

    /* Tighten up rows */
    .rl-row-label { letter-spacing: 0.14em; font-size: 11px; }
    .rl-row-stat  { font-size: 11px; padding: 2px 7px; }

    /* Reduce rune glyph size so it doesn't overflow */
    .rune-glyphs { font-size: 18px; }

    /* Popup body text a touch smaller */
    .popup-body-scroll p,
    #popup-body { font-size: 15px; }

    .popup-duty p { font-size: 14px; }
}