/* =========================================================
   AOU RICA WELSH PONY STUD — Public Stylesheet
   Structurally mirrors Ödetorp's style.css (identical class
   names throughout) so public/*.php templates work unchanged
   across both stables. Only the palette, fonts, and the
   header/footer treatment differ.
   Palette drawn from the Aou Rica badge: navy, aged brass gold,
   sage green, warm cream/off-white.
   ========================================================= */

/* =========================================================
   00. VARIABLES & RESET
   ========================================================= */
:root {
    /* Core palette — same variable NAMES as Ödetorp for drop-in
       class compatibility, different values */
    --crimson:      #1c3550;   /* now navy */
    --crimson-dark: #122438;
    --crimson-mid:  #2b4a68;
    --gold:         #cdb888;
    --gold-light:   #e7dcc2;
    --gold-pale:    #f3ede0;
    --silver:       #b7c1c7;
    --silver-light: #dde3e7;

    /* Stable-specific accent (not in Ödetorp's palette) — the
       sage from the footer, used sparingly for secondary accents */
    --sage:         #a8b4ab;

    /* Neutrals */
    --cream:        #faf9f6;
    --warm-white:   #ffffff;
    --stone:        #eef1f2;
    --stone-mid:    #cdd3d8;
    --text-dark:    #1a1a1a;
    --text-mid:     #3d4448;
    --text-muted:   #6b7378;

    /* UI */
    --border:       #dde1e3;
    --card-shadow:  0 6px 18px rgba(0,0,0,0.08);
    --radius:       10px;

    /* Type scale */
    --font-display: 'Baloo 2', sans-serif;
    --font-body:    'Source Sans 3', system-ui, sans-serif;

    /* Aliases used by header/footer markup built earlier */
    --navy:         var(--crimson);
    --navy-dark:    var(--crimson-dark);
    --off-white:    var(--cream);
    --black:        var(--text-dark);
    --gray:         var(--text-muted);
    --font-heading: var(--font-display);
}

*, *::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; }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.5em;
}

.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;
}


/* =========================================================
   01a. HEADER — PLAIN BAR
   (used when no $hero_image is set, e.g. horse.php)
   ========================================================= */
.bar-header {
    background: var(--navy);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.30);
}
.bar-header .header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
    gap: 2rem;
}
.bar-header .site-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    flex-shrink: 0;
}
.bar-header .brand-logo-icon {
    height: 48px;
    width: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--gold);
}
.bar-header .brand-text { display: flex; flex-direction: column; }
.bar-header .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;
}
.bar-header .brand-tagline {
    font-size: 0.72rem;
    color: var(--gold-light);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 300;
}
.bar-header .site-nav ul {
    list-style: none;
    display: flex;
    gap: 0.25rem;
}
.bar-header .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;
}
.bar-header .site-nav a:hover,
.bar-header .site-nav a.active {
    color: var(--gold-light);
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}
.bar-header .site-nav li.has-children { position: relative; }
.bar-header .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--navy-dark);
    border-radius: var(--radius);
    overflow: hidden;
    min-width: 170px;
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    box-shadow: var(--card-shadow);
}
.bar-header .site-nav li.has-children:hover .sub-menu { display: block; }
.bar-header .sub-menu a { padding: 10px 16px; border-radius: 0; text-transform: none; letter-spacing: 0.02em; }


/* =========================================================
   01b. HEADER — HERO
   (used when $hero_image is set, e.g. index.php)
   ========================================================= */
.hero-header { background: var(--navy); }
.hero-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 6;
    min-height: 280px;
    overflow: hidden;
}
.hero-banner {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.hero-logo {
    position: absolute;
    top: 24px;
    left: 24px;
    width: clamp(90px, 14vw, 160px);
    aspect-ratio: 1;
    display: block;
}
.hero-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}
.hero-logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--navy);
    color: var(--gold-light);
    border-radius: 50%;
    border: 3px solid var(--gold);
    font-family: var(--font-display);
    font-weight: 700;
    text-align: center;
    padding: 8px;
}
.hero-nav {
    position: absolute;
    right: 24px;
    bottom: 24px;
}
.hero-nav ul {
    list-style: none;
    display: flex;
    margin: 0;
    padding: 0;
    background: var(--navy);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
}
.hero-nav a {
    display: block;
    padding: 16px 28px;
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.05em;
    white-space: nowrap;
}
.hero-nav a:hover { background: rgba(255,255,255,0.1); }
.hero-nav li.has-children { position: relative; }
.hero-nav li.has-children > a::after { content: ' ▾'; }
.hero-nav .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--navy-dark);
    list-style: none;
    margin: 0;
    padding: 0;
    min-width: 170px;
    border-radius: 0 0 var(--radius) var(--radius);
    overflow: hidden;
}
.hero-nav li.has-children:hover .sub-menu { display: block; }
.hero-nav .sub-menu a { padding: 12px 20px; }
.hero-toggle { display: none; }


/* =========================================================
   02. PAGE HEADING
   (used on inner content pages, e.g. "Startsida")
   ========================================================= */
.page-title {
    text-align: center;
    font-size: 2.6em;
    padding: 70px 24px;
    margin: 0;
}

.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-heading {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.35rem;
}

.section-divider {
    width: 48px;
    height: 3px;
    background: var(--crimson);
    margin: 0.75rem 0 2rem;
    border-radius: 2px;
}


/* =========================================================
   03. LAYOUT WRAPPERS
   ========================================================= */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 3rem 2rem;
}
.page-wrapper.narrow { max-width: 860px; }


/* =========================================================
   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 32px rgba(18,36,56,0.18);
}

.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); }

.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: 4px;
    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: 4px;
}


/* =========================================================
   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: normal;
    font-weight: 500;
    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: 20px;
    margin-bottom: 1rem;
}

.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);
  	clear: both;
}

.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: 4px;
    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: #b4824f;       color: #fff; }
.merit-placement.other  { background: var(--stone);  color: var(--text-mid); }

.merit-prize-thumb img { max-height: 150px; float: left; }

/* =========================================================
   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-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: 20px;
}
.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: 20px;
    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);
    border-top: 2px solid var(--text-dark);
    padding: 50px 24px 30px;
    margin-top: 4rem;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px 40px;
}
.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.footer-logo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    margin-bottom: 6px;
    object-fit: cover;
}
.footer-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.3em;
    color: var(--cream);
}
.footer-tagline { color: var(--text-muted); }
.footer-nav {
    grid-column: 2;
    display: flex;
    gap: 20px;
    align-items: start;
}
.footer-nav a { text-decoration: underline; color: var(--cream); }
.footer-nav a:hover { color: var(--crimson-dark); }
.footer-contact {
    grid-column: 2;
    display: flex;
    gap: 20px;
}
.footer-contact a { color: var(--cream); text-decoration: none; }
.footer-contact a:hover { text-decoration: underline; }
.footer-copy {
    grid-column: 1 / -1;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
}


/* =========================================================
   14. RESPONSIVE
   ========================================================= */
@media (max-width: 900px) {
    .horse-hero-inner { grid-template-columns: 1fr; }
    .horse-main-photo { max-width: 480px; }
    .pedigree-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    .hero-media { aspect-ratio: 4 / 5; min-height: 360px; }
    .hero-nav { position: static; margin-top: -1px; }
    .hero-nav ul { flex-direction: column; border-radius: 0; display: none; }
    .hero-nav ul.open { display: flex; }
    .hero-toggle { display: flex; position: absolute; top: 24px; right: 24px; }
}

@media (max-width: 640px) {
    .nav-toggle { display: flex; }
    .bar-header .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);
    }
    .bar-header .site-nav.open { display: block; }
    .bar-header .site-nav ul { flex-direction: column; }
    .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 (max-width: 600px) {
    .footer-inner { grid-template-columns: 1fr; }
    .footer-nav, .footer-contact { grid-column: 1; flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}