/* =====================================================================
   PATATING — stylesheet
   A lighthearted "biggest potato" growing contest site.
   Warm harvest palette (separate from the plat-it corporate theme).
   ===================================================================== */

:root {
    /* Backgrounds */
    --bg: #15100c;
    --bg-soft: #1c1510;
    --card-bg-1: #211a13;
    --card-bg-2: #170f0a;

    /* Text */
    --text: #f3e9dc;
    --text-dim: #b9a691;
    --text-mute: #7a6a59;
    --text-faint: #564a3d;

    /* Brand accents */
    --gold: #f2b544;
    --amber: #ff8a3d;
    --leaf: #8bc34a;
    --leaf-dim: #6a9c38;

    /* Medal colors */
    --medal-gold: #ffd700;
    --medal-silver: #c9c9c9;
    --medal-bronze: #cd7f32;

    /* Shadows / lines */
    --line: rgba(255, 255, 255, 0.06);
    --line-soft: rgba(255, 255, 255, 0.04);
    --shadow-amber: rgba(255, 138, 61, 0.18);
    --shadow-amber-soft: rgba(255, 138, 61, 0.1);
}

/* ===== RESET & BASE ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg);
    background-image:
        radial-gradient(circle at 15% 0%, rgba(255, 138, 61, 0.05) 0%, transparent 45%),
        radial-gradient(circle at 85% 15%, rgba(139, 195, 74, 0.04) 0%, transparent 40%);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
}

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

ul {
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(21, 16, 12, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
    transition: background 0.3s ease;
}

.navbar .brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--gold), var(--amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.navbar .nav-links {
    display: flex;
    gap: 2rem;
}

.navbar .nav-links a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color 0.3s ease;
    position: relative;
}

.navbar .nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, var(--gold), var(--amber));
    transition: width 0.3s ease;
}

.navbar .nav-links a:hover {
    color: #fff;
}

.navbar .nav-links a:hover::after {
    width: 100%;
}

/* ===== DIVIDER ===== */
.divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(242, 181, 68, 0.18), transparent);
    max-width: 1100px;
    margin: 0 auto;
}

/* ===== FADE-IN ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== HERO (leaderboard-style header used on all pages) ===== */
.leaderboard-hero {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 7rem 2rem 3rem;
    position: relative;
    overflow: hidden;
}

.leaderboard-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 35% 45%, rgba(255, 138, 61, 0.10) 0%, transparent 50%),
                radial-gradient(circle at 65% 55%, rgba(139, 195, 74, 0.07) 0%, transparent 50%);
    animation: bgShift 14s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes bgShift {
    0%   { transform: translate(0, 0); }
    100% { transform: translate(5%, -5%); }
}

.leaderboard-hero .hero-content {
    position: relative;
    z-index: 1;
}

.hero-logo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 2rem;
    border: 3px solid rgba(242, 181, 68, 0.35);
    box-shadow: 0 0 40px var(--shadow-amber-soft);
    animation: floatLogo 4s ease-in-out infinite;
}

@keyframes floatLogo {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-12px); }
}

.leaderboard-hero h1 {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff 0%, var(--gold) 50%, var(--amber) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.leaderboard-hero .tagline {
    font-size: 1.15rem;
    color: var(--text-dim);
    font-weight: 300;
}

/* ===== STATS BAR ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    max-width: 900px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
}

.stat-card {
    background: linear-gradient(145deg, var(--card-bg-1), var(--card-bg-2));
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.5rem 2rem;
    text-align: center;
    flex: 1;
    min-width: 160px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px var(--shadow-amber-soft);
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--gold), var(--amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.3rem;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-mute);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* ===== YEAR SECTIONS ===== */
.year-section {
    max-width: 900px;
    margin: 0 auto 3rem;
    padding: 0 2rem;
}

/* The all-time "Natjecatelji" table has 7 columns and needs more room than
   the 4-column season leaderboards, or its last column(s) run out of space. */
.year-section--wide {
    max-width: 1140px;
}

.year-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.6rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a1208;
    background: linear-gradient(135deg, var(--gold), var(--amber));
    border-radius: 50px;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    box-shadow: 0 4px 20px var(--shadow-amber);
}

.year-badge .trophy {
    font-size: 1.3rem;
}

/* ===== LEADERBOARD TABLE =====
   Tables sit inside a .table-scroll wrapper so wide tables (7 columns on
   the "Natjecatelji" page) scroll horizontally within themselves on small
   screens, instead of overflowing/clipping the page. */
.table-scroll {
    position: relative;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-color: rgba(242, 181, 68, 0.4) transparent;
    scrollbar-width: thin;
}

.table-scroll::-webkit-scrollbar {
    height: 6px;
}

.table-scroll::-webkit-scrollbar-thumb {
    background: rgba(242, 181, 68, 0.35);
    border-radius: 4px;
}

/* When a table is actually wider than its container, fade the right edge
   and show a "more" hint so it reads as scrollable rather than cut off. */
.table-scroll.has-overflow::after {
    content: '\2192';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 6px;
    font-size: 0.9rem;
    color: var(--gold);
    background: linear-gradient(to right, transparent, var(--card-bg-1) 75%);
    pointer-events: none;
}

.leaderboard-table {
    width: 100%;
    min-width: 480px;
    border-collapse: separate;
    border-spacing: 0 6px;
}

.leaderboard-table thead th {
    padding: 0.9rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-mute);
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.leaderboard-table thead th:last-child,
.leaderboard-table tbody td:last-child {
    text-align: right;
}

.leaderboard-table thead th:nth-child(2),
.leaderboard-table tbody td:nth-child(2) {
    text-align: center;
}

.leaderboard-table tbody tr {
    background: var(--card-bg-1);
    border-radius: 10px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.leaderboard-table tbody tr:hover {
    background: #241b13;
    transform: translateX(4px);
    box-shadow: -4px 0 0 0 var(--amber);
}

.leaderboard-table tbody td {
    padding: 1rem;
    font-size: 0.95rem;
    color: var(--text-dim);
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    white-space: nowrap;
}

.leaderboard-table tbody td:first-child {
    border-radius: 10px 0 0 10px;
}

.leaderboard-table tbody td:last-child {
    border-radius: 0 10px 10px 0;
}

.rank-cell {
    font-weight: 700;
    font-size: 1rem;
    width: 50px;
}

.rank-1 .rank-cell { color: var(--medal-gold); }
.rank-2 .rank-cell { color: var(--medal-silver); }
.rank-3 .rank-cell { color: var(--medal-bronze); }

.rank-1 {
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.09), transparent) !important;
    border-left: 3px solid var(--medal-gold);
}

.rank-2 {
    background: linear-gradient(90deg, rgba(201, 201, 201, 0.07), transparent) !important;
    border-left: 3px solid var(--medal-silver);
}

.rank-3 {
    background: linear-gradient(90deg, rgba(205, 127, 50, 0.07), transparent) !important;
    border-left: 3px solid var(--medal-bronze);
}

.name-cell {
    font-weight: 500;
    color: var(--text);
    white-space: normal;
}

.name-cell .medal {
    margin-right: 0.4rem;
}

.weight-cell {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    color: var(--text-dim);
}

.weight-cell .unit {
    color: var(--text-faint);
    font-weight: 400;
    font-size: 0.85rem;
    margin-left: 2px;
}

.highlight-weight {
    color: var(--leaf);
}

.best-grower-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--medal-gold);
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2);
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    margin-left: 0.6rem;
    vertical-align: middle;
    white-space: nowrap;
}

/* ===== GALLERY ===== */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    cursor: pointer;
    border: 1px solid var(--line);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px var(--shadow-amber-soft);
    border-color: rgba(242, 181, 68, 0.3);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* ===== LIGHTBOX ===== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 7, 5, 0.94);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 1.5rem;
    right: 2rem;
    font-size: 2.5rem;
    color: var(--text-dim);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    z-index: 2001;
}

.lightbox-close:hover {
    color: #fff;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 2rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
    z-index: 2001;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    color: #fff;
    background: rgba(255, 138, 61, 0.25);
}

.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    padding: 2.5rem 2rem;
    color: var(--text-faint);
    font-size: 0.9rem;
    background: #110c08;
    border-top: 1px solid var(--line-soft);
}

.footer .footer-brand {
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--gold), var(--amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.footer p {
    margin-top: 0.3rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .hero-logo {
        width: 130px;
        height: 130px;
    }

    .navbar .nav-links {
        gap: 1rem;
    }

    .navbar .nav-links a {
        font-size: 0.85rem;
    }

    .leaderboard-hero h1 {
        font-size: 2.4rem;
    }

    .year-section {
        padding: 0 1rem;
    }

    .stats-bar {
        padding: 0 1rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .navbar {
        flex-direction: column;
        gap: 0.8rem;
        padding: 0.8rem 1rem;
    }

    .leaderboard-hero h1 {
        font-size: 2rem;
    }

    .year-badge {
        font-size: 0.9rem;
        padding: 0.5rem 1.2rem;
    }

    .leaderboard-table thead th {
        font-size: 0.7rem;
        padding: 0.6rem 0.8rem;
    }

    .leaderboard-table tbody td {
        padding: 0.8rem;
        font-size: 0.85rem;
    }

    .stats-bar {
        gap: 1rem;
    }

    .stat-card {
        padding: 1rem 1.2rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }

    .lightbox-prev { left: 0.5rem; }
    .lightbox-next { right: 0.5rem; }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
