/* =========================================================
   ÖDETORP HAFLINGER STUD — Public Stylesheet
   Palette drawn from logo: crimson, flaxen gold, silver, cream
   ========================================================= */

/* =========================================================
   00. VARIABLES & RESET
   ========================================================= */
:root {
    /* Core palette */
    --crimson:      #8C1D24;
    --crimson-dark: #5e1219;
    --crimson-mid:  #a82830;
    --gold:         #C9973A;
    --gold-light:   #E2BB72;
    --gold-pale:    #F5E9CC;
    --silver:       #A8B4BC;
    --silver-light: #D6DDE2;

    /* Neutrals */
    --cream:        #FAF7F2;
    --warm-white:   #FFFFFF;
    --stone:        #EDE8DF;
    --stone-mid:    #C8BDA8;
    --text-dark:    #1E1710;
    --text-mid:     #4A3F35;
    --text-muted:   #7A6F65;

    /* UI */
    --border:       #DDD5C8;
    --card-shadow:  0 4px 24px rgba(30,23,16,0.10);
    --radius:       6px;

    /* Type scale */
    --font-display: 'Playfair Display', Georgia, serif;
    --font-body:    'Source Sans 3', system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text-dark);
    background: var(--cream);
}

img { max-width: 100%; height: auto; display: block; }
a   { color: var(--crimson); text-decoration: none; }
a:hover { color: var(--crimson-mid); text-decoration: underline; }

/* =========================================================
   01. HEADER & NAV
   ========================================================= */
.site-header {
    background: var(--crimson-dark);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.30);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 2rem;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    flex-shrink: 0;
}

.site-brand img.brand-logo {
    height: 48px;
    width: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
}

.brand-text { display: flex; flex-direction: column; }

.brand-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cream);
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.brand-tagline {
    font-size: 0.72rem;
    color: var(--gold-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 300;
}

.site-nav ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
}

.site-nav a {
    display: block;
    padding: 0.45rem 1rem;
    color: var(--silver-light);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: var(--radius);
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--gold-light);
    background: rgba(255,255,255,0.07);
    text-decoration: none;
}

/* Dropdown submenus — rendered by render_menu_items() in helpers.php as
   <li class="has-children"><a>...</a><ul class="sub-menu">...</ul></li> */
.site-nav li.has-children {
    position: relative;
}

.site-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--crimson-dark);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 170px;
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    box-shadow: var(--card-shadow);
    z-index: 10;
}

.site-nav li.has-children:hover .sub-menu {
    display: block;
}

.site-nav .sub-menu a {
    padding: 10px 16px;
    border-radius: 0;
    text-transform: none;
    letter-spacing: 0.02em;
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--cream);
    border-radius: 2px;
    transition: 0.3s;
}

/* =========================================================
   02. HERO
   ========================================================= */
.site-hero {
    position: relative;
    height: 520px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(94,18,25,0.55) 0%,
        rgba(30,23,16,0.35) 50%,
        rgba(30,23,16,0.72) 100%
    );
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--cream);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.hero-logo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 3px solid var(--gold);
    box-shadow: 0 0 0 6px rgba(201,151,58,0.22), 0 8px 32px rgba(0,0,0,0.45);
    object-fit: cover;
}

.hero-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 3rem);
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

.hero-sub {
    font-size: 1rem;
    font-weight: 300;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gold-light);
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

.hero-divider {
    width: 60px;
    height: 2px;
    background: var(--gold);
    opacity: 0.7;
}

/* =========================================================
   03. LAYOUT WRAPPERS
   ========================================================= */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

.page-wrapper.narrow {
    max-width: 860px;
}

.section-heading {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
}

.section-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gold);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.section-divider {
    width: 48px;
    height: 3px;
    background: var(--crimson);
    margin: 0.75rem 0 2rem;
    border-radius: 2px;
}

/* =========================================================
   04. HORSE GRID
   ========================================================= */
.horse-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.75rem;
}

.horse-card {
    background: var(--warm-white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    position: relative;
}

.horse-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 36px rgba(30,23,16,0.16);
}

.horse-card-thumb {
    position: relative;
    height: 220px;
    overflow: hidden;
    background: var(--stone);
}

.horse-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.horse-card:hover .horse-card-thumb img {
    transform: scale(1.04);
}

/* Status badges */
.horse-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--crimson-dark);
    color: var(--cream);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 3px;
    z-index: 2;
}

.horse-badge.reserved {
    background: var(--gold);
    color: var(--text-dark);
}

.horse-card-body {
    padding: 1rem 1.1rem 1.25rem;
}

.horse-card-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.2rem;
    line-height: 1.2;
}

.horse-card-name a {
    color: inherit;
    text-decoration: none;
}

.horse-card-name a:hover {
    color: var(--crimson);
}

.horse-card-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
}

.horse-card-meta span { display: flex; align-items: center; gap: 0.3rem; }

.horse-card-disciplines {
    margin-top: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.disc-tag {
    background: var(--gold-pale);
    color: var(--text-mid);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 3px;
}

/* =========================================================
   05. SINGLE HORSE PAGE
   ========================================================= */
.horse-hero {
    background: var(--stone);
    border-bottom: 1px solid var(--border);
}

.horse-hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 3rem;
    align-items: start;
}

.horse-main-photo {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
    aspect-ratio: 4/3;
    background: var(--stone);
}

.horse-main-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.horse-header-info { padding-top: 0.5rem; }

.horse-name-heading {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
}

.horse-nickname {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.horse-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem 1.5rem;
    margin-bottom: 1.5rem;
}

.horse-fact { font-size: 0.9rem; }
.horse-fact strong { color: var(--text-mid); display: block; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; }
.horse-fact span   { color: var(--text-dark); }

.horse-age-badge {
    display: inline-block;
    background: var(--crimson);
    color: var(--cream);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 6px 18px;
    border-radius: 3px;
    margin-bottom: 1rem;
}

/* Tabs on single horse */
.horse-tabs-nav {
    border-bottom: 2px solid var(--border);
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
}

.horse-tab-btn {
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
    letter-spacing: 0.04em;
}

.horse-tab-btn:hover  { color: var(--crimson); }
.horse-tab-btn.active { color: var(--crimson); border-bottom-color: var(--crimson); }

.horse-tab-panel { display: none; }
.horse-tab-panel.active { display: block; }

/* =========================================================
   06. MERITS TABLE
   ========================================================= */
.merits-section h3 {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-dark);
    margin: 1.5rem 0 0.75rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}

.merit-highlight-box {
    background: var(--gold-pale);
    border-left: 4px solid var(--gold);
    padding: 1rem 1.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1.5rem;
}

.merit-highlight-box h4 {
    font-family: var(--font-display);
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    background: var(--crimson-dark);
    color: var(--cream);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.6rem 0.9rem;
    text-align: left;
    font-weight: 600;
}

.data-table td {
    padding: 0.55rem 0.9rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-mid);
    vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--stone); }

.merit-placement {
    display: inline-block;
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.82rem;
}

.merit-placement.gold   { background: var(--gold);    color: var(--text-dark); }
.merit-placement.silver { background: var(--silver);  color: var(--text-dark); }
.merit-placement.bronze { background: #b87333;        color: #fff; }
.merit-placement.other  { background: var(--stone);   color: var(--text-mid); }

/* =========================================================
   07. PEDIGREE TABLE
   ========================================================= */
.pedigree-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 0.82rem;
}

.ped-col {
    border-right: 1px solid var(--border);
}

.ped-cell {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
}

.ped-label {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    display: block;
    margin-bottom: 1px;
}

.ped-name {
    font-weight: 600;
    color: var(--text-dark);
}

.ped-name a { color: var(--crimson); }

.ped-col-header {
    background: var(--crimson-dark);
    color: var(--cream);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    text-align: center;
}

/* =========================================================
   08. OFFSPRING TABLE
   ========================================================= */
.offspring-section { margin-top: 1rem; }

/* =========================================================
   09. GALLERY GRID
   ========================================================= */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
}

.gallery-thumb {
    aspect-ratio: 4/3;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--stone);
    cursor: pointer;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.gallery-thumb:hover img { transform: scale(1.06); }

/* Lightbox */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.88);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay.open { display: flex; }

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    box-shadow: 0 8px 48px rgba(0,0,0,0.7);
}

.lightbox-close {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
    font-size: 1.5rem;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =========================================================
   10. DISCIPLINES LIST (single horse)
   ========================================================= */
.disc-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.disc-list li {
    background: var(--stone);
    border: 1px solid var(--border);
    color: var(--text-mid);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 5px 14px;
    border-radius: 3px;
}

.disc-list li .disc-level {
    color: var(--crimson);
    font-weight: 700;
    margin-right: 4px;
}

/* =========================================================
   11. GENERIC PAGE CONTENT
   ========================================================= */
.page-content {
    max-width: 720px;
    font-size: 1.02rem;
    color: var(--text-mid);
    line-height: 1.8;
}

.page-content h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 2rem 0 0.75rem;
}

.page-content p { margin-bottom: 1rem; }

/* =========================================================
   12. UTILITY & MESSAGES
   ========================================================= */
.btn {
    display: inline-block;
    padding: 0.6rem 1.4rem;
    border-radius: var(--radius);
    font-size: 0.88rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: none;
    transition: background 0.2s, transform 0.15s;
    text-decoration: none;
}

.btn-primary { background: var(--crimson); color: var(--cream); }
.btn-primary:hover { background: var(--crimson-mid); color: var(--cream); text-decoration: none; }

.btn-gold { background: var(--gold); color: var(--text-dark); }
.btn-gold:hover { background: var(--gold-light); color: var(--text-dark); text-decoration: none; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--crimson);
    color: var(--crimson);
}
.btn-outline:hover { background: var(--crimson); color: var(--cream); text-decoration: none; }

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
}

.empty-state p { font-size: 1.05rem; }

/* =========================================================
   13. FOOTER
   ========================================================= */
.site-footer {
    background: var(--crimson-dark);
    color: var(--silver-light);
    margin-top: 4rem;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 2rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
}

.footer-logo {
    width: 130px;
    height: 130px;
    object-fit: cover;
    float: left;
    display: inline-block;
}

.footer-name {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--cream);
    font-weight: 700;
    float: left;
}

.footer-est {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--gold-light);
    float: left;
}

.footer-nav {
    display: flex;
    gap: 1.5rem;
}

.footer-nav a {
    color: var(--silver-light);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
}

.footer-nav a:hover { color: var(--gold-light); }

.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: flex-end;
}

.footer-contact a {
    color: var(--silver-light);
    font-size: 0.85rem;
    text-decoration: none;
}

.footer-contact a:hover { color: var(--gold-light); }

.footer-copy {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.78rem;
    color: var(--silver);
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    margin-top: 0.5rem;
}

/* =========================================================
   14. RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
    .horse-hero-inner { grid-template-columns: 1fr; }
    .horse-main-photo { max-width: 480px; }
    .footer-inner { grid-template-columns: 1fr; text-align: center; }
    .footer-contact { align-items: center; }
    .footer-nav { justify-content: center; }
    .pedigree-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .site-hero { height: 400px; }
    .hero-logo { width: 90px; height: 90px; }
    .nav-toggle { display: flex; }
    .site-nav {
        position: absolute;
        top: 72px;
        left: 0;
        right: 0;
        background: var(--crimson-dark);
        padding: 1rem;
        display: none;
        box-shadow: 0 6px 20px rgba(0,0,0,0.3);
    }
    .site-nav.open { display: block; }
    .site-nav ul { flex-direction: column; }
    .site-nav .sub-menu {
        position: static;
        display: block;
        background: transparent;
        box-shadow: none;
        padding-left: 1rem;
        margin-top: 4px;
    }
    .horse-facts { grid-template-columns: 1fr; }
    .pedigree-grid { grid-template-columns: 1fr; }
    .horse-tabs-nav { overflow-x: auto; }
    .horse-tab-btn { white-space: nowrap; padding: 0.75rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}