/* Story-Branch V1 MVP - Main Stylesheet */
/* Design tokens */
@import url('./colors.css');


/* Reset und Basis-Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--color-text);
    /* Subtle gradient background to match legacy look */
    background: var(--gradient-background);
    /* Layout: enable sticky footer pattern */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}



/* Container */
.container {
    width: 100%;
    max-width: 75rem;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Main should take remaining space so footer sits at bottom on short pages */
main { flex: 1 0 auto; }

/* Header */
.header {
    background: var(--backdrop-filter);
    backdrop-filter: blur(0.625rem);
    border-bottom: 0.0625rem solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm, 0 0.0625rem 0.625rem rgba(0,0,0,0.05));
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    position: relative;
}

/* ===== UNIFIED LOGO SYSTEM ===== */
/* Base Components */
.logo-icon {
    display: inline-flex;
    color: var(--color-text-secondary);
}

.logo-text {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 200;
    font-style: italic;
    letter-spacing: -0.02em;
    color: var(--color-text-secondary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.logo-text:hover {
    color: var(--color-primary);
}

/* Context Modifiers */
.logo-icon--header {
    height: 3.125rem;          /* 50px - consistent with current */
    width: auto;               /* Maintain aspect ratio */
    margin-right: 0.625rem;
}

.logo-text--header {
    font-size: 2rem;           /* 32px */
}

.logo-icon--hero {
    height: 10rem;             /* 160px converted to rem */
    width: auto;               /* Maintain aspect ratio */
    margin-bottom: 0.5rem;     /* Reduced spacing to bring text closer */
}

.logo-text--hero {
    font-size: 3.5rem;         /* 56px - much bigger for hero */
    text-align: center;
    margin-bottom: 1rem;
}

/* Size variants */
.logo-text--small { font-size: 1.5rem; }
.logo-text--medium { font-size: 2rem; }
.logo-text--large { font-size: 3rem; }
.logo-text--xl { font-size: 4rem; }

.logo-icon--small { height: 2rem; width: auto; }
.logo-icon--large { height: 4rem; width: auto; }
.logo-icon--xl { height: 6rem; width: auto; }

/* SVG styling for logo icons */
.logo-icon svg { 
    display: block; 
    height: 100%; 
    width: auto; 
}

/* Force inline SVG logo to use currentColor for fills */
.logo-icon svg * { 
    fill: currentColor; 
}

/* Container class for header logo links */
.header-logo-container {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

/* Hamburger (CSS-only) */
.nav-toggle { position: absolute; left: -62.5rem; opacity: 0; }
.hamburger { display: none; cursor: pointer; padding: 0.25rem; margin-left: auto; }
.hamburger span { display: block; width: 1.5rem; height: 0.125rem; background: var(--color-primary); margin: 0.3125rem 0; transition: transform 0.2s, opacity 0.2s; }

/* Animate to X when open */
.nav-toggle:checked + .hamburger span:nth-child(1) { transform: translateY(0.4375rem) rotate(45deg); }
.nav-toggle:checked + .hamburger span:nth-child(2) { opacity: 0; }
.nav-toggle:checked + .hamburger span:nth-child(3) { transform: translateY(-0.4375rem) rotate(-45deg); }

.nav-links a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 300;
    padding:  0.4rem 0.9rem 0.3rem 0.9rem;
    border-radius: 0.4rem;
    text-transform: uppercase;
    display: inline-block;
    transition: color 0.2s ease-in-out, transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    will-change: transform;
}

.nav-links a:hover {
    color: var(--color-text);
    background-color: transparent;
    transform: translateY(-0.0625rem);
    box-shadow: var(--shadow-sm);
}

.nav-links a.active {
    color: var(--color-text);
    background-color: transparent;
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Subtle pressed feedback */
.nav-links a:active { transform: translateY(-0.0625rem); }

/* Keyboard focus visibility */
.nav-links a:focus-visible {
    outline: 0.125rem solid var(--color-primary);
    outline-offset: 0.125rem;
}




/* Header hamburger breakpoint at <= 1024px */
@media (max-width: 1024px) {
    .nav { flex-direction: row; align-items: center; }
    .logo { margin-right: auto; }
    .hamburger { display: inline-block; }
    .nav-links {
        gap: 1rem;
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
        padding: 0.75rem 1rem 1rem 1rem;
        flex-direction: column;
    }
    .nav-toggle:checked + .hamburger + .nav-links { display: flex; }
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-text-on-primary);
}

.btn-primary:hover {
    background-color: var(--color-primary);
}

.btn-secondary {
    background-color: var(--neutral);
    color: var(--text-on-neutral);
}

.btn-secondary:hover {
    background-color: var(--neutral-dark);
}

.btn-outline {
    background-color: transparent;
    color: var(--color-primary);
    border: 0.0625rem solid var(--color-primary);
}

.btn-outline:hover {
    background-color: var(--color-primary);
    color: var(--color-text-on-primary);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1rem;
}

/* Ensure consistent font inheritance for form controls across browsers (e.g., Chrome) */
input, textarea, select, button { font: inherit; }

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--color-text);
}

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 0.0625rem solid var(--color-border);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.1875rem var(--focus-ring);
}

.form-textarea {
    min-height: 7.5rem;
    resize: vertical;
}

/* ===== CARDS ===== */
.card {
    background: var(--color-bg, #ffffff);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: none;
}

.interactive-card {
    background: var(--color-bg, #ffffff);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-card);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none;
    color: inherit;
    display: block;
}

.interactive-card:hover {
    transform: translateY(-0.125rem);
    box-shadow: var(--shadow-card-hover);
    text-decoration: none;
    color: inherit;
}

/* ===== TYPOGRAPHY (Unified) ===== */
/* Base text color for all elements */
p, span, div, li { color: var(--color-text); }

/* Global headings: consistent weights, fixed sizes */
h1 { font-weight: 320; font-size: 2rem; line-height: 1.2; color: var(--color-text); margin-bottom: 0.75rem; }
h2 { font-weight: 380; font-size: 1.75rem; line-height: 1.3; color: var(--color-text); margin-bottom: 0.5rem; }
h3 { font-weight: 440; font-size: 1.5rem; line-height: 1.3; color: var(--color-text); margin-bottom: 0.5rem; }
h4 { font-weight: 500; font-size: 1.25rem; line-height: 1.4; color: var(--color-text); margin-bottom: 0.375rem; }


/* Lead paragraph */
.lead { font-weight: 300; font-size: 1.125rem; line-height: 1.8; }

/* Small text and secondary color utility */
/* Text size modifiers */
.text-xs { font-size: 0.75rem; line-height: 1.5; }
.text-sm { font-size: 0.875rem; line-height: 1.5; }
.text-lg { font-size: 1.125rem; line-height: 1.6; }
.text-xl { font-size: 1.25rem; line-height: 1.6; }

/* Text color modifiers */
.text-secondary { color: var(--color-text-secondary); }

/* Overline/Eyebrow */
.eyebrow { font-size: 0.75rem; line-height: 1.4; font-weight: 400; color: var(--color-text-secondary); text-transform: none; letter-spacing: 0; }

/* Prose wrapper: reading typography and vertical rhythm */
.prose { font-size: 1.125rem; line-height: 1.8; }
.prose > * + * { margin-top: 1rem; }
.prose h1 { margin-top: 0; margin-bottom: 1.25rem; }
.prose h2 { margin-top: 2rem; margin-bottom: 1rem; }
.prose h3 { margin-top: 1.5rem; margin-bottom: 0.75rem; }
.prose h4 { margin-top: 1rem; margin-bottom: 0.5rem; }
.prose p, .prose li { font-weight: 400; }

.section-header {
    border-bottom: 0.0625rem solid var(--color-border, #e2e8f0);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: var(--success-bg, #d1fae5);
    color: var(--success-text, #065f46);
    border: 0.0625rem solid var(--success-border, #a7f3d0);
}

.alert-error {
    background-color: var(--error-bg, #fee2e2);
    color: var(--error-text, #991b1b);
    border: 0.0625rem solid var(--error-border, #fecaca);
}

.alert-warning {
    background-color: var(--warning-bg, #fef3c7);
    color: var(--warning-text, #92400e);
    border: 0.0625rem solid var(--warning-border, #fde68a);
}

.alert-info {
    background-color: var(--info-bg, #dbeafe);
    color: var(--info-text, #1e40af);
    border: 0.0625rem solid var(--info-border, #bfdbfe);
}

.story-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--color-text-secondary, #6b7280);
    margin-top: 0.5rem;
}

.status-completed {
    color: var(--success-text, #059669);
    font-weight: 500;
}

.status-open {
    color: var(--warning-text, #d97706);
    font-weight: 500;
}


/* Tile navigation (horizontal) */
.tile-nav {
    position: relative;
}
.tile-track {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.25rem;
    scrollbar-width: none; /* Firefox */
}
.tile-track::-webkit-scrollbar { display: none; } /* WebKit */
.tile {
    min-width: 11.25rem;
    max-width: 15rem;
    background: var(--color-bg);
    border: 0.0625rem solid var(--color-border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-decoration: none;
    color: var(--color-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    scroll-snap-align: start;
}
.tile { position: relative; }
.tile-badge {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.25rem 0.5rem;
  font-weight: 600;
    color: var(--color-text);
    border-right: 0.0625rem solid var(--color-border); /* nur rechts und unten Rahmen, damit kein doppelter Rand zum Tile */
    border-bottom: 0.0625rem solid var(--color-border);
  border-top: 0;
  border-left: 0;
  border-bottom-right-radius: 0.375rem;
  background: transparent;
  line-height: 1;
}
.tile-body { 
    padding-top: 1.25rem; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    min-height: 3rem;
}
.tile:hover {
    border-color: var(--color-primary);
    box-shadow: 0 0.125rem 0.375rem var(--tile-shadow);
}
.tile--current { background: var(--tile-current-bg, #eff6ff); border-color: var(--tile-current-border, #93c5fd); }
.tile--level { background: var(--color-bg-alt); }
.tile small { color: var(--color-text-secondary); }
.tile-meta { font-size: 0.75rem; color: var(--color-text-secondary); margin-top: 0.25rem; display:block; }

.tile-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0.0625rem solid var(--color-border);
    background: var(--color-bg);
    border-radius: 999px;
    width: 2rem; height: 2rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    z-index: 20; /* Higher than popover (z-index: 10) */
}
.tile-arrow--left { left: -0.375rem; }
.tile-arrow--right { right: -0.375rem; }

/* Hide arrows on small screens */
@media (max-width: 768px) {
  .tile-arrow { display: none; }
}

/* Popover for tile chapter list */
.tile-popover {
  position: absolute;
  top: 92%; /* Fixed value instead of calc() for Safari compatibility */
  left: 1rem; /* Padding from left edge */
  right: 1rem; /* Padding from right edge */
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: none; /* No shadow since it looks like an extension */
  padding: 1rem;
  margin-top: 0;
  z-index: 10;
  max-height: 50vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

/* Wenn Popover offen ist: untere Rundungen der Navigationsleiste neutralisieren, damit nahtloser Übergang entsteht */
.tile-popover.hidden { display: none; }
.tile-popover .chapter-link { display: block; padding: 0.5rem; border-radius: 0.375rem; text-decoration: none; color: var(--color-text); }
.tile-popover .chapter-link:hover { background: var(--color-bg-alt, #f3f4f6); }
.chapter-link--current { background: var(--tile-current-bg, #eff6ff); border: 0.0625rem solid var(--tile-current-border, #93c5fd); }
.chapter-link--parent { color: var(--color-text); }
.chapter-link--muted { opacity: 0.6; }

.chapter-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Chapter choice styling removed - now using cards */

/* ===== CARD VARIANTS ===== */
.card-cta { 
    background: var(--gradient-cta);
}
.card-cta h1, .card-cta h2, .card-cta h3, .card-cta h4 { color: var(--success-text, #065f46); }

/* Chapter choice CTA styling removed - now using card-cta */

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18.75rem, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.hero-grid { gap: 2rem; }

/* Hero pictogram styling */
.hero-pictogram-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.pictogram {
    margin-bottom: 1.5rem;
    width: auto;
    height: 72px;
}
.w-full { width: 100%; }
.btn-block { width: 100%; display: block; }
.card-narrow { max-width: 25rem; margin: 0 auto; }
.site-footer {
    background: var(--footer-bg);
    border-top: 0.0625rem solid var(--color-border);
    color: var(--color-text-on-primary);
}
.site-footer p { color: var(--color-text-on-primary); }
.site-footer a { color: var(--color-text-on-primary); text-decoration: none; opacity: 0.9; }
.site-footer a:hover { opacity: 1; }
.site-footer a:visited { color: var(--color-text-on-primary); }

.prose { line-height: 1.8; font-size: 1.125rem; }
/* Notice styles removed - using simple text/cards instead */
.list-disc { list-style: disc; margin-left: 1rem; }

/* ===== FEEDBACK & NOTIFICATIONS ===== */
.field-error { color: var(--error-text); font-size: 0.875rem; margin-top: 0.25rem; }


.fade-out { opacity: 0; transition: opacity 0.3s; }

@keyframes slideIn { from { transform: translateX(100%); opacity:0; } to { transform: translateX(0); opacity:1; } }
@keyframes slideOut { from { transform: translateX(0); opacity:1; } to { transform: translateX(100%); opacity:0; } }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-4 { padding: 1rem; }
.p-8 { padding: 2rem; }

.pt-4 { padding-top: 1rem; }
.pt-8 { padding-top: 2rem; }
.pt-12 { padding-top: 3rem; }
.pt-20 { padding-top: 5rem; }

.pb-4 { padding-bottom: 1rem; }
.pb-8 { padding-bottom: 2rem; }
.pb-12 { padding-bottom: 3rem; }
.pb-20 { padding-bottom: 5rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

.hidden { display: none; }
.block { display: block; }

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
        padding: 0.75rem 1rem 1rem 1rem;
        flex-direction: column;
    }

    .hamburger { display: inline-block; }
    /* Keep header content in one row: logo left, hamburger right */
    .nav { flex-direction: row; align-items: center; }
    .logo { margin-right: auto; }
    /* When checkbox is checked, show menu (label is immediately after input) */
    .nav-toggle:checked + .hamburger + .nav-links { display: flex; }
    
    .story-meta {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .container {
        padding: 0 0.5rem;
    }
}

/* Additional grid breakpoints for story cards */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Mobile responsive for 3-column grid */
@media (max-width: 768px) {
    .grid-3 { grid-template-columns: 1fr; }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.spinner {
    border: 0.125rem solid var(--color-bg-alt);
    border-top: 0.125rem solid var(--color-primary);
    border-radius: 50%;
    width: 1.25rem;
    height: 1.25rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== Reusable Section System ===== */

/* Base section classes */

/* Background utility classes */
.bg-white {
    background: var(--color-bg);
}


.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.ideas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.phase-section { margin-bottom: 3rem; }
.phase-title { margin-bottom: 1.5rem; color: var(--color-text); text-align: center; }

.roadmap-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr));
    gap: 1rem;
}

.roadmap-item {
    background: var(--color-bg);
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: var(--shadow-md);
    border: 0.0625rem solid var(--color-border);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    min-height: 7.5rem;
}

.roadmap-checkbox {
    font-size: 1.5rem;
    color: var(--roadmap-checkbox-default);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
}

.roadmap-checkbox.completed { color: var(--roadmap-checkbox-completed); }
.roadmap-content h4 { font-size: 1rem; font-weight: 600; margin-bottom: 0.25rem; color: var(--color-text); }

@media (max-width: 850px) {
    .features-grid { grid-template-columns: 1fr; }
    .ideas-grid { grid-template-columns: 1fr; }
    .roadmap-items-grid { grid-template-columns: 1fr; }
}

/* ===== Shared hero (used by about and index) ===== */
.hero {
    padding: 3rem 0 5rem;
    text-align: center;
    color: var(--color-text);
}

.hero-logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 auto 1rem;  /* Bottom margin for spacing to next content */
}

/* Hero logo now uses .logo-icon--hero class */
.hero-logo {
    display: inline-flex;
    height: 10rem;             /* 160px converted to rem */
    width: auto;               /* Maintain aspect ratio */
    position: relative;
    z-index: 2;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}
.hero-logo svg { 
    height: 100%; 
    width: auto; 
    display: block; 
}
.hero-logo svg * { 
    fill: currentColor; 
}

.hero-logo-circle {
    position: absolute;
    top: 0;
    left: 0;
    width: 10rem;              /* 160px converted to rem */
    height: 10rem;             /* 160px converted to rem */
    background: var(--color-bg);
    border-radius: 50%;
    box-shadow: 0 4px 20px var(--hero-shadow);
    z-index: 1;
}





/* Hero feature cards on index */
.hero-features {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 1000px;
    margin: 4rem auto 0 auto;
}
.hero-feature { text-align: left; padding: 0 0.5rem; }
.hero-feature p { margin: 0; color: var(--color-text-secondary); }


@media (max-width: 900px) {
    .hero-features { grid-template-columns: 1fr; }
}
