/* =============================================
   THEME.CSS — REFACTORED (DROP‑IN SAFE)
   Notes:
   - Keeps all original class names and cascade order so behavior remains the same.
   - Removes exact duplicates, consolidates variants, organizes logically.
   - Introduces CSS variables for easy theming; values match your current design.
   - Where the original file had multiple conflicting definitions, the LAST effective
     values from your file are preserved to avoid breaking changes.
   ============================================= */

:root {
  /* Colors */
  --clr-bg: #fafafa;
  --clr-fg: #222;
  --clr-muted: #666;
  --clr-primary: #c0392b;   /* final button/bg choice */
  --clr-primary-hover: #a93226;
  --clr-accent: #d35445;    /* legacy/alt button */
  --clr-success-bg: #d4edda;
  --clr-success-border: #c3e6cb;
  --clr-success-fg: #155724;
  --clr-warn-bg: #fff3cd;
  --clr-warn-border: #ffeeba;
  --clr-warn-fg: #856404;
  --clr-dark: #111;
  --clr-header: #111;
  --clr-white: #fff;
  --clr-border: #eee;

  /* Radii */
  --radius-4: 4px;
  --radius-6: 6px;
  --radius-8: 8px;
  --radius-10: 10px;
  --radius-12: 12px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
  --shadow-md: 0 2px 10px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 24px rgba(0,0,0,.25);
}

/* ===== Base Reset ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--clr-bg);
  color: var(--clr-fg);
  line-height: 1.6;
}

/* ===== Header ===== */
header {
  background: var(--clr-header);
  color: var(--clr-white);
  padding: .85rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 10;
}
header .brand { font-weight: 700; }
header a { color: var(--clr-white); text-decoration: none; margin-left: 1rem; }
#theme-toggle {
  margin-left: 1rem; padding: .35rem .65rem; border-radius: 6px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: var(--clr-white); cursor: pointer;
}

/* ===== Hero (Background image + overlay) ===== */
.hero_home {
  position: relative; min-height: 72vh; padding: 8rem 1rem 5rem; text-align: center;
  background: url('/assets/images/houston-bg.jpg') no-repeat center center / cover;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,.62), rgba(0,0,0,.35) 55%, rgba(0,0,0,.18));
}
.hero__content_home {
  position: relative; z-index: 1; max-width: 960px; margin: 0 auto; padding: .5rem;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}
.hero_home h1 {
  font-size: clamp(1.9rem, 3vw + 1rem, 3rem); color: var(--clr-white);
  text-shadow: 0 2px 8px rgba(0,0,0,.45); font-weight: 800;
}
.hero__sub_home {
  color: #e8e8e8; max-width: 760px; margin: .75rem auto 1.25rem;
  text-shadow: 0 1px 6px rgba(0,0,0,.4);
}
.hero__search { margin-top: .5rem; }
.hero__search input[type="text"] {
  width: min(60vw, 340px); padding: .6rem .75rem; background: rgba(255,255,255,.96);
  border: 1px solid rgba(0,0,0,.2); border-radius: 6px; outline: none;
}
.hero__search button { margin-left: .5rem; }

/* ===== Buttons (Consolidated) ===== */
button,
.btn { background: var(--clr-primary); color: var(--clr-white); border: none;
  border-radius: var(--radius-4); padding: .6rem .9rem; cursor: pointer;
  text-decoration: none; display: inline-block; box-shadow: none; }
button:hover,
.btn:hover { background: var(--clr-primary-hover); }

/* Legacy/alt button preserved for compatibility */
.btn-random { background: var(--clr-accent); color: var(--clr-white);
  border: none; border-radius: var(--radius-8); padding: .65rem 1rem; cursor: pointer;
  box-shadow: var(--shadow-lg); }
.btn-random:hover { filter: brightness(1.05); }

/* Variants */
.danger { background: #c62828; }
.danger:hover { background: #8e0000; }

/* ===== Main sections / cards ===== */
main { max-width: 900px; margin: 2rem auto; padding: 0 1rem; }
.section {
  background: var(--clr-white); border-radius: var(--radius-12);
  border: 1px solid var(--clr-border); box-shadow: var(--shadow-md);
  padding: 1rem; margin: 1.25rem 0; overflow-x: hidden;
}
.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: .75rem; }
.card { background: rgba(255,255,255,.92); border: 1px solid rgba(0,0,0,.08);
  box-shadow: var(--shadow-lg); border-radius: var(--radius-12); padding: 1rem;
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.card h3 { margin-bottom: .35rem; text-shadow: 0 1px 4px rgba(0,0,0,.25); }
.card p { text-shadow: 0 1px 4px rgba(0,0,0,.2); }

/* Alerts */
.alert { background: var(--clr-warn-bg); border: 1px solid var(--clr-warn-border); color: var(--clr-warn-fg);
  border-radius: var(--radius-6); padding: .75rem; margin: 1rem 0; }
.ok { background: var(--clr-success-bg); border: 1px solid var(--clr-success-border); color: var(--clr-success-fg);
  border-radius: var(--radius-6); padding: .75rem; margin: 1rem 0; }
.muted { color: var(--clr-muted); }
.pill { font-size: .8rem; padding: .15rem .5rem; border: 1px solid #ddd; border-radius: 999px; background: #f7f7f7; margin-right: .35rem; }

/* Lists / Layout helpers */
.list .card { background: var(--clr-white); border-radius: var(--radius-6); padding: 1rem; margin: .5rem 0; box-shadow: var(--shadow-sm);
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.pagination { display: flex; gap: .5rem; margin: 1rem 0; flex-wrap: wrap; }
.pagination a, .pagination span { padding: .4rem .65rem; border: 1px solid #ddd; border-radius: var(--radius-4); text-decoration: none; color: var(--clr-fg); background: var(--clr-white); }
.pagination .current { background: var(--clr-primary); color: var(--clr-white); border-color: var(--clr-primary); }
.flex { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Forms */
form.filters { display: grid; grid-template-columns: 1fr 180px 160px auto; gap: .5rem; margin: 0 0 1rem; }
form .row { display: grid; grid-template-columns: 220px 1fr; gap: .75rem; align-items: center; margin: .5rem 0; }
input[type="text"], select { padding: .55rem .7rem; border: 1px solid #ccc; border-radius: var(--radius-4); }
input, select, textarea { width: 100%; padding: .55rem .7rem; border: 1px solid #ccc; border-radius: var(--radius-4); }
.hp { display: none; }
.hint { font-size: .9rem; color: var(--clr-muted); margin: -.4rem 0 .2rem; }

/* Timeline (form + list styles) */
.tlist { display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }
.titem { border: 1px solid var(--clr-border); border-radius: var(--radius-10); padding: .75rem; background: var(--clr-white); }
.add-grid, .titem form { display: grid; grid-template-columns: 160px 1fr auto; column-gap: .75rem; align-items: center; }
.titem input[type=date] { padding-right: .6rem; min-width: 150px; }
.titem .actions { display: flex; gap: .5rem; white-space: nowrap; }

/* Search cards / grid sections */
form.search { display: flex; gap: .5rem; margin: 0 0 1rem; }
.card { border-radius: var(--radius-6); padding: 1rem; margin: .6rem 0; box-shadow: var(--shadow-sm); }
.toprow { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; }
.row { margin: .35rem 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
img.photo { width: 100%; height: 180px; object-fit: cover; border-radius: var(--radius-6); display: block; }
.top-links { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== Alternate Hero (Card style) — preserved order so it wins later as in original ===== */
.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; width: 100%;              
/* take full width of main grid/section */}
.hero { background: var(--clr-white); border-radius: var(--radius-8); overflow: hidden; box-shadow: var(--shadow-md); }
.hero img { width: 100%; height: 340px; object-fit: cover; display: block;}
.box { background: var(--clr-white); border-radius: var(--radius-8); box-shadow: var(--shadow-md); padding: 1rem; margin: 1rem 0; }
.table-wrapper { overflow-x: auto; }
table.events { width: 100%; border-collapse: collapse; }
table.events th, table.events td { border-bottom: 1px solid var(--clr-border); padding: .5rem .25rem; text-align: left; font-size: .95rem; }
iframe { width: 100%; border: 0; min-height: 700px; background: var(--clr-white); border-radius: var(--radius-8); box-shadow: var(--shadow-md); }

/* Timeline (card style) */
.timeline { display: flex; flex-direction: column; gap: 12px; }
.t-card { background: var(--clr-white); border: 1px solid var(--clr-border); border-radius: var(--radius-12);
  padding: 14px 14px 14px 56px; position: relative; box-shadow: var(--shadow-md); }
.t-year { position: absolute; left: 14px; top: 14px; background: var(--clr-dark); color: var(--clr-white);
  font-weight: 600; font-size: .9rem; padding: .2rem .55rem; border-radius: var(--radius-8); letter-spacing: .3px; }
.t-dot { position: absolute; left: 34px; top: 44px; width: 8px; height: 8px; border-radius: 50%; background: var(--clr-primary); }
.t-connector { position: absolute; left: 37px; top: 54px; bottom: 10px; width: 2px; background: var(--clr-border); }
.t-text { color: var(--clr-fg); line-height: 1.5; }

/* ===== Dark Theme ===== */
.dark-theme body,
body.dark-theme { background: #121212; color: #eee; }
body.dark-theme header { background: #000; }
body.dark-theme .section,
body.dark-theme .card { background: rgba(30,30,30,.92); border: 1px solid rgba(255,255,255,.08); color: #eee; }
body.dark-theme .hero__sub { color: #ddd; }
body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea { background: #1e1e1e; border: 1px solid #444; color: #eee; }

/* ===== Responsive ===== */
@media (max-width: 720px) {
  header nav a { margin-left: .75rem; }
}
@media (max-width:700px) { /* matches original breakpoints */
  form.filters { grid-template-columns: 1fr; }
  form .row { grid-template-columns: 1fr; }
}
@media (max-width:900px) {
  .grid { grid-template-columns: 1fr; }
  .hero img { height: 260px; }
}
/* Page stays single column */
.bar-layout{
  display: block;        /* no grid columns */
  margin-top: .75rem;
}

/* Photo + About pair */
.media-about{
  display: flex;
  flex-direction: column;    /* mobile: stacked */
  gap: 1rem;
}

/* Desktop: put About to the right (60/40) */
@media (min-width: 900px){
  .media-about{ flex-direction: row; align-items: flex-start; }
  .media-photo{ flex: 0 1 60%; max-width: 60%; }
  .about-box{  flex: 1 1 40%; max-width: 40%; }
}

/* Image styling */
.bar-page .bar-image,
.media-photo{
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
}

/* Optional spacing for boxes on the page */
.bar-layout .box{ margin-top: 1rem; }