/*!
 * Cowboy - Joomla 6 site template
 * Dependency-free: CSS Grid layout, no framework, no build step.
 * Registered in joomla.asset.json as "template.cowboy".
 *
 * --cw-primary, --cw-text and --cw-width are overridden at runtime from the
 * template style parameters (see index.php). Everything else derives from them.
 */

/* ------------------------------------------------------------------
   1. Tokens
------------------------------------------------------------------- */
:root {
  --cw-primary: #7a3e1d;
  --cw-text: #2b1d12;
  --cw-width: 1200px;

  --cw-gold: #c9902b;
  --cw-sand: #f6ecd8;
  --cw-paper: #fffaf0;

  --cw-primary-dark: color-mix(in srgb, var(--cw-primary) 65%, #000);
  --cw-primary-tint: color-mix(in srgb, var(--cw-primary) 8%, var(--cw-paper));
  --cw-line: color-mix(in srgb, var(--cw-primary) 30%, transparent);
  --cw-muted: color-mix(in srgb, var(--cw-text) 65%, var(--cw-paper));

  --cw-radius: 6px;
  --cw-gap: clamp(1rem, 2.5vw, 2rem);
  --cw-sidebar: 19rem;

  --cw-font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --cw-font-head: Rockwell, "Rockwell Nova", "Roboto Slab", "Courier New", Georgia, serif;
}

/* ------------------------------------------------------------------
   2. Base
------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cw-sand);
  color: var(--cw-text);
  font-family: var(--cw-font-body);
  font-size: 1rem;
  line-height: 1.6;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 .6em;
  color: var(--cw-primary-dark);
  font-family: var(--cw-font-head);
  line-height: 1.2;
}

h1 { font-size: clamp(1.75rem, 3vw + 1rem, 2.5rem); }
h2 { font-size: clamp(1.4rem, 2vw + .9rem, 1.9rem); }
h3 { font-size: 1.25rem; }

p,
ul,
ol,
dl,
blockquote,
table,
figure {
  margin: 0 0 1em;
}

a {
  color: var(--cw-primary);
  text-underline-offset: .18em;
}

a:hover,
a:focus-visible {
  color: var(--cw-primary-dark);
}

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

hr {
  border: 0;
  border-top: 1px solid var(--cw-line);
  margin: 1.5rem 0;
}

blockquote {
  padding: .25rem 1rem;
  border-inline-start: 4px solid var(--cw-gold);
  background: var(--cw-primary-tint);
}

.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  top: -4rem;
  z-index: 100;
  padding: .5rem 1rem;
  background: var(--cw-paper);
  color: var(--cw-primary-dark);
  border: 2px solid var(--cw-gold);
  border-radius: var(--cw-radius);
}

.skip-link:focus {
  top: 1rem;
}

.container {
  width: min(100% - 2 * var(--cw-gap), var(--cw-width));
  margin-inline: auto;
}

/* ------------------------------------------------------------------
   3. Page grid - sticky footer
   Three rows: top (announcement + header + menu) / main / bottom.
   The middle row takes all leftover height, so the footer sits at the
   bottom of the viewport on short pages.
------------------------------------------------------------------- */
.site-grid {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ------------------------------------------------------------------
   4. Top: announcement, header, menu
------------------------------------------------------------------- */
.site-announcement {
  background: var(--cw-primary-dark);
  color: var(--cw-paper);
  font-size: .9rem;
  padding-block: .4rem;
  text-align: center;
}

.site-announcement a {
  color: var(--cw-gold);
}

.site-announcement p:last-child {
  margin-bottom: 0;
}

.site-header {
  background: var(--cw-paper);
  border-bottom: 4px double var(--cw-primary);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  color: var(--cw-primary-dark);
  text-decoration: none;
}

.brand-star {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
}

.brand-name {
  font-family: var(--cw-font-head);
  font-size: clamp(1.4rem, 2.5vw + .8rem, 2.1rem);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.header-modules > :last-child {
  margin-bottom: 0;
}

.site-nav {
  background: var(--cw-primary-dark);
  color: var(--cw-paper);
}

.nav-toggle {
  display: none;
  align-items: center;
  gap: .6rem;
  margin-block: .5rem;
  padding: .5rem .9rem;
  border: 1px solid var(--cw-gold);
  border-radius: var(--cw-radius);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  content: "";
}

.nav-toggle-bars {
  position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  position: absolute;
  inset-inline-start: 0;
}

.nav-toggle-bars::before { top: -6px; }
.nav-toggle-bars::after  { top: 6px; }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li {
  position: relative;
  margin: 0;
}

.site-nav a,
.site-nav .mod-menu__heading,
.site-nav .nav-header {
  display: block;
  padding: .85rem 1.1rem;
  color: var(--cw-paper);
  font-weight: 600;
  letter-spacing: .03em;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav li.active > a,
.site-nav li.current > a {
  background: color-mix(in srgb, var(--cw-gold) 30%, var(--cw-primary-dark));
  color: #fff;
}

.site-nav li.active > a,
.site-nav li.current > a {
  box-shadow: inset 0 -3px 0 var(--cw-gold);
}

/* Drop-down sub menus (desktop) */
.site-nav .mod-menu__sub {
  position: absolute;
  inset-inline-start: 0;
  top: 100%;
  z-index: 20;
  display: none;
  flex-direction: column;
  min-width: 13rem;
  background: var(--cw-primary-dark);
  border-top: 3px solid var(--cw-gold);
  box-shadow: 0 8px 20px rgb(0 0 0 / .25);
}

.site-nav li:hover > .mod-menu__sub,
.site-nav li:focus-within > .mod-menu__sub {
  display: flex;
}

/* ------------------------------------------------------------------
   5. Main: content + auto-collapsing sidebar
------------------------------------------------------------------- */
.site-main {
  padding-block: var(--cw-gap);
}

.layout {
  display: grid;
  gap: var(--cw-gap);
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "content";
}

.content { grid-area: content; min-width: 0; }
.sidebar { grid-area: sidebar; min-width: 0; }

.content > .main-top,
.content > .main-bottom {
  display: grid;
  gap: var(--cw-gap);
}

.content > .main-top { margin-bottom: var(--cw-gap); }
.content > .main-bottom { margin-top: var(--cw-gap); }

@media (min-width: 48rem) {
  .layout.has-sidebar.sidebar-right {
    grid-template-columns: minmax(0, 1fr) var(--cw-sidebar);
    grid-template-areas: "content sidebar";
  }

  .layout.has-sidebar.sidebar-left {
    grid-template-columns: var(--cw-sidebar) minmax(0, 1fr);
    grid-template-areas: "sidebar content";
  }
}

@media (max-width: 47.99rem) {
  .layout.has-sidebar {
    grid-template-areas: "content" "sidebar";
  }
}

/* Component output sits on a paper "poster" */
.content > div[class],
.content > article,
.content > section,
.content > form {
  background: var(--cw-paper);
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius);
  padding: clamp(1rem, 2.5vw, 2rem);
}

.content > div.main-top,
.content > div.main-bottom {
  background: none;
  border: 0;
  padding: 0;
}

/* ------------------------------------------------------------------
   6. Module chrome: card (main-top / main-bottom), panel (sidebar)
------------------------------------------------------------------- */
.cw-card,
.cw-panel {
  background: var(--cw-paper);
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius);
  overflow: hidden;
}

.cw-card .card-header,
.cw-panel .panel-header {
  margin: 0;
  padding: .7rem 1rem;
  background: var(--cw-primary);
  color: var(--cw-paper);
  font-size: 1.05rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.cw-card .card-body,
.cw-panel .panel-body {
  padding: 1rem;
}

.cw-card .card-body > :last-child,
.cw-panel .panel-body > :last-child {
  margin-bottom: 0;
}

.cw-panel {
  border-inline-start: 5px solid var(--cw-gold);
}

.sidebar > * + * {
  margin-top: var(--cw-gap);
}

.cw-panel ul {
  padding-inline-start: 1.1rem;
}

/* ------------------------------------------------------------------
   7. Bottom: footer + copyright
------------------------------------------------------------------- */
.site-footer {
  background: var(--cw-primary-dark);
  color: var(--cw-paper);
  padding-block: var(--cw-gap);
}

.site-footer a { color: var(--cw-gold); }
.site-footer h1, .site-footer h2, .site-footer h3, .site-footer h4 { color: var(--cw-paper); }
.site-footer > .container > :last-child { margin-bottom: 0; }

.site-copyright {
  background: color-mix(in srgb, var(--cw-primary-dark) 55%, #000);
  border-top: 3px solid var(--cw-gold);
  color: color-mix(in srgb, var(--cw-paper) 85%, transparent);
  font-size: .875rem;
  padding-block: .9rem;
  text-align: center;
}

.site-copyright a { color: var(--cw-gold); }
.site-copyright p { margin: 0; }

/* ------------------------------------------------------------------
   8. Joomla core markup without a framework
------------------------------------------------------------------- */
.btn,
button.btn,
input[type="submit"],
input[type="button"] {
  display: inline-block;
  padding: .55rem 1.1rem;
  border: 2px solid var(--cw-primary);
  border-radius: var(--cw-radius);
  background: var(--cw-primary);
  color: var(--cw-paper);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover,
.btn:focus-visible,
input[type="submit"]:hover,
input[type="button"]:hover {
  background: var(--cw-primary-dark);
  border-color: var(--cw-primary-dark);
  color: #fff;
}

.btn-secondary,
.btn-outline {
  background: transparent;
  color: var(--cw-primary);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="tel"],
input[type="number"],
select,
textarea,
.form-control {
  width: 100%;
  max-width: 100%;
  padding: .5rem .7rem;
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius);
  background: #fff;
  color: inherit;
  font: inherit;
}

label {
  font-weight: 600;
}

fieldset {
  margin: 0 0 1em;
  padding: 1rem;
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: .5rem .75rem;
  border-bottom: 1px solid var(--cw-line);
  text-align: start;
  vertical-align: top;
}

th {
  background: var(--cw-primary-tint);
  color: var(--cw-primary-dark);
}

.pagination ul,
ul.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: 0;
  list-style: none;
}

.pagination a,
.pagination span {
  display: block;
  padding: .3rem .7rem;
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius);
  text-decoration: none;
}

.pagination .active span,
.pagination .active a {
  background: var(--cw-primary);
  border-color: var(--cw-primary);
  color: var(--cw-paper);
}

.breadcrumb,
.mod-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding: 0;
  list-style: none;
  font-size: .9rem;
}

/* ------------------------------------------------------------------
   9. Error page
------------------------------------------------------------------- */
.error-box {
  max-width: 40rem;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--cw-paper);
  border: 1px solid var(--cw-line);
  border-radius: var(--cw-radius);
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--cw-gold);
  font-family: var(--cw-font-head);
  font-size: clamp(3.5rem, 12vw, 6rem);
  font-weight: 700;
  line-height: 1;
}

.error-debug {
  margin-top: 1.5rem;
  overflow-x: auto;
  text-align: start;
  font-size: .85rem;
}

/* ------------------------------------------------------------------
   10. Small screens
------------------------------------------------------------------- */
@media (max-width: 47.99rem) {
  .js .nav-toggle {
    display: inline-flex;
  }

  .js .nav-panel {
    display: none;
  }

  .js .nav-panel.is-open {
    display: block;
    padding-bottom: .5rem;
  }

  .site-nav ul {
    flex-direction: column;
  }

  .site-nav .mod-menu__sub {
    position: static;
    display: flex;
    min-width: 0;
    border-top: 0;
    box-shadow: none;
    background: rgb(0 0 0 / .18);
    padding-inline-start: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .site-nav,
  .site-announcement,
  .sidebar,
  .skip-link {
    display: none !important;
  }

  body {
    background: #fff;
  }
}
