@import "fonts.css";
@import "theme.css";

/* ========== Base styles ========== */

/* Grund-Styling */
body {
    font-family: "Rajdhani", serif;
    font-size: var(--font-size);
    margin: 0;
    color: var(--main-text-color);
}

a {
    text-decoration: none;
    color: inherit;
}

.grid-row {
    display: grid;
}

.two-column {
    display: grid;
    justify-content: space-around;
    align-items: center;
    min-height: 50vh;
    width: 90vw;
    padding: 5vw;
}

.single-column {
    display: flex;
    flex-direction: column;
    gap: 2vw;
    width: 100vw;
}

.column {
    padding: 2vw;
}

.logo {
    width: 80%;
}

.tiles-wrapper {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    gap: 1vw;
    margin-left: 5vw;
    margin-right: 5vw;
}

.title-row {
    margin-left: 5vw;
}

.more {
    margin-right: 5vw;
    align-self: end;
}

.description {
    margin-right: 10vw;
}

.gradient {
    background: var(--page-gradient);
}

/* Issue #6: Hero – Logo als Wasserzeichen auf Mobile (Option A). Default = mobile. */
.image-box .two-column.gradient {
    position: relative;
}
.image-box .two-column.gradient::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--url-logo);
    background-size: 70% auto;
    background-position: center 85%;
    background-repeat: no-repeat;
    opacity: 0.2;
    z-index: 0;
    pointer-events: none;
}
.image-box .two-column.gradient .column:first-child {
    display: none;
}
.image-box .two-column.gradient .column:last-child {
    position: relative;
    z-index: 1;
}

.opaque {
    color: var(--color-text-accent);
    background-color: var(--color-surface-muted);
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 5px 15px;
    align-items: baseline;
    max-width: 400px;

    flex: 1 1 100%;
    background: var(--color-surface-card);
    backdrop-filter: blur(10px);

    padding: 1vw; /* Innenabstand zum Text */

    /* Der Rand */
    border: 1px solid var(--color-accent);
    border-radius: 12px;        /* Abgerundete Ecken */

    /* Hintergrund & Schatten */
    box-shadow: var(--shadow-card);

    /* Text-Styling */
    color: var(--color-text-accent);

    /* Animation beim Drüberfahren (Hover) */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* Issue #5: stretched link – whole tile clickable; Komoot link stays on top */
.tile-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.ride-komoot a {
    position: relative;
    z-index: 2;
}

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

.ride-date-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    font-weight: bold;
    text-align: left;
    font-size: 150%;
}

.ride-header {
    font-weight: bold;
}

/* Optional ride type: free-text subtitle under the title */
.ride-subtitle {
    font-size: 0.85em;
    opacity: 0.9;
    margin-top: -2px;
}

/* Optional fixed badges: upper-right of tile, icon-only (use with .ride-badge--awgr, .ride-badge--road, etc.) */
.ride-badges {
    position: absolute;
    top: 1vw;
    right: 1vw;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.ride-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75em;
    height: 1.75em;
    padding: 0;
    border-radius: 50%;
    font-size: 1em;
    border: 1px solid var(--color-accent);
    background: var(--color-surface-card-badge);
    color: var(--color-text-accent);
}

.ride-badge i {
    font-size: 0.9em;
}

.tile:hover {
    transform: translateY(-5px); /* Kachel hebt sich leicht an */
    box-shadow: var(--shadow-card-hover);
}

.transparent {
    background-color: transparent;
}

.row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

.image-box {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 300px;
    background-image: var(--url-background-hero);
}

ul.contact-list {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    list-style: none;
    margin: 0;
    margin-block-start: 2vw;
    margin-block-end: 2vw;
    padding-inline-start: 0;
    align-items: center;
}

.contact-list li {
    margin-right: 10vw;
}

footer {
    text-align: center;
    font-size: var(--footer-font-size);
}

footer p {
    margin: 0;
    padding: 0;
}

h2 p {
    margin: 0;
    padding: 0;
}

.align-top {
    align-items: flex-start;
}

.icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 7vw;
    height: 7vw;
    border-radius: 50%;
    background: var(--color-surface-icon-circle);
    box-shadow: var(--shadow-icon-circle);
    text-decoration: none;
    padding: 0;
}

.icon-circle i {
    font-size: 3vw;
    line-height: 1;
    display: inline-block;
    color: transparent; /* Text selbst transparent machen */
    -webkit-text-fill-color: transparent; /* Safari */
    background: var(--page-gradient);
    -webkit-background-clip: text;
    background-clip: text;
}

/* ========== List page (rides-list) ========== */
.list-page {
    background: var(--page-gradient);
    min-height: 100vh;
}

.page-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--page-gradient);
    color: var(--color-text-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.page-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between; /* Position der Elemente auf dem Menu */
    gap: 0.75rem;
    padding: 0.75rem 5vw;
    max-width: 100%;
}

.nav-home {
    font-weight: bold;
    color: inherit;
}

.nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.nav-toggle-icon {
    position: relative;
    width: 1.25rem;
    height: 2px;
    background: currentColor;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
}

.nav-toggle-icon::before {
    top: -6px;
}

.nav-toggle-icon::after {
    top: 6px;
}

.nav-menu {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
    flex-direction: column;
    gap: 1rem;
}

.nav-menu.is-open {
    display: flex;
}

.nav-menu a {
    display: block;
    padding: 0.5rem 0;
    color: inherit;
}

.list-page-logo-watermark {
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: var(--url-logo);
    background-size: 60% auto;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0.15;
    pointer-events: none;
}

.list-page-container {
    position: relative;
    z-index: 1;
}

.ride-list-main {
    padding: 2vw 5vw 4vw;
}

.ride-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
}

.ride-list-card {
    position: relative;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
    padding: 1rem;
    background: var(--color-surface-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-accent);
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    color: var(--color-text-accent);
    transition: box-shadow 0.2s ease;
}

.ride-list-card:hover {
    box-shadow: var(--shadow-card-hover);
}

.ride-list-card .tile-link {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.ride-list-card-image {
    position: relative;
    aspect-ratio: 1;
    width: 100%;
    max-width: 100%;
    min-height: 180px;
    border-radius: 8px;
    overflow: hidden;
}

.ride-list-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ride-list-card-image:empty {
    min-height: 180px;
}

.ride-list-card-body {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ride-list-card-body .ride-date-block {
    display: flex;
    flex-direction: row;
    gap: 0.25em;
    font-weight: bold;
    font-size: 150%;
}

.ride-list-card-body .ride-header {
    margin: 0;
    font-size: 1.1em;
}

.ride-list-description {
    margin: 0.5em 0 0;
    font-size: 0.9em;
    line-height: 1.4;
    max-width: 100%;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    word-break: normal;
    overflow-wrap: break-word;
}

.ride-list-card .ride-komoot a {
    position: relative;
    z-index: 2;
}

.ride-top-gap {
    margin-top: 3em;
}

/* ========== Single ride page ========== */
.ride-detail-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.ride-detail-page .list-page-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2vw 5vw 4vw;
}

.ride-detail-page .ride-list-main {
    flex: 1;
}

.ride-detail-back {
    color: var(--color-text-primary);
    font-weight: bold;
}

.ride-detail-back:hover {
    text-decoration: underline;
}

.ride-detail-page .page-nav .ride-detail-back.nav-back {
    order: -1;
    margin-right: auto;
}

.ride-detail-card {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0;
    color: var(--color-text-primary);
}

.ride-detail-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
    min-width: 0;
}

.ride-detail-image-wrap {
    position: relative;
    flex-shrink: 0;
    display: block;
}

.ride-detail-image {
    width: 100%;
    max-width: var(--ride-detail-image-size-sm);
    min-height: 0;
    border-radius: 8px;
    overflow: hidden;
}

.ride-detail-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ride-detail-image:empty {
    min-height: 180px;
}

.ride-detail-badges {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
}

.ride-detail-badges .ride-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75em;
    height: 1.75em;
    padding: 0;
    border-radius: 50%;
    font-size: 1em;
    border: 1px solid rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.35);
    color: var(--color-text-primary);
}

.ride-detail-badges .ride-badge i {
    font-size: 0.9em;
}

.ride-detail-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.ride-detail-meta .ride-date-block {
    display: flex;
    flex-direction: row;
    gap: 0.25em;
    font-weight: bold;
    font-size: 150%;
}

.ride-detail-meta .ride-header {
    margin: 0;
    font-size: 1.25em;
}

.ride-detail-komoot-preview {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.ride-detail-komoot-embed {
    min-width: 0;
    min-height: var(--ride-detail-komoot-height-sm);
    height: var(--ride-detail-komoot-height-sm);
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface-muted);
}

.ride-detail-komoot-embed iframe {
    display: block;
    min-height: var(--ride-detail-komoot-height-sm);
    height: var(--ride-detail-komoot-height-sm);
    width: 100%;
}

.ride-detail-description {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    line-height: 1.5;
    color: var(--color-text-primary);
}

.ride-detail-description p {
    margin: 0 0 0.5em;
}

.ride-detail-description p:last-child {
    margin-bottom: 0;
}

/* Issue #14: Ride detail without hero image */
.ride-detail-page--no-hero .ride-detail-meta {
    position: relative;
}

.ride-detail-page--no-hero .ride-detail-badges {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    left: auto;
}

/* ========== Media queries ========== */

@media (min-width: 576px) {
    :root {
        --font-size: var(--font-size-md);
    }

    .tile {
        flex: 1 1 calc(50% - 7vw);
    }

    .ride-list-card {
        grid-template-columns: minmax(140px, 200px) 1fr;
    }

    .ride-list-card-image {
        max-width: 200px;
        min-height: 0;
    }

    .ride-list-card-image:empty {
        min-height: 140px;
    }
}

@media (min-width: 768px) {
    :root {
        --font-size: var(--font-size-lg);
    }

    .nav-toggle {
        display: none;
    }

    .nav-menu {
        display: flex;
        flex-direction: row;
        width: auto;
    }

    .nav-menu.is-open {
        display: flex;
    }

    .ride-detail-top {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 1.5rem;
    }

    .ride-detail-image-wrap {
        grid-column: 1;
        grid-row: 1;
    }

    .ride-detail-meta {
        grid-column: 2;
        grid-row: 1;
    }

    .ride-detail-komoot-preview {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .ride-detail-image {
        width: var(--ride-detail-image-size-md);
        height: var(--ride-detail-image-size-md);
    }

    .ride-detail-komoot-embed,
    .ride-detail-komoot-embed iframe {
        min-height: var(--ride-detail-komoot-height-sm);
        height: var(--ride-detail-komoot-height-sm);
    }

    .ride-detail-page--no-hero .ride-detail-top {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .ride-detail-page--no-hero .ride-detail-meta {
        grid-column: 1;
        grid-row: 1;
    }

    .ride-detail-page--no-hero .ride-detail-komoot-preview {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (min-width: 992px) {
    :root {
        --font-size: var(--font-size-xl);
    }

    .two-column {
        grid-template-columns: 1fr 1fr;
        height: 100vh;
    }

    .image-box .two-column.gradient::before {
        content: none;
    }
    .image-box .two-column.gradient .column:first-child {
        display: block;
    }
}

@media (min-width: 1200px) {
    :root {
        --font-size: var(--font-size-2xl);
    }

    .tile {
        flex: 1 1 calc(25% - 4vw);
    }

    .ride-list-card {
        grid-template-columns: 300px 1fr;
    }

    .ride-list-card-image {
        width: 300px;
        height: 300px;
        max-width: 300px;
        min-height: 0;
    }

    .ride-list-card-image:empty {
        min-height: 300px;
    }

    .ride-detail-top {
        align-items: stretch;
        grid-template-columns: var(--ride-detail-image-size-lg) 1fr var(--ride-detail-image-size-lg);
        grid-template-rows: 1fr;
    }

    .ride-detail-image-wrap {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        min-height: var(--ride-detail-image-size-lg);
    }

    .ride-detail-image {
        height: var(--ride-detail-image-size-lg);
    }

    .ride-detail-image-wrap .ride-detail-image {
        width: var(--ride-detail-image-size-lg);
        max-width: none;
        aspect-ratio: 1;
    }

    .ride-detail-meta {
        grid-column: 2;
        grid-row: 1;
    }

    .ride-detail-komoot-preview {
        grid-column: 3;
        grid-row: 1;
    }

    .ride-detail-komoot-embed,
    .ride-detail-komoot-embed iframe {
        min-height: var(--ride-detail-komoot-height-lg);
        height: var(--ride-detail-komoot-height-lg);
    }

    .ride-detail-page--no-hero .ride-detail-top {
        grid-template-columns: 1fr 1fr;
        grid-row: auto;
    }

    .ride-detail-page--no-hero .ride-detail-meta {
        grid-column: 1;
        grid-row: 1;
    }

    .ride-detail-page--no-hero .ride-detail-komoot-preview {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (min-width: 1500px) {
    .ride-detail-top {
        align-items: stretch;
        grid-template-columns: var(--ride-detail-image-size-xl) 1fr var(--ride-detail-image-size-xl);
    }

    .ride-detail-image-wrap {
        min-height: var(--ride-detail-image-size-xl);
    }

    .ride-detail-image {
        height: var(--ride-detail-image-size-xl);
    }

    .ride-detail-image-wrap .ride-detail-image {
        width: var(--ride-detail-image-size-xl);
        aspect-ratio: 1;
    }

    .ride-detail-komoot-embed,
    .ride-detail-komoot-embed iframe {
        min-height: var(--ride-detail-komoot-height-xl);
        height: var(--ride-detail-komoot-height-xl);
    }

    .ride-detail-page--no-hero .ride-detail-top {
        grid-template-columns: 1fr 1fr;
    }
}
