/* ============================================
   YLI-STYLE.CSS — Shared styles for sakisboudouridis.gr/yli/
   Luxury Dark Palette: Navy / Gold / Teal
   ============================================ */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,600;0,700;1,400;1,600&family=DM+Sans:wght@400;500;600;700&display=swap');

/* Variables */
:root {
    --navy-deep: #0f1a2b;
    --navy: #1A293E;
    --navy-light: #243650;
    --gold: #C8B59B;
    --gold-light: #d8cbb5;
    --gold-dim: rgba(200,181,155,0.15);
    --teal: #006d77;
    --teal-light: #83c5be;
    --txt: #f0ede8;
    --muted: #8a9ab5;
    --border: rgba(200,181,155,0.08);
    --success: #4ade80;
    --error: #f87171;
    --warning: #fbbf24;
}

/* ---- Chapter Page Layout ---- */
.yli-chapter {
    padding-top: 100px;
    min-height: 100vh;
    background: var(--navy-deep);
    font-family: 'DM Sans', sans-serif;
    color: var(--txt);
}

.chapter-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 5%;
}

@media (min-width: 1200px) {
    .chapter-container { max-width: 1100px; }
}

/* ---- Breadcrumb ---- */
.yli-breadcrumb {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 40px;
    flex-wrap: wrap;
    padding: 12px 25px;
    background: var(--navy);
    border-radius: 50px;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    border: 1px solid var(--border);
}

.yli-breadcrumb a,
.yli-breadcrumb span {
    font-size: 0.85rem;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.3s;
}

.yli-breadcrumb a:hover { color: var(--gold); }
.yli-breadcrumb .sep { color: var(--teal-light); }

/* ---- Chapter Header ---- */
.chapter-header {
    text-align: center;
    margin-bottom: 50px;
    padding: 35px;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    border-radius: 16px;
    border: 1px solid var(--border);
}

.chapter-header .label {
    display: inline-block;
    color: var(--teal-light);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

.chapter-header h1 {
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    color: var(--txt);
    margin: 0 0 10px;
}

.chapter-header h1 em {
    color: var(--gold);
    font-style: italic;
}

.chapter-header p {
    color: var(--muted);
    font-size: 1rem;
    margin: 0;
}

/* ---- Theory Section ---- */
.theory-section {
    background: var(--navy);
    border-radius: 14px;
    padding: 30px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
}

.theory-section h2 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    color: var(--teal-light);
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(131,197,190,0.15);
}

.theory-section h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.2rem;
    color: var(--gold);
    margin: 20px 0 10px;
}

.theory-section p,
.theory-section li {
    color: rgba(240,237,232,0.85);
    line-height: 1.7;
}

.theory-section ul,
.theory-section ol {
    padding-left: 1.5em;
    margin: 10px 0;
}

.theory-section li { margin-bottom: 6px; }

.theory-section strong {
    color: var(--gold-light);
}

/* ---- Theorem Box ---- */
.theorem-box {
    background: linear-gradient(135deg, rgba(0,109,119,0.15), rgba(0,109,119,0.05));
    border: 1px solid rgba(0,109,119,0.3);
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
}

.theorem-box p {
    margin: 5px 0;
}

/* ---- Proof Box ---- */
.proof-box {
    background: rgba(200,181,155,0.05);
    border-left: 3px solid var(--gold);
    border-radius: 0 10px 10px 0;
    padding: 18px 20px;
    margin: 15px 0;
}

.proof-box .proof-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: 8px;
}

/* ---- Formula Box ---- */
.formula-box {
    background: rgba(0,109,119,0.08);
    border: 2px solid rgba(0,109,119,0.25);
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
    text-align: center;
}

.formula-box .formula {
    font-size: 1.2em;
    color: var(--teal-light);
    font-weight: 600;
}

/* ---- Definition Box ---- */
.definition-box {
    background: linear-gradient(135deg, rgba(0,109,119,0.1), rgba(0,109,119,0.03));
    border: 1px solid rgba(0,109,119,0.2);
    border-radius: 10px;
    padding: 18px;
    margin: 12px 0;
}

.definition-box h3 {
    font-family: 'Cormorant Garamond', serif;
    color: var(--teal-light);
    margin: 0 0 8px;
    font-size: 1.1rem;
}

/* ---- Example Box ---- */
.example-box {
    background: rgba(200,181,155,0.05);
    border-left: 3px solid var(--teal);
    border-radius: 0 8px 8px 0;
    padding: 15px 18px;
    margin: 12px 0;
}

.example-box h4 {
    color: var(--teal-light);
    margin: 0 0 8px;
    font-size: 0.95rem;
}

/* ---- Property Grid ---- */
.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin: 15px 0;
}

.property-item {
    background: var(--navy-light);
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    border: 1px solid var(--border);
}

.property-item h4 {
    color: var(--gold);
    margin: 0 0 8px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
}

.property-item p {
    margin: 0;
    color: var(--txt);
}

/* ---- Exercise Card ---- */
.exercise-card {
    background: var(--navy);
    border-radius: 12px;
    padding: 22px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    transition: border-color 0.3s;
}

.exercise-card:hover {
    border-color: rgba(200,181,155,0.2);
}

.exercise-card .exercise-label {
    color: var(--teal-light);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.exercise-card p {
    color: rgba(240,237,232,0.85);
    line-height: 1.6;
}

/* ---- Collapsible Solution ---- */
.exercise-card details {
    background: var(--navy-deep);
    border-left: 3px solid var(--teal);
    border-radius: 0 8px 8px 0;
    padding: 14px 18px;
    margin-top: 12px;
}

.exercise-card details summary {
    cursor: pointer;
    color: var(--teal-light);
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.2s;
    user-select: none;
}

.exercise-card details summary:hover {
    color: var(--gold);
}

.exercise-card details[open] summary {
    color: var(--teal-light);
    margin-bottom: 10px;
}

.exercise-card details[open] summary::after { content: ' ▲'; font-size: 0.7em; }
.exercise-card details:not([open]) summary::after { content: ' ▼'; font-size: 0.7em; }

.exercise-card details .solution-content {
    color: rgba(240,237,232,0.8);
}

.exercise-card details .solution-content p {
    margin: 4px 0;
}

/* ---- Exercises Section Header ---- */
.exercises-header {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.6rem;
    color: var(--gold);
    margin: 40px 0 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(200,181,155,0.15);
}

/* ---- Tables ---- */
.yli-chapter table {
    border-collapse: collapse;
    margin: 15px 0;
    width: auto;
}

.yli-chapter th {
    background: var(--navy-light);
    color: var(--gold-light);
    font-weight: 600;
    padding: 10px 16px;
    border: 1px solid rgba(200,181,155,0.12);
    font-size: 0.9rem;
}

.yli-chapter td {
    padding: 8px 16px;
    border: 1px solid rgba(200,181,155,0.08);
    color: var(--txt);
    font-size: 0.9rem;
}

/* ---- Download Button ---- */
.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--teal), #005a63);
    color: var(--txt);
    padding: 12px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.3s, box-shadow 0.3s;
    border: none;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,109,119,0.3);
    color: var(--txt);
}

/* ---- Navigation Buttons ---- */
.chapter-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    flex-wrap: wrap;
    gap: 12px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border-radius: 8px;
    text-decoration: none;
    background: var(--navy);
    color: var(--teal-light);
    border: 1px solid rgba(0,109,119,0.3);
    font-size: 0.9rem;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: var(--teal);
    color: var(--txt);
    border-color: var(--teal);
}

/* ---- KaTeX adjustments ---- */
.yli-chapter .katex { font-size: 1.05em; }
.yli-chapter .katex-display { margin: 0.8em 0; overflow-x: auto; overflow-y: hidden; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .chapter-container { padding: 20px 4%; }
    .chapter-header { padding: 25px 20px; }
    .chapter-header h1 { font-size: 1.6rem; }
    .theory-section { padding: 20px 16px; }
    .exercise-card { padding: 16px; }
    .chapter-nav { flex-direction: column; }
    .nav-btn { justify-content: center; }
    .property-grid { grid-template-columns: repeat(2, 1fr); }
}

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

/* ---- Print ---- */
@media print {
    .yli-chapter { background: white; color: black; padding-top: 0; }
    .chapter-nav, .download-btn, .yli-breadcrumb { display: none; }
    .theory-section, .exercise-card { border: 1px solid #ccc; background: white; }
    details[open] { break-inside: avoid; }
}
