/* TOR §39: pirate/nautical visual style for the public site. Priorities in order:
   readability, mobile-first, speed, accessibility, SEO, one consistent system --
   plain CSS, no framework, no animation beyond simple hover/focus transitions. */

:root {
    --color-bg: #0b1e2d;
    --color-bg-alt: #0f2a3d;
    --color-surface: #f6ecd4;
    --color-surface-alt: #ecdfba;
    --color-ink: #241708;
    --color-text: #e8e2d0;
    --color-text-muted: #aebccb;
    --color-gold: #caa53d;
    --color-gold-bright: #e8c565;
    --color-accent: #8f2323;
    --color-border: rgba(202, 165, 61, 0.45);
    --radius: 10px;
    --max-width: 1000px;
    --font-heading: Georgia, 'Times New Roman', serif;
    --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
    box-sizing: border-box;
}

.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;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--color-bg) linear-gradient(180deg, var(--color-bg) 0%, var(--color-bg-alt) 100%) fixed;
    color: var(--color-text);
    font-family: var(--font-body);
    line-height: 1.55;
}

a {
    color: var(--color-gold-bright);
}

a:hover,
a:focus-visible {
    color: var(--color-gold);
}

img {
    max-width: 100%;
    height: auto;
}

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

.site-header {
    border-bottom: 1px solid var(--color-border);
    background: rgba(0, 0, 0, 0.2);
}

.site-header__bar {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.site-header__brand {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-gold-bright);
    text-decoration: none;
    letter-spacing: 0.02em;
}

.site-nav {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.site-nav a {
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
    color: var(--color-gold-bright);
    border-bottom-color: var(--color-gold);
}

main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-gold-bright);
    line-height: 1.25;
}

h1 {
    font-size: clamp(1.6rem, 4vw, 2.4rem);
}

.lede {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    max-width: 60ch;
}

.breadcrumbs {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1rem;
}

.breadcrumbs a {
    color: var(--color-text-muted);
}

/* Parchment card: used for feedback cards, detail content, forms. */
.card {
    background: var(--color-surface);
    color: var(--color-ink);
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    padding: 1.1rem 1.2rem;
}

.card a {
    color: #5a3a12;
}

.card-list {
    display: grid;
    gap: 1rem;
    margin: 1.5rem 0;
}

.feedback-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.85rem;
    color: #5a4a30;
    margin-bottom: 0.5rem;
}

.feedback-card__contacts {
    font-weight: 600;
    margin: 0.3rem 0;
}

.feedback-card__excerpt {
    margin: 0.4rem 0 0.6rem;
}

.feedback-card__link {
    font-weight: 700;
    text-decoration: none;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: var(--color-gold);
    color: #241708;
}

/* Search / filter form. */
.search-form {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 1.2rem 0;
}

.search-form input[type="text"] {
    flex: 1 1 240px;
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-ink);
    font-size: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.1rem;
    border-radius: var(--radius);
    border: 1px solid var(--color-gold);
    background: var(--color-gold);
    color: #241708;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    font-size: 1rem;
}

.btn:hover,
.btn:focus-visible {
    background: var(--color-gold-bright);
    color: #241708;
}

.btn--ghost {
    background: transparent;
    color: var(--color-gold-bright);
}

.pagination {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 1.5rem 0;
    align-items: center;
}

.pagination a,
.pagination strong {
    display: inline-block;
    min-width: 2.2rem;
    text-align: center;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
}

.pagination a {
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.pagination strong {
    background: var(--color-gold);
    color: #241708;
}

/* Screenshot gallery + lightbox (Stimulus, TOR §41). */
.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.6rem;
    margin: 1rem 0 1.5rem;
}

.gallery img {
    width: 100%;
    height: 140px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    cursor: zoom-in;
}

.gallery button {
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 12, 20, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    z-index: 50;
}

.lightbox-overlay[hidden] {
    display: none;
}

.lightbox-overlay img {
    /* This <img> sits inside .gallery in the markup (the overlay is a child of
       the same <div class="gallery">), so the thumbnail-grid rule above
       (".gallery img") -- fixed 140px height, object-fit: cover, 100% width --
       matches it too and, tying on specificity with this rule, wins for every
       property this rule doesn't explicitly override. width/height/object-fit
       must all be reset here, not just added to, or the enlarged image renders
       as a cropped 140px-tall strip instead of the actual photo. */
    width: auto;
    height: auto;
    object-fit: contain;
    /* A wide (landscape) image is capped by width, a tall (portrait) one by
       height -- only one of these actually binds for any given image, the other
       just sits there unused. Percentage, not vh, for max-height: resolves
       against the overlay's own (already viewport-sized) content box, so it
       shrinks to fit inside the overlay's own padding instead of the image
       bleeding past it. */
    max-width: 70vw;
    max-height: 100%;
    border-radius: 6px;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    /* The <img> above is a flex item, which for stacking purposes counts as
       "positioned, z-index: auto" same as this button -- without an explicit
       z-index here, the two are ordered by DOM position, and the image (later
       in the markup) would paint over this button instead of the reverse. */
    z-index: 1;
    background: var(--color-gold);
    color: #241708;
    border: 0;
    border-radius: 999px;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.2rem;
    cursor: pointer;
}

/* Landing screenshot placeholders (TOR §38). */
.placeholder-shot {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-style: italic;
}

.feature-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    margin: 1.5rem 0;
}

.feature-grid .card h3 {
    margin-top: 0;
}

.cta-box {
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    background: rgba(202, 165, 61, 0.1);
    margin: 1.2rem 0;
}

.contacts-list {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0;
}

.contacts-list li {
    padding: 0.25rem 0;
    border-bottom: 1px dashed var(--color-border);
}

.feedback-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.feedback-text code {
    background: var(--color-surface-alt);
    padding: 0.1em 0.35em;
    border-radius: 0.25em;
    font-size: 0.92em;
}

.feedback-text pre {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 0.35em;
    padding: 0.75rem 1rem;
    overflow-x: auto;
    white-space: pre;
}

.feedback-text pre code {
    background: none;
    padding: 0;
}

.feedback-text blockquote {
    margin: 0.5rem 0;
    padding: 0.25rem 0 0.25rem 1rem;
    border-left: 3px solid var(--color-gold);
    color: var(--color-text-muted);
}

/* Mirrors Telegram's own spoiler: text hidden behind a solid block until
   hovered/focused. No click-to-reveal-and-stay without JS -- an acceptable
   simplification for what is a rare, cosmetic formatting choice. */
.tg-spoiler {
    background: currentColor;
    color: transparent;
    border-radius: 0.2em;
    cursor: pointer;
}

.tg-spoiler:hover,
.tg-spoiler:focus {
    background: none;
    color: inherit;
}

.site-footer {
    border-top: 1px solid var(--color-border);
    margin-top: 2rem;
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--color-text-muted);
}

@media (min-width: 640px) {
    .card-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 960px) {
    .card-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* TOR §56: prominent disclaimer banner, present on every public page. */
.disclaimer {
    max-width: var(--max-width);
    margin: 1rem auto 0;
    padding: 0.85rem 1.1rem;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-gold);
    background: var(--color-bg-alt);
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.disclaimer p {
    margin: 0;
}

/* TOR §57: /privacy, /rules, /appeal static pages. */
.legal-page {
    max-width: var(--max-width);
    margin: 1.5rem auto;
}

.legal-page h2 {
    margin-top: 1.5rem;
}

.legal-page__notice {
    padding: 0.75rem 1rem;
    border: 1px dashed var(--color-accent);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

.legal-page__contact {
    font-size: 1.2rem;
    font-weight: 700;
}

/* TOR §77.6: standalone custom 404 page (rendered outside the usual public
   layout -- see templates/bundles/TwigBundle/Exception/error404.html.twig --
   so its handful of rules are kept self-contained here rather than depending
   on template inheritance that page deliberately avoids). */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
}

.error-page__code {
    font-family: var(--font-heading);
    font-size: 5rem;
    color: var(--color-gold-bright);
    margin: 0;
}

.error-page__actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}
