/* 
   TOKI - Araudiak Base Stylesheet
   Cohesive reading experience for board game rulebooks.
   Optimized for mobile (QR code scans) and desktop.
*/

:root {
    /* TOKI default colors - overridden by each game */
    --primary-color: #B21A27;
    --primary-color-dark: #8a1420;
    --primary-color-light: rgba(178, 26, 39, 0.08);
    
    --bg-color: #FFFFFF;
    --bg-darker: #F9F9F9;
    --text-color: #1A1A1A;
    --text-muted: #555555;
    
    --border-color: rgba(0, 0, 0, 0.08);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Atkinson Hyperlegible', sans-serif;
    
    --container-width: 680px;
    --transition: all 0.25s ease;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    line-height: 1.75;
    color: var(--text-color);
    background-color: var(--bg-color);
    -webkit-font-smoothing: antialiased;
    padding-bottom: 60px; /* Space for bottom navigation on mobile */
}

/* Skip link to content */
.skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background-color: var(--primary-color);
    color: #FFF;
    padding: 10px 20px;
    z-index: 2000;
    font-weight: 700;
    border-radius: 0 0 5px 5px;
    transition: top 0.2s ease;
    text-decoration: none;
}

.skip-link:focus-visible {
    top: 0;
    outline: 3px solid var(--primary-color-dark);
}

/* Layout */
.header-bar {
    background-color: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.9);
}

.header-content {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.back-to-toki {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    transition: var(--transition);
}

.back-to-toki:hover {
    color: var(--primary-color);
}

.back-to-toki svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform var(--transition);
}

.back-to-toki:hover svg {
    transform: translateX(-4px);
}

/* Game Title / Hero section */
.game-hero {
    background-color: var(--bg-darker);
    padding: 40px 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.game-hero-content {
    max-width: var(--container-width);
    margin: 0 auto;
}

.game-badge {
    display: inline-block;
    background-color: var(--primary-color-light);
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 50px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.game-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.meta-item svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Main Content Area */
.main-container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 30px 20px;
}

/* Table of Contents (TOC) / Aurkibidea */
.toc-box {
    background-color: var(--bg-darker);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 35px;
}

.toc-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 12px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.toc-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.toc-list a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.95rem;
    display: block;
    padding: 4px 0;
    transition: var(--transition);
}

.toc-list a:hover {
    color: var(--primary-color);
    padding-left: 4px;
}

@media (min-width: 480px) {
    .toc-list {
        grid-template-columns: 1fr 1fr;
        gap: 8px 20px;
    }
}

/* Typography elements */
h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-top: 40px;
    margin-bottom: 16px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary-color-light);
    scroll-margin-top: 80px; /* Offset for sticky header */
}

h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    color: var(--text-color);
    margin-top: 24px;
    margin-bottom: 10px;
    scroll-margin-top: 80px;
}

p {
    margin-bottom: 16px;
    font-size: 1.05rem;
    color: var(--text-color);
}

/* Rule lists */
.rule-list {
    list-style: none;
    margin-bottom: 20px;
    counter-reset: step-counter;
}

.rule-list > li {
    position: relative;
    padding-left: 32px;
    margin-bottom: 12px;
    font-size: 1.05rem;
}

.rule-list > li::before {
    content: counter(step-counter);
    counter-increment: step-counter;
    position: absolute;
    left: 0;
    top: 2px;
    width: 22px;
    height: 22px;
    background-color: var(--primary-color);
    color: #FFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
}

/* Bullets */
.bullet-list {
    list-style-type: none;
    margin-bottom: 20px;
}

.bullet-list > li {
    position: relative;
    padding-left: 20px;
    margin-bottom: 8px;
    font-size: 1.05rem;
}

.bullet-list > li::before {
    content: "•";
    color: var(--primary-color);
    font-size: 1.4rem;
    position: absolute;
    left: 4px;
    top: -3px;
}

/* Highlight boxes / Cajas de información */
.info-box {
    background-color: var(--bg-darker);
    border-left: 4px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin: 24px 0;
    font-size: 0.95rem;
}

.info-box p:last-child {
    margin-bottom: 0;
}

.info-box-title {
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    color: var(--primary-color);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Setup/Preparación grid */
.setup-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin: 20px 0;
}

@media(min-width: 600px) {
    .setup-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.setup-card {
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    box-shadow: var(--card-shadow);
}

.setup-card-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 8px;
    color: var(--primary-color);
}

/* Back to top float button (highly useful for mobile reading) */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--primary-color);
    color: #FFF;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    transform: translateY(-4px);
    background-color: var(--primary-color-dark);
}

.back-to-top svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Game image or illustration within rules */
.rules-img-container {
    margin: 25px 0;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

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

.rules-img-caption {
    background-color: var(--bg-darker);
    padding: 10px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
}

/* Footer styling */
.rules-footer {
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: var(--bg-darker);
    margin-top: 60px;
}

.rules-footer p {
    margin-bottom: 8px;
}

/* TOKI Logo integrations */
.header-logo {
    height: 30px;
    width: auto;
    display: block;
    transition: transform var(--transition);
}

.back-to-toki:hover .header-logo {
    transform: scale(1.05);
}

.footer-logo {
    height: 45px;
    width: auto;
    display: block;
    margin: 0 auto 12px;
    opacity: 0.85;
    transition: opacity var(--transition);
}

.footer-logo:hover {
    opacity: 1;
}

