/* =============================================================
   Martial Arts Curriculum App — Main Stylesheet
   curriculum/static/curriculum/css/curriculum.css
   ============================================================= */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;600;700&family=Barlow+Condensed:wght@600;700&display=swap');

/* --- CSS Variables (Light Mode) --- */
:root {
    --bg: #ddddd8;
    --surface: #ffffff;
    --nav-bg: #1c1c1c;
    --nav-text: #ffffff;
    --text: #1e1e1e;
    --text-muted: #666666;
    --border: #e0e0e0;
    --card-bg: #f7f7f5;
    --card-border: #e4e4e0;
    --category-header-bg: #efefec;
    --category-header-text: #1e1e1e;
    --belt-header-bg: #ffffff;
    --belt-header-text: #1e1e1e;
    --belt-header-border: #e0e0e0;
    --toggle-bg: #f0f0f0;
    --toggle-hover: #e4e4e4;
    --toggle-border: #d8d8d8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.10);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.13);
    --radius: 6px;
    --tile-height: 80px;
    --font-ui: 'Barlow', Arial, sans-serif;
    --font-heading: 'Barlow Condensed', Arial, sans-serif;
}

/* --- Dark Mode Variables --- */
body.dark-mode {
    --bg: #181818;
    --surface: #242424;
    --nav-bg: #111111;
    --nav-text: #ffffff;
    --text: #e8e8e8;
    --text-muted: #999999;
    --border: #383838;
    --card-bg: #2c2c2c;
    --card-border: #383838;
    --category-header-bg: #2e2e2e;
    --category-header-text: #e8e8e8;
    --belt-header-bg: #242424;
    --belt-header-text: #e8e8e8;
    --belt-header-border: #383838;
    --toggle-bg: #333333;
    --toggle-hover: #3c3c3c;
    --toggle-border: #484848;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.5);
}

/* --- Base --- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-ui);
    max-width: 1080px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg);
    color: var(--text);
    transition: background 0.2s, color 0.2s;
    font-size: 15px;
    line-height: 1.5;
}

/* --- Nav --- */
nav {
    background: var(--nav-bg);
    color: var(--nav-text);
    padding: 12px 20px;
    margin-bottom: 28px;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-md);
}

nav a {
    color: var(--nav-text);
    text-decoration: none;
    margin-left: 20px;
    font-size: 0.9em;
    opacity: 0.85;
    transition: opacity 0.15s;
}

nav a:hover { opacity: 1; }

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-heading);
    font-size: 1.15em;
    letter-spacing: 0.03em;
}

.nav-brand img {
    height: 38px;
    width: auto;
    border-radius: 4px;
}

.nav-links {
    display: flex;
    align-items: center;
}

/* --- Dark Mode Toggle --- */
.dark-toggle {
    background: none;
    border: 1px solid rgba(255,255,255,0.25);
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.82em;
    margin-left: 18px;
    transition: background 0.15s;
}

.dark-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* --- Alerts --- */
.alert {
    padding: 11px 18px;
    margin-bottom: 10px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.92em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-info    { background: #2471a3; color: white; }
.alert-warning { background: #d68910; color: white; }
.alert-urgent  { background: #b03a2e; color: white; }

/* --- General Card --- */
.card {
    background: var(--surface);
    padding: 20px;
    margin-bottom: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}

/* ============================================================
   BELT SECTION HEADER
   — neutral surface, parallelogram slash accent in belt color
   ============================================================ */
.belt-header {
    display: flex;
    align-items: center;
    background: var(--belt-header-bg);
    border: 1px solid var(--belt-header-border);
    border-radius: var(--radius);
    margin: 28px 0 14px;
    padding: 0 18px 0 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    position: relative;
    min-height: 48px;
}

.belt-slash {
    /* Parallelogram slash — belt color accent */
    width: 36px;
    min-width: 36px;
    align-self: stretch;
    margin-right: 16px;
    position: relative;
    flex-shrink: 0;
}

.belt-slash::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--slash-color, #888);
    clip-path: polygon(0 0, 75% 0, 100% 100%, 0 100%);
}

.belt-slash::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    clip-path: polygon(72% 0, 78% 0, 103% 100%, 97% 100%);
}

.belt-header-name {
    font-family: var(--font-heading);
    font-size: 1.25em;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--belt-header-text);
    text-transform: uppercase;
    padding: 12px 0;
}

/* ============================================================
   CATEGORY SECTION
   — neutral header with thick left border accent
   ============================================================ */
.category-section {
    margin-bottom: 28px;
}

.category-header {
    display: flex;
    align-items: center;
    background: var(--category-header-bg);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 9px 16px;
    border-left: 5px solid var(--cat-color, #aaaaaa);
    border-bottom: 1px solid var(--border);
}

.category-header-name {
    font-family: var(--font-heading);
    font-size: 1.05em;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--category-header-text);
    text-transform: uppercase;
}

/* ============================================================
   CONTENT TILE GRID
   ============================================================ */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* --- Individual Tile --- */
.content-tile {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 5px;
    height: var(--tile-height);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 10px 12px;
    text-align: center;
    transition: box-shadow 0.18s, transform 0.18s, background 0.15s;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.content-tile:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    background: var(--surface);
}

.content-tile .tile-icon {
    font-size: 1.3em;
    margin-bottom: 5px;
    opacity: 0.6;
    line-height: 1;
}

.content-tile .tile-title {
    font-size: 0.82em;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* --- Expanded Tile --- */
.content-tile.expanded {
    height: auto;
    min-height: var(--tile-height);
    grid-column: 1 / -1;   /* spans full row width */
    cursor: default;
    align-items: flex-start;
    text-align: left;
    padding: 16px;
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    border-color: var(--border);
    transform: none;
    z-index: 2;
}

.content-tile.expanded .tile-icon {
    display: none;
}

.content-tile.expanded .tile-title {
    font-size: 1em;
    font-weight: 700;
    margin-bottom: 10px;
    -webkit-line-clamp: unset;
    color: var(--text);
}

/* Close button inside expanded tile */
.tile-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.1em;
    cursor: pointer;
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1;
    transition: background 0.15s;
}

.tile-close:hover {
    background: var(--toggle-bg);
}

/* --- Tile Content Body (shown when expanded) --- */
.tile-body {
    display: none;
    width: 100%;
}

.content-tile.expanded .tile-body {
    display: block;
}

/* Content block types inside expanded tile */
.block-text {
    white-space: pre-wrap;
    font-size: 0.92em;
    color: var(--text);
    line-height: 1.6;
    margin-bottom: 10px;
}

.block-image img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 10px;
}

.block-video {
    margin-bottom: 10px;
}

.video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 4px;
}

.video-embed iframe,
.video-embed video {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}

.block-doc a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--toggle-bg);
    border: 1px solid var(--toggle-border);
    border-radius: 4px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.88em;
    font-weight: 600;
    margin-bottom: 8px;
    transition: background 0.15s;
}

.block-doc a:hover {
    background: var(--toggle-hover);
}

.item-description {
    font-size: 0.88em;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}

.tile-close {
    display: none;
}

.content-tile.expanded .tile-close {
    display: block;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .tile-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .belt-header-name {
        font-size: 1.1em;
    }
}

@media (max-width: 400px) {
    .tile-grid {
        grid-template-columns: 1fr;
    }
}
