/* 
 * base.css
 * Grundlegende Stile, Reset, Accessibility, Basiselemente
 */

/* Grundlegendes Styling und Reset */
*, *:before, *:after {
    box-sizing: inherit;
    margin: 0;
    padding: 0;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles */
:focus-visible {
    outline: 3px solid var(--reaction-focus-ring, var(--color-text-primary));
    outline-offset: 3px;
    border-radius: 18px;
}

/* Base Styles */
html {
    font-size: 16px;
    box-sizing: border-box;
    background: var(--color-page-surface, #f2f5f6);
    scroll-behavior: smooth;
    /* Verhindert iOS Text-Inflation (z.B. nach Orientation-Wechsel) */
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    /* height: 100% entfernt, damit der Body die Höhe bestimmen kann */
}

body {
    font-family: var(--font-primary);
    color: var(--color-text-primary);
    background: var(--color-page-surface, #f2f5f6);
    min-height: 100vh; /* Mindesthöhe statt fester Höhe */
    width: 100%;
    margin: 0;
    padding-top: 0; /* Top-Offset wird zentral in .app-container gehandhabt */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
    overflow-x: hidden; /* Nur horizontales Scrollen verhindern */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation; /* Improves touch responsiveness */
    transition: none;
    position: relative;
    box-sizing: border-box; /* Padding in Höhe einbeziehen */
}

html.dark-mode body,
body.dark-mode,
body.dark-theme {
    background:
        radial-gradient(44% 58% at 8% 0%, var(--home-surface-petrol, rgba(12, 74, 88, 0.44)) 0%, rgba(12, 74, 88, 0) 72%),
        radial-gradient(46% 62% at 92% 2%, var(--home-surface-orange, rgba(201, 123, 61, 0.36)) 0%, rgba(201, 123, 61, 0) 74%),
        radial-gradient(72% 72% at 50% 42%, var(--home-surface-highlight, rgba(255, 255, 255, 0.42)) 0%, rgba(255, 255, 255, 0) 100%),
        linear-gradient(180deg, var(--home-surface-top-sheen, rgba(255, 255, 255, 0.56)) 0%, var(--home-surface-bottom-shadow, rgba(0, 0, 0, 0.03)) 100%),
        var(--home-surface-base, var(--color-bg-primary));
}

html.dark-mode {
    background:
        radial-gradient(44% 58% at 8% 0%, var(--home-surface-petrol, rgba(12, 74, 88, 0.44)) 0%, rgba(12, 74, 88, 0) 72%),
        radial-gradient(46% 62% at 92% 2%, var(--home-surface-orange, rgba(201, 123, 61, 0.36)) 0%, rgba(201, 123, 61, 0) 74%),
        radial-gradient(72% 72% at 50% 42%, var(--home-surface-highlight, rgba(255, 255, 255, 0.42)) 0%, rgba(255, 255, 255, 0) 100%),
        linear-gradient(180deg, var(--home-surface-top-sheen, rgba(255, 255, 255, 0.56)) 0%, var(--home-surface-bottom-shadow, rgba(0, 0, 0, 0.03)) 100%),
        var(--home-surface-base, var(--color-bg-primary));
}

body.loaded {
    transition: background-color var(--transition-speed) var(--animation-curve),
                background-image var(--transition-speed) var(--animation-curve),
                color var(--transition-speed) var(--animation-curve);
}

/* In der iOS App übernimmt der fixierte Eingabebereich die Safe-Area unten. */
body.ios-app,
html[data-app*="NachrichtenJetzt-"] body {
    padding-bottom: 0; /* verhindert sichtbaren Zusatzabstand unter dem Input */
}

@media (max-width: 768px) {
    body {
        padding-top: 0;
        overscroll-behavior-y: none;
    }
}

/* Topbar-Offset wird jetzt von app-container gehandhabt */

/* Typografie */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-primary);
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2rem;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 1.5rem;
}

p {
    line-height: 1.6;
    margin-bottom: var(--spacing-sm);
    color: var(--color-text-secondary);
}

a {
    color: var(--color-accent-primary-text, var(--color-accent-primary));
    text-decoration: none;
    transition: color var(--transition-speed-fast) var(--animation-curve);
}

a:hover {
    color: var(--color-accent-secondary);
}

button {
    font-family: var(--font-primary);
    border: none;
    background: none;
    cursor: pointer;
}

ul, ol {
    list-style-position: inside;
    margin-bottom: var(--spacing-sm);
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-sm {
    gap: var(--spacing-sm);
}

.gap-md {
    gap: var(--spacing-md);
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}
