/* ASS Astrofoto — Frontend Styles
 *
 * Modern, clean, freundlich. Hoher Kontrast, große Targets, defensive
 * Fallbacks für ältere Browser. KEIN Auto-Dark-Mode (Theme entscheidet),
 * KEIN Container-Background (Theme bleibt sichtbar), klare Hierarchie.
 */

.asg-gallery,
.asg-detail {
    --asg-fg: #1a1a1a;
    --asg-fg-muted: #4a4a4a;
    --asg-card-bg: #ffffff;
    --asg-card-border: #d8d8de;
    --asg-input-bg: #ffffff;
    --asg-input-border: #888d94;
    --asg-input-fg: #1a1a1a;
    --asg-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 2px 8px rgba(15, 23, 42, 0.04);
    --asg-shadow-hover: 0 4px 8px rgba(15, 23, 42, 0.10), 0 12px 24px rgba(15, 23, 42, 0.08);
    --asg-accent: #0040c0;        /* AAA on white */
    --asg-accent-hover: #002f8c;
    --asg-accent-fg: #ffffff;
    --asg-radius: 12px;
    --asg-radius-sm: 8px;
    --asg-gap: 16px;

    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--asg-fg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
    font-size: 16px;
}

.asg-gallery * ,
.asg-detail * {
    box-sizing: border-box;
}

.asg-gallery {
    max-width: 1280px;
    margin: 0 auto;
    padding: 16px 0 48px;
}

/* ========================================================================
   Toolbar / filters
   ======================================================================== */
.asg-toolbar {
    background: var(--asg-card-bg);
    border: 1px solid var(--asg-card-border);
    border-radius: var(--asg-radius);
    padding: 20px 20px 16px;
    margin-bottom: 24px;
    box-shadow: var(--asg-shadow);
}

.asg-toolbar-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.asg-title {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--asg-fg);
}

.asg-count {
    font-size: 16px;
    color: var(--asg-fg-muted);
    margin: 0;
}

.asg-count strong {
    color: var(--asg-fg);
    font-weight: 700;
}

.asg-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px 14px;
    align-items: end;
}

.asg-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.asg-field-search {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    .asg-field-search {
        grid-column: span 2;
    }
}

.asg-field-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--asg-fg);
}

/* High specificity to win against theme defaults */
.asg-gallery .asg-field input,
.asg-gallery .asg-field input[type="text"],
.asg-gallery .asg-field input[type="search"],
.asg-gallery .asg-field input[type="date"],
.asg-gallery .asg-field select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--asg-input-bg);
    color: var(--asg-input-fg);
    border: 2px solid var(--asg-input-border);
    border-radius: var(--asg-radius-sm);
    padding: 10px 14px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.3;
    width: 100%;
    height: 46px;
    margin: 0;
    box-shadow: none;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.asg-gallery .asg-field select {
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%231a1a1a' d='M0 0h12L6 8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.asg-gallery .asg-field input:hover,
.asg-gallery .asg-field select:hover {
    border-color: var(--asg-fg);
}

.asg-gallery .asg-field input:focus,
.asg-gallery .asg-field select:focus {
    outline: 3px solid var(--asg-accent);
    outline-offset: 2px;
    border-color: var(--asg-accent);
}

.asg-field-actions {
    display: flex;
    gap: 12px;
    align-items: end;
}

/* ========================================================================
   Buttons
   ======================================================================== */
.asg-gallery .asg-btn,
.asg-detail .asg-btn {
    appearance: none;
    border: 2px solid transparent;
    border-radius: var(--asg-radius-sm);
    padding: 10px 22px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.asg-btn-primary {
    background: var(--asg-accent);
    color: var(--asg-accent-fg);
    border-color: var(--asg-accent);
}

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

.asg-btn-primary:focus {
    outline: 3px solid var(--asg-accent);
    outline-offset: 2px;
}

.asg-btn-ghost {
    background: var(--asg-input-bg);
    color: var(--asg-fg);
    border-color: var(--asg-input-border);
}

.asg-btn-ghost:hover {
    border-color: var(--asg-fg);
}

/* ========================================================================
   Grid
   ======================================================================== */
.asg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: var(--asg-gap);
}

@media (min-width: 768px) {
    .asg-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (min-width: 1200px) {
    .asg-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

.asg-card {
    border-radius: var(--asg-radius);
    overflow: hidden;
    background: var(--asg-card-bg);
    border: 1px solid var(--asg-card-border);
    box-shadow: var(--asg-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

@supports (content-visibility: auto) {
    .asg-card {
        content-visibility: auto;
        contain-intrinsic-size: auto 360px;
    }
}

.asg-card:hover {
    transform: translateY(-2px);
    border-color: var(--asg-accent);
    box-shadow: var(--asg-shadow-hover);
}

.asg-card-link,
.asg-card-link:hover,
.asg-card-link:focus,
.asg-card-link:active,
.asg-card-link:visited {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    color: inherit;
    text-decoration: none !important;
    box-shadow: none;
}

.asg-card-link * {
    text-decoration: none !important;
}

.asg-card-link:focus {
    outline: 3px solid var(--asg-accent);
    outline-offset: 2px;
}

/* Image area: fixed aspect ratio, image fills it. */
.asg-card-image {
    position: relative;
    width: 100%;
    background: #0a0a0a;
    overflow: hidden;
    /* 16:10 fallback for older browsers */
    padding-top: 62.5%;
}

@supports (aspect-ratio: 1) {
    .asg-card-image {
        aspect-ratio: 16 / 10;
        padding-top: 0;
    }
}

/* The <picture> wrapper from ewww-image-optimizer must also fill
   the image container — it defaults to inline, which leaves white
   space around the actual image. */
.asg-gallery .asg-card-image picture,
.asg-gallery .asg-card-image > picture {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.asg-gallery .asg-card-img,
.asg-gallery .asg-card-image picture img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.asg-card-img-empty {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #2a2a2c 0%, #0a0a0a 100%);
}

/* Body area: text under the image on the light card surface */
.asg-card-body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.asg-card-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    color: var(--asg-fg);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.asg-card:hover .asg-card-title {
    color: var(--asg-accent);
}

.asg-card-meta {
    margin: 0;
    font-size: 13px;
    color: var(--asg-fg-muted);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

/* Bullet separators between meta items */
.asg-card-meta > * + *::before {
    content: "·";
    margin: 0 8px;
    color: var(--asg-card-border);
    font-weight: 700;
}

.asg-card-author {
    font-weight: 600;
    color: var(--asg-fg);
}

.asg-card-date {
    font-weight: 500;
}

/* Stats row: rating, likes, comments */
.asg-card-stats {
    margin: 0;
    font-size: 13px;
    color: var(--asg-fg-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    align-items: center;
}

.asg-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}

.asg-stat-icon {
    font-size: 14px;
    line-height: 1;
}

.asg-stat-rating .asg-stat-icon {
    color: #c47a00;
}

.asg-stat-likes .asg-stat-icon {
    color: #d52a2a;
}

.asg-stat-comments .asg-stat-icon {
    /* emoji glyph keeps its native color */
}

/* Empty / loading */
.asg-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--asg-fg-muted);
    padding: 64px 16px;
    font-size: 18px;
}

.asg-grid.asg-loading {
    opacity: 0.5;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Pagination */
.asg-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 40px;
}

.asg-pagination-info {
    font-size: 15px;
    color: var(--asg-fg-muted);
    margin: 0;
}

@media (forced-colors: active) {
    .asg-card { border: 1px solid CanvasText; }
    .asg-btn-primary { background: ButtonText; color: ButtonFace; }
}

@media (prefers-reduced-motion: reduce) {
    .asg-card,
    .asg-btn,
    .asg-field input,
    .asg-field select { transition: none; }
    .asg-card:hover { transform: none; }
}

/* ========================================================================
   Detail page — sits inside the theme container, no full-width background
   ======================================================================== */

.asg-detail {
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 0 32px;
}

.asg-detail-inner {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.asg-detail-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.asg-detail-breadcrumb {
    margin: 0 0 8px;
    font-size: 15px;
}

.asg-detail-breadcrumb a {
    color: var(--asg-accent);
    text-decoration: none;
    font-weight: 600;
    padding: 6px 0;
    display: inline-block;
}

.asg-detail-breadcrumb a:hover,
.asg-detail-breadcrumb a:focus {
    text-decoration: underline;
}

.asg-detail-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.2;
    margin: 0;
    color: var(--asg-fg);
}

@media (min-width: 768px) {
    .asg-detail-title { font-size: 34px; }
}

.asg-detail-object {
    font-size: 17px;
    color: var(--asg-fg-muted);
    margin: 0;
}

.asg-detail-hero {
    margin: 0;
    border-radius: var(--asg-radius);
    overflow: hidden;
    background: #f3f3f6;
    border: 1px solid var(--asg-card-border);
}

.asg-detail-hero-link {
    display: block;
    line-height: 0;
}

.asg-detail-hero img {
    width: 100%;
    height: auto;
    display: block;
}

.asg-detail-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.asg-detail-description {
    font-size: 17px;
    line-height: 1.7;
    color: var(--asg-fg);
}

.asg-detail-description p { margin: 0 0 16px; }

.asg-detail-section-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 14px;
    color: var(--asg-fg);
    letter-spacing: -0.005em;
}

.asg-detail-facts,
.asg-detail-equipment,
.asg-detail-author,
.asg-detail-map-section {
    background: var(--asg-card-bg);
    border: 1px solid var(--asg-card-border);
    border-radius: var(--asg-radius);
    padding: 20px 24px;
    box-shadow: var(--asg-shadow);
}

.asg-detail-facts-list {
    margin: 0;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px 16px;
}

@media (min-width: 600px) {
    .asg-detail-facts-list {
        grid-template-columns: 200px 1fr;
    }
}

.asg-detail-facts-list dt {
    font-weight: 600;
    color: var(--asg-fg-muted);
    font-size: 15px;
    align-self: start;
    padding-top: 2px;
}

.asg-detail-facts-list dd {
    margin: 0;
    font-size: 16px;
    color: var(--asg-fg);
}

@media (max-width: 599px) {
    .asg-detail-facts-list dd { margin-bottom: 8px; }
}

/* Equipment chips — light, friendly */
.asg-chip {
    display: inline-block;
    padding: 4px 12px;
    margin: 2px 4px 2px 0;
    background: #eef2fb;
    border: 1px solid #c7d3ee;
    border-radius: 999px;
    color: var(--asg-accent);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    transition: background 0.12s ease, border-color 0.12s ease;
}

.asg-chip:hover,
.asg-chip:focus {
    background: #e0e8f9;
    border-color: var(--asg-accent);
    text-decoration: none;
}

/* Map */
.asg-detail-map {
    height: 320px;
    border-radius: var(--asg-radius-sm);
    overflow: hidden;
    border: 1px solid var(--asg-card-border);
    background: #f3f3f6;
    margin-top: 4px;
}

.asg-detail-map-fallback {
    margin: 12px 0 0;
    font-size: 14px;
    color: var(--asg-fg-muted);
}

.asg-detail-author p {
    margin: 0;
    font-size: 17px;
    color: var(--asg-fg);
}

.asg-detail-author a {
    color: var(--asg-accent);
    font-weight: 600;
    text-decoration: underline;
}

.asg-detail-author a:hover,
.asg-detail-author a:focus {
    text-decoration: none;
}

/* ========================================================================
   Authors / Mitglieder grid
   ======================================================================== */

.asg-author-grid {
    display: grid;
    /* minmax(0, 1fr) prevents grid items from forcing the track wider
       than 1fr when their content (nowrap names, large images) does not
       shrink — fixes overflow past the gallery container on the right. */
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .asg-author-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .asg-author-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.asg-author-card {
    background: var(--asg-card-bg);
    border: 1px solid var(--asg-card-border);
    border-radius: var(--asg-radius);
    box-shadow: var(--asg-shadow);
    padding: 14px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;            /* allow shrink inside grid */
    box-sizing: border-box;
    overflow: hidden;        /* contain any rogue overflow */
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.asg-author-card:hover {
    border-color: var(--asg-accent);
    box-shadow: var(--asg-shadow-hover);
    transform: translateY(-1px);
}

/* Header: avatar + name + count */
.asg-author-card-header,
.asg-author-card-header:hover,
.asg-author-card-header:focus {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--asg-fg) !important;
    text-decoration: none !important;
    min-height: 44px;
}

.asg-author-card-header * {
    text-decoration: none !important;
}

.asg-author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--asg-input-bg);
    border: 1px solid var(--asg-card-border);
    display: block;
}

.asg-author-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--asg-fg);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.asg-author-count {
    font-size: 14px;
    color: var(--asg-fg-muted);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.asg-author-arrow {
    color: var(--asg-accent);
    font-size: 14px;
    transition: transform 0.15s ease;
}

.asg-author-card:hover .asg-author-arrow {
    transform: translateX(2px);
}

.asg-author-card:hover .asg-author-name {
    color: var(--asg-accent);
}

/* Three thumbnail row */
.asg-author-thumbs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.asg-author-thumb {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: 6px;
    overflow: hidden;
    background: #0a0a0a;
    text-decoration: none !important;
    transition: opacity 0.15s ease;
}

@supports not (aspect-ratio: 1) {
    .asg-author-thumb {
        padding-top: 75%;
    }
    .asg-author-thumb img {
        position: absolute;
        inset: 0;
    }
}

.asg-author-thumb:hover {
    opacity: 0.85;
}

.asg-author-thumb:focus {
    outline: 2px solid var(--asg-accent);
    outline-offset: 2px;
}

.asg-author-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* The <picture> wrapper from ewww needs the same fill treatment */
.asg-gallery .asg-author-thumb picture,
.asg-gallery .asg-author-thumb > picture {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    margin: 0;
    padding: 0;
    line-height: 0;
}

.asg-gallery .asg-author-thumb picture img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.asg-author-thumb-empty {
    aspect-ratio: 4 / 3;
    background: linear-gradient(135deg, #2a2a2c 0%, #0a0a0a 100%);
}

/* Equipment line */
.asg-author-equipment {
    margin: 0;
    font-size: 13px;
    color: var(--asg-fg-muted);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
