/* sasofilm — oeffentliche Seite.
   Dunkel, damit die Noir-Panels nicht gegen die Umgebung kaempfen. */

:root {
    --bg: #0b0c0f;
    --surface: #14161a;
    --surface-2: #1c1f26;
    --line: #262a34;
    --text: #eceef3;
    --muted: #8b93a5;
    --accent: #c8402f;
    --radius: 4px;
    --header-height: 60px;
    --page: min(1400px, 100% - 3rem);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3 { line-height: 1.2; }

.muted { color: var(--muted); }
.error { color: #e08076; padding: 2rem; }
.loading { color: var(--muted); padding: 4rem 1.5rem; text-align: center; }

.centered { padding: 6rem 1.5rem; text-align: center; }
.centered h1 { font-size: 4rem; margin: 0; color: var(--accent); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--accent);
    color: #fff;
    padding: .6rem 1rem;
    z-index: 100;
}
.skip-link:focus { left: 0; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* --- Kopf- und Fusszeile --------------------------------------------- */

.siteheader {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0 1.5rem;
    background: linear-gradient(180deg, rgba(11, 12, 15, .96), rgba(11, 12, 15, .72));
    backdrop-filter: blur(8px);
    border-bottom: 1px solid transparent;
}

body.reading .siteheader { border-bottom-color: var(--line); }

.brand {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: .01em;
    text-decoration: none;
    color: var(--accent);
}

.searchform { margin-left: auto; }

.searchform input {
    width: 180px;
    padding: .4rem .7rem;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text);
    font: inherit;
    font-size: .9rem;
}

.searchform input:focus { width: 240px; background: var(--surface-2); }
.searchform input { transition: width .2s; }

.langswitch { display: flex; gap: .25rem; }

.langswitch button {
    padding: .25rem .5rem;
    background: none;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--muted);
    font: inherit;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
}

.langswitch button.active { color: var(--text); border-color: var(--line); }

.sitefooter {
    padding: 3rem 1.5rem;
    color: var(--muted);
    font-size: .85rem;
    text-align: center;
}

body.reading .sitefooter { display: none; }

/* --- Schaltflaechen --------------------------------------------------- */

.button, .button-like {
    display: inline-block;
    padding: .6rem 1.4rem;
    background: rgba(255, 255, 255, .1);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    font-size: .95rem;
    font-weight: 600;
}

.button:hover, .button-like:hover { background: rgba(255, 255, 255, .16); }
.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.button.primary:hover { background: #d94b38; }

/* --- Hero ------------------------------------------------------------- */

.hero {
    position: relative;
    min-height: min(62vh, 520px);
    display: flex;
    align-items: flex-end;
    margin-top: calc(var(--header-height) * -1);
    padding: calc(var(--header-height) + 3rem) 1.5rem 3rem;
}

.hero-image { position: absolute; inset: 0; overflow: hidden; }

.hero-image img { width: 100%; height: 100%; object-fit: cover; opacity: .55; }

.hero-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--bg) 0%, rgba(11, 12, 15, .5) 55%, transparent 100%),
                linear-gradient(0deg, var(--bg) 0%, transparent 45%);
}

.hero-body { position: relative; max-width: 620px; }

.hero-kicker {
    margin: 0 0 .5rem;
    font-size: .8rem;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
}

.hero-title { font-size: clamp(2rem, 6vw, 3.4rem); margin: 0 0 .75rem; }
.hero-logline { font-size: 1.05rem; color: #c9cede; margin: 0 0 1.5rem; }
.hero-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

/* --- Reihen ----------------------------------------------------------- */

.row { margin: 2.5rem 0; }
.row-empty { display: none; }

.row-title {
    font-size: 1.05rem;
    margin: 0 0 .75rem;
    padding: 0 1.5rem;
    color: #d5dae7;
}

.row-viewport { position: relative; }

.row-track {
    display: flex;
    gap: .75rem;
    padding: 0 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
}

.row-track::-webkit-scrollbar { display: none; }

.row-arrow {
    position: absolute;
    top: 0;
    bottom: 2.5rem;
    width: 3rem;
    display: grid;
    place-items: center;
    background: linear-gradient(90deg, rgba(11, 12, 15, .92), transparent);
    border: none;
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
    z-index: 2;
}

.row-arrow-left { left: 0; }
.row-arrow-right { right: 0; transform: scaleX(-1); }
.row-arrow[hidden] { display: none; }

@media (hover: none) {
    .row-arrow { display: none; }
}

/* --- Karten ----------------------------------------------------------- */

.card { flex: 0 0 auto; width: 200px; scroll-snap-align: start; }
.card-progress { width: 240px; }

.card-link {
    display: block;
    text-decoration: none;
    position: relative;
}

.card-art {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
    aspect-ratio: 2 / 3;
}

.card-progress .card-art { aspect-ratio: 3 / 2; }
.card-art img { width: 100%; height: 100%; object-fit: cover; }

.card-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    padding: 1rem;
    text-align: center;
    font-size: .85rem;
    color: var(--muted);
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
}

.card-link:hover .card-art, .card-link:focus-visible .card-art {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.card-title { font-size: .95rem; margin: .5rem 0 .15rem; }
.card-sub { font-size: .8rem; color: var(--muted); margin: 0; }

.card-age {
    position: absolute;
    top: .5rem;
    left: .5rem;
    background: rgba(0, 0, 0, .75);
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 3px;
    padding: .05rem .35rem;
    font-size: .7rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.card-grid .card { width: auto; }

.progressbar {
    margin-top: .4rem;
    height: 3px;
    background: rgba(255, 255, 255, .15);
    border-radius: 2px;
    overflow: hidden;
}

.progressbar span { display: block; height: 100%; background: var(--accent); }

/* --- Werk-Seite ------------------------------------------------------- */

.work-header {
    position: relative;
    margin-top: calc(var(--header-height) * -1);
    padding: calc(var(--header-height) + 3rem) 1.5rem 2rem;
}

.work-backdrop { position: absolute; inset: 0; overflow: hidden; }
.work-backdrop img { width: 100%; height: 100%; object-fit: cover; opacity: .35; }

.work-backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(0deg, var(--bg) 5%, rgba(11, 12, 15, .4) 100%);
}

.work-header-body {
    position: relative;
    display: flex;
    gap: 2rem;
    align-items: flex-end;
    max-width: var(--page);
    margin: 0 auto;
}

.work-poster { flex: 0 0 180px; border-radius: var(--radius); overflow: hidden; }
.work-kicker { margin: 0 0 .4rem; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.work-title { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: 0 0 .5rem; }
.work-logline { font-size: 1.05rem; color: #c9cede; margin: 0; max-width: 60ch; }

.work-synopsis {
    max-width: var(--page);
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.work-synopsis p { max-width: 70ch; color: #c3c9d8; }

.episodes { max-width: var(--page); margin: 2rem auto 4rem; padding: 0 1.5rem; }
.episodes-title { font-size: 1.1rem; margin: 2rem 0 .75rem; }

.episode-list { list-style: none; margin: 0; padding: 0; }

.episode { border-top: 1px solid var(--line); }
.episode:last-child { border-bottom: 1px solid var(--line); }

.episode-link {
    display: flex;
    gap: 1.25rem;
    padding: 1rem 0;
    text-decoration: none;
    align-items: flex-start;
}

.episode-link:hover { background: rgba(255, 255, 255, .03); }

.episode-thumb {
    flex: 0 0 180px;
    aspect-ratio: 3 / 2;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface-2);
}

.episode-thumb img { width: 100%; height: 100%; object-fit: cover; }
.episode-body { flex: 1; min-width: 0; }
.episode-title { font-size: 1.05rem; margin: 0 0 .35rem; }
.episode-teaser { margin: 0 0 .4rem; color: var(--muted); font-size: .92rem; max-width: 65ch; }
.episode-meta { margin: 0; font-size: .8rem; color: var(--muted); }
.episode-body .progressbar { max-width: 240px; }

.search-results { max-width: var(--page); margin: 2rem auto 4rem; padding: 0 1.5rem; }

/* --- Reader ----------------------------------------------------------- */

.reader-bar {
    position: sticky;
    top: var(--header-height);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .6rem 1.5rem;
    background: rgba(11, 12, 15, .92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
    font-size: .875rem;
}

.reader-back { text-decoration: none; color: var(--muted); white-space: nowrap; }
.reader-back:hover { color: var(--text); }
.reader-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-counter { margin-left: auto; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

.strip {
    max-width: 900px;
    margin: 0 auto;
    padding: 1.5rem 0 3rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel {
    position: relative;
    margin: 0;
    background: #000;
    border-radius: 2px;
    overflow: hidden;
}

.panel img { width: 100%; height: auto; }

/* Sprechblasen: x/y ist der Mittelpunkt — dieselbe Rechnung wie im Editor.
   Die Schriftgroesse haengt an der Panelbreite, damit sie beim Skalieren
   im Verhaeltnis bleibt. */
.panel .bubble {
    position: absolute;
    transform: translate(-50%, -50%);
    padding: .5em .7em;
    background: #f4f1ea;
    color: #101216;
    border: 2px solid #101216;
    border-radius: 14px;
    font-size: clamp(11px, 1.9cqw, 17px);
    line-height: 1.25;
    text-align: center;
    hyphens: auto;
}

.strip { container-type: inline-size; }

.bubble-thought { border-radius: 50% / 42%; }
.bubble-caption { border-radius: 2px; background: #e7e1d3; text-align: left; }
.bubble-narration { border-radius: 2px; background: #101216; color: #f4f1ea; border-color: #f4f1ea; text-align: left; }

.bubble-sfx {
    background: none;
    border: none;
    color: #fff;
    font-weight: 800;
    font-style: italic;
    letter-spacing: .02em;
    text-shadow: 0 0 6px #000, 0 0 2px #000;
    font-size: clamp(14px, 3cqw, 30px);
}

/* Zipfel als gedrehtes Dreieck in Richtung des gespeicherten Punktes */
.bubble.has-tail::after {
    content: '';
    position: absolute;
    left: calc(50% + var(--tail-x, 0%) / 2);
    top: calc(50% + var(--tail-y, 0%) / 2);
    width: 12px;
    height: 12px;
    background: inherit;
    border: inherit;
    border-top: none;
    border-left: none;
    transform: translate(-50%, -50%) rotate(45deg);
}

.bubble-sfx.has-tail::after { display: none; }

.reader-end { text-align: center; padding: 2rem 1.5rem 5rem; }
.reader-end p { color: var(--muted); }
.reader-end-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }

/* --- Schmale Bildschirme ---------------------------------------------- */

@media (max-width: 700px) {
    :root { --page: 100%; }

    .siteheader { gap: .75rem; padding: 0 1rem; }
    .searchform input { width: 120px; }
    .searchform input:focus { width: 160px; }

    .hero { min-height: 54vh; padding-left: 1rem; padding-right: 1rem; }
    .row-title, .row-track { padding-left: 1rem; padding-right: 1rem; }

    .card { width: 42vw; }
    .card-progress { width: 62vw; }

    .work-header-body { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .work-poster { flex-basis: auto; width: 130px; }
    .work-header, .work-synopsis, .episodes, .search-results { padding-left: 1rem; padding-right: 1rem; }

    .episode-link { gap: .75rem; }
    .episode-thumb { flex-basis: 110px; }

    .reader-bar { padding: .5rem 1rem; }
    .reader-title { display: none; }
    .strip { padding-top: .75rem; gap: .75rem; }
}
