/* --------------------------------------------------
   BHR Center — main styles (mobile-first, responsive)
   Brand palette only:
     Primary: #072240
     Accent : #C3B59B
     Neutrals: white / black
   All tints/shadows use alpha from these colors only.
-------------------------------------------------- */

/* ---------- Light theme (default) ---------- */
:root {
  /* Base hex */
  --primary: #072240;        /* deep navy */
  --accent:  #C3B59B;        /* sand/beige */
  --bg:      #ffffff;        /* white */
  --ink:     #000000;        /* black */

  /* RGB helpers for alpha tints */
  --primary-rgb: 7, 34, 64;        /* #072240 */
  --accent-rgb:  195, 181, 155;    /* #C3B59B */
  --black-rgb:   0, 0, 0;          /* black */
  --white-rgb:   255, 255, 255;    /* white */

  /* Surfaces & lines (derived) */
  --muted:  rgba(var(--black-rgb), .65);     /* subtle text */
  --card:   rgba(var(--white-rgb), 1);       /* cards/surfaces */
  --border: rgba(var(--primary-rgb), .18);   /* hairlines */
  --ring:   rgba(var(--accent-rgb), .40);    /* focus/hover ring */
  --soft:   rgba(var(--accent-rgb), .12);    /* soft hover bg */

  /* Buttons (themeable) */
  --btn-bg: var(--primary);
  --btn-fg: #ffffff;
  --btn-border: transparent;
  --btn-ghost-fg: var(--ink);
  --btn-ghost-border: var(--border);
}

/* ---------- Dark theme (explicit) ----------
   YOUR REQUEST: main bg = #072240 (primary), text = #C3B59B (accent)
-------------------------------------------------- */
html[data-theme="dark"] {
  --bg:      #072240;                           /* primary solid */
  --ink:     #C3B59B;                           /* accent text */
  --muted:   rgba(var(--accent-rgb), .85);
  --card:    rgba(var(--black-rgb), .28);       /* darker panels */
  --border:  rgba(var(--white-rgb), .18);       /* subtle line on primary */
  --ring:    rgba(var(--accent-rgb), .55);
  --soft:    rgba(var(--white-rgb), .08);

  /* Buttons in dark: accent-filled with primary text */
  --btn-bg: #C3B59B;          /* accent */
  --btn-fg: #072240;          /* primary text */
  --btn-border: transparent;
  --btn-ghost-fg: #C3B59B;    /* accent */
  --btn-ghost-border: rgba(var(--white-rgb), .25);
}

/* ---------- Respect system preference when data-theme="auto" ---------- */
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg:      #072240;
    --ink:     #C3B59B;
    --muted:   rgba(var(--accent-rgb), .85);
    --card:    rgba(var(--black-rgb), .28);
    --border:  rgba(var(--white-rgb), .18);
    --ring:    rgba(var(--accent-rgb), .55);
    --soft:    rgba(var(--white-rgb), .08);

    --btn-bg: #C3B59B;
    --btn-fg: #072240;
    --btn-border: transparent;
    --btn-ghost-fg: #C3B59B;
    --btn-ghost-border: rgba(var(--white-rgb), .25);
  }
}

/* Reset / layout */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,"Noto Sans",sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.wrap {
  max-width: 1100px;
  width: 100%;
  margin-inline: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.site-header, .site-footer {
  display: flex;
  align-items: flex-start;   /* allows 2-line nav to hug the top */
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem 0;
}

.site-main { padding: 1rem 0 2rem; flex: 1; }

/* Brand */
.brand {
  display:flex; align-items:center; gap:.75rem;
  text-decoration:none; color:inherit;
}
.brand__logo-img {
  width: 110px; height: 110px;
  border-radius: 12px;
  object-fit: cover;
  display: block;
  border: 1px solid var(--border);
  background: #fff; /* real white keeps logos crisp */
}
@media (max-width: 480px){
  .brand__logo-img { width: 72px; height: 72px; }
}
.brand__name {
  font-weight: 1000;
  letter-spacing: .2px;
  font-size: clamp(1.2rem, 3.8vw, 1.9rem);
}

/* ====== NAV (header right): TWO LINES ====== */
.nav{
  display: grid;
  grid-auto-rows: min-content;
  gap: .35rem;
  justify-items: end;        /* becomes inline-start in RTL automatically */
}
.nav__line{
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
@media (max-width: 520px){
  .nav { justify-items: start; }
}

/* Buttons (use theme vars above) */
.btn {
  background: var(--btn-bg);
  color: var(--btn-fg);
  padding: .6rem .95rem;
  border-radius: .75rem;
  border: 1px solid var(--btn-border);
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .4rem;
  font-weight: 700;
  transition: box-shadow .15s ease, transform .06s ease, background .15s ease, color .15s ease;
  box-shadow: none;
}
.btn:hover   { box-shadow: 0 0 0 2px var(--ring) inset; }
.btn:active  { transform: translateY(1px); }

.btn--ghost  {
  background: transparent;
  color: var(--btn-ghost-fg);
  border: 1px solid var(--btn-ghost-border);
}
.btn--ghost:hover { background: var(--soft); border-color: var(--ring); }

/* Icon button */
.icon-btn {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: .7rem;
  padding: .5rem .6rem;
  cursor: pointer;
  transition: box-shadow .15s ease, background .15s ease, border-color .15s ease;
  color: inherit;
}
.icon-btn:hover { border-color: var(--ring); box-shadow: 0 0 0 2px var(--soft) inset; }

/* Language dropdown */
.lang { position: relative; }
.pill {
  display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .65rem;
  border-radius: 999px; background: var(--card); border: 1px solid var(--border); cursor: pointer;
  font-weight: 600; color: inherit;
}
.pill__flag { font-size: 16px; }
.pill__label { font-size: 12px; opacity: .9; }
.lang__menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + .4rem); min-width: 180px;
  background: var(--card); border: 1px solid var(--border); border-radius: .8rem;
  box-shadow: 0 10px 30px rgba(var(--black-rgb), .15); padding: .4rem; z-index: 20;
}
.lang__item {
  display: flex; align-items: center; gap: .6rem; padding: .55rem .6rem; border-radius: .6rem; color: inherit; text-decoration: none;
}
.lang__item:hover { background: var(--soft); }

/* ====== SUBNAV (under header) with PHOTO BACKGROUND ======
   Put image at /assets/img/subnav-bg.jpg (or .png). Bump ?v=N when replacing.
   Links remain white for reliable contrast over photos.
*/
.subnav {
  position: relative;
  overflow: visible;                /* allow dropdowns to extend outside */
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: .6rem;
  padding: .4rem .6rem;
  margin: .2rem 0 1rem;
  background: transparent;          /* image is rendered via ::before */
  isolation: isolate;               /* ensure overlay stacking works */
  z-index: 20;                      /* keep above page content */
}
.subnav::before {
  content: "";
  position: absolute;
  inset: 0;                         /* match the bar’s size exactly */
  background-image: url('/assets/img/subnav-bg.png?v=1');
  background-repeat: no-repeat;
  background-size: cover;           /* fill the bar; crop as needed */
  background-position: center center;
  z-index: 0;
}
.subnav::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(var(--black-rgb), .25),    /* subtle dark veil for legibility */
    rgba(var(--black-rgb), .25)
  );
  z-index: 1;
}

/* Ensure the controls sit above the overlays */
.subnav__toggle,
.subnav__links { position: relative; z-index: 2; }

/* Toggle button + links (white over photo for accessibility) */
.subnav__toggle {
  display: none;                               /* visible only on mobile */
  background: rgba(0,0,0,.28);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: .6rem;
  padding: .5rem .6rem;
  cursor: pointer;
  text-shadow: 0 1px 1px rgba(0,0,0,.4);
}
.subnav__toggle:hover { background: rgba(0,0,0,.35); }

.subnav__links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .2rem 0;
}
.subnav__links a {
  text-decoration: none;
  color: #ffffff;                              /* force white on photo */
  padding: .45rem .55rem;
  border-radius: .6rem;
  border: 1px solid transparent;
  text-shadow: 0 1px 1px rgba(0,0,0,.35);
}
.subnav__links a:hover {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.25);
}

/* Subnav dropdown (users area) */
.subnav__menu { list-style: none; margin: 0; padding: 0; align-items: center; }
.subnav__menu > li { position: relative; }
.subnav__group { padding-bottom: .3rem; }
.subnav__label { background: rgba(0,0,0,.28); color:#fff; border:1px solid rgba(255,255,255,.3); border-radius:.6rem; padding:.45rem .55rem; cursor:pointer; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.subnav__label::after{ content:'▾'; margin-inline-start:.4rem; font-size:12px; opacity:.9; }
.subnav__submenu { position:absolute; inset-inline-start:0; inset-block-start: calc(100% - .3rem); min-width: 220px; list-style:none; padding:.4rem; margin:0; border-radius:.6rem; background: rgba(0,0,0,.30); backdrop-filter: blur(2px); border:1px solid rgba(255,255,255,.35); box-shadow:0 10px 24px rgba(0,0,0,.25); display:none; max-width:min(92vw, 320px); z-index: 1000; }
.subnav__submenu.is-align-end{ inset-inline-start:auto; inset-inline-end:0; }
.subnav__sublink { display:block; padding:.45rem .55rem; color:#fff; text-decoration:none; border-radius:.5rem; }
.subnav__sublink:hover{ background: rgba(255,255,255,.15); }

@media (hover: hover) and (pointer: fine){
  .subnav__group:hover > .subnav__submenu{ display:block; }
  .subnav__group:hover > .subnav__label::after{ content:'▴'; }
}

/* Mobile: hamburger toggle to expand/collapse links */
@media (max-width: 800px){
  .subnav__toggle { display: inline-flex; align-items: center; gap: .5rem; }
  .subnav__links { display: none; }
  .subnav.open .subnav__links {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    margin-top: .4rem;
    border-top: 1px dashed rgba(255,255,255,.35);
    padding-top: .4rem;
  }
  /* mobile dropdowns in-flow */
  .subnav__submenu{ position: static; display:none; border:1px dashed rgba(255,255,255,.35); box-shadow:none; margin-top:.3rem; backdrop-filter:none; }
  .subnav__group.is-open > .subnav__submenu{ display:block; }
  .subnav__group.is-open > .subnav__label::after{ content:'▴'; }
}

/* RTL tweaks for subnav */
[dir="rtl"] .subnav__label::after{ margin-inline-start:0; margin-inline-end:.4rem; }
[dir="rtl"] .subnav__submenu{ inset-inline-start:auto; inset-inline-end:0; }
[dir="rtl"] .subnav__links,
[dir="rtl"] .subnav__menu{ justify-content: flex-end; flex-direction: row-reverse; }

/* Hero */
.hero { padding: 2rem 0 1rem; }
.hero h1 { margin: 0 0 .5rem; font-size: clamp(1.4rem, 4vw, 2.2rem); }
.muted { color: var(--muted); }

/* ====== IMAGE TILES (home services) ====== */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .tiles { grid-template-columns: 1fr; } }

.tile {
  position: relative;
  display: block;
  height: 220px;
  border-radius: 1rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000; /* keeps image fade-in clean */
  text-decoration: none;
  color: inherit;
}
.tile__img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}
.tile__label {
  position: absolute;
  inset-inline-start: .9rem;
  inset-block-end: .9rem;
  background: rgba(var(--black-rgb), .45);   /* readable on varied photos */
  color: #fff;
  padding: .45rem .7rem;
  border-radius: .6rem;
  font-weight: 800;
  letter-spacing: .2px;
  border: 1px solid rgba(255,255,255,.2);
}
.tile__overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 1rem;
  background: radial-gradient(120% 120% at 50% 50%,
              rgba(0,0,0,.65), rgba(0,0,0,.85)); /* black-only tint */
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  text-align: center;
}
.tile__overlay p { margin: 0; line-height: 1.4; }
.tile:hover .tile__img { transform: scale(1.06); }
.tile:hover .tile__overlay { opacity: 1; pointer-events: auto; }

/* Mobile tap-to-open (JS toggles .is-open) */
@media (hover: none) and (pointer: coarse) {
  .tile:hover .tile__overlay { opacity: 0; pointer-events: none; }
  .tile.is-open .tile__overlay { opacity: 1; pointer-events: auto; }
}

/* Content pages */
.page-head { padding: 1rem 0; }
.content { display: grid; gap: 1rem; }
.narrow { max-width: 520px; margin-inline: auto; }
.form label { display: grid; gap: .35rem; margin: .5rem 0; }
input, textarea, select {
  font: inherit; padding: .6rem .7rem; border-radius: .6rem; border: 1px solid var(--border);
  background: transparent; color: inherit; width: 100%;
}
.form__password-input {
  position: relative;
  display: flex;
  align-items: center;
}
.form__password-input input[data-pass-field] {
  padding-right: 2.5rem;
}
.form__password-toggle {
  position: absolute;
  right: .65rem;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: inherit;
}
[data-theme="dark"] .form__password-toggle { color: inherit; }
.form__password-toggle:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Simple responsive grid helpers used in forms */
.grid-2, .grid-3, .grid-4, .grid-5 { display: grid; gap: .75rem; }
@media (min-width: 900px){
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-5 { grid-template-columns: repeat(5, 1fr); }
}

/* Ensure label contents line up nicely inside grids */
.form .grid-2 label, .form .grid-3 label, .form .grid-4 label, .form .grid-5 label { margin: 0; }

/* ---------- Cards (users area) ---------- */
.cards { display: grid; gap: 12px; }
@media (min-width: 720px){ .cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px){ .cards { grid-template-columns: repeat(3, 1fr); } }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(var(--black-rgb), .06);
  overflow: hidden;
  transition: box-shadow .18s ease, border-color .18s ease, transform .08s ease;
}
.card:hover {
  box-shadow: 0 8px 24px rgba(var(--black-rgb), .12);
  border-color: var(--ring);
  transform: translateY(-1px);
}
.card__media { position: relative; width: 100%; padding-top: 56%; background-size: cover; background-position: center; border-bottom: 1px solid var(--border); }
.card__body { padding: 12px; }
.card__title { font-weight: 800; margin: 2px 0 6px; font-size: 1rem; }
.card__meta { font-size: .9rem; opacity: .9; }

/* Users → Horses: ancestry details contrast in dark mode */
.card__meta strong { color: inherit; }
.card__meta a { color: inherit; text-decoration: underline; text-decoration-thickness: .06em; text-underline-offset: .18em; }
.slot__thumb{ display:flex; align-items:center; gap:.4rem; margin-top:.3rem }

/* Alerts (palette-only) */
.alert {
  padding: .8rem 1rem; border-radius: .6rem; margin: .6rem 0;
  border: 1px solid var(--border);
}
.alert--success {
  background: rgba(var(--accent-rgb), .20);  /* accent wash */
  color: var(--ink);
}
.alert--error {
  background: rgba(var(--black-rgb), .10);   /* black wash (light) */
  color: var(--ink);
}
html[data-theme="dark"] .alert--error {
  background: rgba(var(--white-rgb), .08);   /* white wash (dark) */
  color: var(--ink);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem; margin-top: 2rem;
  flex-wrap: wrap; gap: .6rem;
}
.footer__social { display: flex; gap: .7rem; align-items: center; }
.footer__social a {
  color: inherit; text-decoration: none; border-bottom: 1px dashed transparent;
}
.footer__social a:hover { border-color: var(--accent); }

/* Splash Screen — larger logo */
.splash {
  position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 9999;
  transition: opacity .35s ease, visibility .35s ease;
}
.splash[hidden] { opacity: 0; visibility: hidden; }
.splash__inner { text-align: center; }
.splash__logo-img {
  width: 96px; height: 96px;
  border-radius: 20px; object-fit: cover;
  display: block; margin-inline: auto; border: 1px solid var(--border); background: #fff;
}
.splash__brand { margin-top: .6rem; font-weight: 900; letter-spacing: .3px; font-size: 1.1rem; }

/* Optional: hint that accents drive UI */
a, .brand__name { accent-color: var(--accent); }

/* Ensure inline links in auth forms are readable in both themes */
.form a, .muted a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: .18em;
  text-decoration-thickness: .06em;
}


/* Avatar dropdown (LTR/RTL-safe via logical props) */
.avatar-menu { position: relative; }
.avatar-btn { background: transparent; border: 0; padding: 0; cursor: pointer; border-radius: 50%; }
.avatar-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }

.avatar-menu__dropdown {
  position: absolute;
  inset-inline-end: 0; /* right in LTR, left in RTL */
  top: 48px;
  min-inline-size: 180px;
  background: var(--c-surface, #fff);
  border: 1px solid var(--c-border, #e5e7eb);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.08);
  padding: 8px;
  z-index: 1000;
}
.avatar-menu__item { display: block; padding: 10px 12px; text-decoration: none; color: inherit; border-radius: 8px; }
.avatar-menu__item:hover { background: var(--c-hover, #f6f7f9); }
.avatar-menu__btn { background: none; border: 0; padding: 0; width: 100%; text-align: start; font: inherit; cursor: pointer; color: inherit; }
