/* =============================================================
   2025 Refactor: Readable, consolidated, and component-scoped
   - Media queries live directly under base selectors
   - Duplicate selectors removed or merged
   - Overrides minimized; modifiers/context used where helpful
   ============================================================= */

/* Design tokens */
:root {
  --brand-yellow: #f8c400;
  --brand-blue: #2a8698;
  --dark-blue: #257782;
	--light-blue: #cde1f0;
  --light-brown: #f4e9e1;
  --brown: #764e35;
  --text: #000;
  --bg: #fff;
  --muted: #555;
  /* extra brand/system colors */
  --brand-cyan: #00ced1; /* links, titles */
  --brand-green: #3cb371; /* section headers */
  --paper: #f7f3ef; /* nav chip background */
  --danger: #c00;
  --radius: 8px;
  --radius-sm: 4px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --maxw: 1280px;
  --page-pad: 16px; /* margin on mobile */
  --gutter: 16px; /* column gutter */
  --cols: 6; /* 6 columns on mobile */
  --sidebar-span: 6; /* sidebar spans full width on mobile */
  /* layout and z-index */
  --header-h-mobile: 64px;
  --header-h-desktop: 32px;
  --z-header: 100;
  --z-brand: 101;
  --z-overlay: 1000;
  /* typography */
  --font-size-base: 12px;
  /* components */
  --news-img-w-mobile: 90px;
  --news-img-w-desktop: 120px;
}
@media (min-width: 960px) {
  :root {
    --cols: 12;
    --page-pad: 32px;
    --sidebar-span: 3;
  }
}

/* Base elements */
html,
body {
  background: var(--brand-blue);
  line-height: 1.5;
  margin: 0;
  padding: 0;
}
body {
  color: var(--text);
  font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
  font-size: var(--font-size-base);
}
p {
  margin: 0;
}
a {
  color: var(--text);
  text-decoration: none;
}
a:hover {
  color: var(--brand-cyan);
}

/* Typography helpers (legacy preserved) */
.title {
  color: var(--brand-cyan);
  font-size: 25px;
  font-weight: bold;
  text-align: center;
}
.content {
  font-size: 12px;
}
.content_header {
  color: var(--brand-green);
  font-size: 16px;
  font-weight: bold;
  left: 10px;
  position: relative;
}
.menu {
  font-size: 12px;
  font-weight: bold;
}

/* Accessibility */
.visually-hidden {
  clip: rect(1px, 1px, 1px, 1px);
  height: 1px;
  overflow: hidden;
  position: absolute !important;
  white-space: nowrap;
  width: 1px;
}
.skip-link {
  background: var(--brand-yellow);
  border-radius: var(--radius);
  color: var(--text);
  left: -9999px;
  padding: var(--space-2) var(--space-3);
  position: absolute;
  top: -9999px;
}
.skip-link:focus {
  left: var(--space-4);
  top: var(--space-4);
  z-index: var(--z-overlay);
}

/* Page chrome */
.site {
  background: var(--light-brown);
}

/* Header */
.header-after,
.header-before {
  background: var(--brand-blue);
  height: 32px;
  width: 100%;
}
@media (min-width: 960px) {
  .header-after,
  .header-before {
    height: var(--header-h-desktop);
    position: static;
  }
}

.header-border {
  background: var(--brown);
  height: 2px;
  position: sticky;
  top: var(--header-h-mobile);
  width: 100%;
}

.site-header {
  background: var(--brand-blue);
  position: sticky;
  top: 0;
  z-index: var(--z-header);
}

.site-header__content,
.layout,
.site-footer__content {
  align-items: center;
  display: grid;
  gap: var(--gutter);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  margin: 0 auto;
  max-width: var(--maxw);
  padding: var(--space-4) var(--page-pad);
}

.site-header__content {
  height: 40px;
  padding: 12px var(--page-pad);
}

/* Branding */
.brand {
  height: 0;
  position: sticky;
  top: var(--header-h-mobile);
  z-index: var(--z-brand);
}
@media (min-width: 960px) {
  .brand {
    margin: initial;
    max-width: initial;
  }
}

.brand__inner {
  display: grid;
  gap: var(--gutter);
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  height: 0;
  margin: 0 auto;
  max-width: var(--maxw);
  padding: 0 var(--page-pad);
}

.brand .logo-link {
  grid-column: 2 / span 4;
  transform: translateY(-50%);
}
@media (min-width: 960px) {
  .brand .logo-link {
    grid-column: 1 / span 3;
  }
}

.brand .logo {
  display: block;
  height: auto;
  margin: 0 auto;
  max-width: 300px;
  width: 100%;
}
@media (min-width: 960px) {
  .brand .logo {
    max-width: initial;
  }
}

/* Top navigation */
.top-nav {
  align-self: start;
  display: none; /* hidden on mobile, visible on desktop */
  grid-column: 1 / -1;
}
@media (min-width: 960px) {
  .top-nav {
    display: block;
    grid-column: -1;
  }
}

.top-nav ul {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.top-nav a {
  background: var(--paper);
  border: 3px solid transparent;
  border-radius: var(--radius);
  box-shadow: 0 2px 0 0 transparent, 0 -2px 0 0 transparent;
  color: var(--text);
  display: inline-block;
  font-weight: 500;
  overflow: hidden;
  padding: var(--space-2) var(--space-3);
  position: relative;
  text-decoration: none;
  text-transform: uppercase;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.top-nav a[aria-current="page"] {
  background: var(--dark-blue);
  box-shadow: 0 2px 0 0 transparent, 0 -2px 0 0 var(--brand-yellow);
  color: var(--paper);
}

.top-nav a:hover,
.top-nav a:focus {
  background: var(--dark-blue);
  box-shadow: 0 2px 0 0 var(--brand-yellow), 0 -2px 0 0 var(--text);
  color: var(--paper);
}

/* Layout */
.layout {
  align-items: stretch;
  padding-bottom: var(--space-6);
}

.sidebar {
  background: linear-gradient(
    90deg,
    rgba(118, 78, 53, 0.15) 0%,
    rgba(118, 78, 53, 0.05) 100%
  );
  border: 2px solid var(--brown);
  border-radius: var(--radius);
  display: none;
  grid-column: 1 / -1;
  padding: var(--space-4) 0;
}
@media (min-width: 960px) {
  .sidebar {
    display: block;
    grid-column: 1 / span 3;
  }
}

.side-content {
  max-height: calc(100vh - 130px);
  -ms-overflow-style: none; /* Internet Explorer and Edge */
  overflow-y: auto;
  position: sticky;

  /* hide scrollbar */
  scrollbar-width: none; /* Firefox */
  top: 130px;
}

.side-content::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.side-nav ul {
  display: grid;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0 var(--space-1);
}
.side-nav a {
  border-radius: var(--radius);
  color: #000;
  display: block;
  padding: var(--space-3);
  text-decoration: none;
  transition: color 0.2s, background 0.2s;
}
.side-nav a[aria-current="page"],
.side-nav a:hover,
.side-nav a:focus {
  background: var(--brown);
  color: var(--bg);
}

.ad {
  border-top: 2px solid var(--brown);
  color: var(--muted);
  font-size: 12px;
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  text-align: center;
}
.ad img {
  border-radius: var(--radius-sm);
  height: auto;
  max-width: 100%;
}
.ad-label {
  color: var(--muted);
  letter-spacing: 1em;
  margin-bottom: var(--space-3);
}

.content-area {
  background: var(--bg);
  border: 2px solid var(--brown);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  grid-column: 1 / -1;
  padding: var(--space-4);
}
@media (min-width: 960px) {
  .content-area {
    grid-column: 4 / -1;
    padding: var(--space-4) var(--space-6);
  }
}
.content-area .title {
  color: var(--brand-blue);
  font-size: 24px;
  margin-bottom: var(--space-4);
  text-align: center;
}

.content-xl {
  font-size: 18px;
}
.content-danger {
  color: var(--danger);
}

/* Product Components */
.product {
  border-top: 1px solid #e0e0e0;
  margin-top: var(--space-6);
  padding-top: var(--space-5);
}

.product:last-child {
  border-bottom: none;
}

.product-content {
  display: flex;
  flex-direction: column-reverse;
  gap: var(--space-4);
}

@media (min-width: 960px) {
  .product-content {
    flex-direction: row;
    gap: var(--space-5);
  }
}

.product-copy {
  flex: 1;
}

.product-image {
  width: 100%;
}

@media (min-width: 960px) {
  .product-image {
    flex: 0 0 50%;
    width: 50%;
  }
}

/* The direct child of product-image, whether it's a gallery or a single image link */
.product-image > * {
  aspect-ratio: 1 / 1;
  width: 100%;
}

.product-image a {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
}

.product-image img {
  height: auto;
  max-width: 100%;
}

.product-image a img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-name {
  color: var(--text);
  font-size: 1.5em;
  font-weight: bold;
  letter-spacing: 0.04rem;
  margin: 0 0 var(--space-2) 0;
}

.product-price {
  color: var(--brand-blue);
  font-size: 1.5em;
  font-weight: bold;
  letter-spacing: 0.04rem;
  margin: 0 0 var(--space-3) 0;
}

.product-description {
  margin: 0;
}

.product-description .content {
  margin-bottom: var(--space-2);
}

.product-description .content:last-child {
  margin-bottom: 0;
}

dl {
  display: grid;
  gap: var(--space-1) var(--space-3);
  grid-template-columns: auto 1fr;
}

dt {
  font-weight: bold;
  grid-column: 1;
}

dd {
  grid-column: 2;
  margin: 0;
}

/* Product Gallery */
.product-gallery {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  aspect-ratio: 1 / 1;
  justify-content: space-between;
}

@media (min-width: 960px) {
  .product-gallery {
    flex: 0 0 50%;
  }

  .product-image > .product-gallery {
    flex: 0 0 100%;
  }
}

.product-gallery__main {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
}

.product-gallery__main a, .product-gallery__main img {
  height: 100%;
  width: 100%;
  object-fit: contain;
  position: absolute;
  top: 0;
  left: 0;
}

.product-gallery__thumbnails {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}

.product-gallery__thumbnail {
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: border-color 0.2s ease;
  width: 60px;
  aspect-ratio: 1 / 1;
  background: none;
}

.product-gallery__thumbnail:hover {
  border-color: var(--brand-cyan);
}

.product-gallery__thumbnail.active {
  border-color: var(--brand-yellow);
}

.product-gallery__thumbnail img {
  border-radius: calc(var(--radius-sm) - 2px);
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  object-fit: contain;
}

/* Footer */
.site-footer {
  background: var(--brand-blue);
  border-top: 2px solid var(--brown); /* merged duplicate */
  color: var(--bg);
  grid-template-rows: auto;
  margin: 0 auto;
}
.site-footer .validator-badges {
  grid-column: 1 / -1;
}
.site-footer .stopka {
  grid-column: 1 / -1;
}
.validator-badges img {
  border: 0;
  height: 20px;
  width: auto;
}
.stopka {
  font-size: var(--font-size-base);
  position: static;
}

/* Components */
.news-item {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-4);
}
@media (min-width: 960px) {
  .news-item {
    flex-direction: row;
  }
}
.news-item img {
  flex: 0 0 auto;
  float: none;
  margin-right: var(--space-4);
  object-fit: contain;
  object-position: center;
  width: var(--news-img-w-mobile);
}
@media (min-width: 960px) {
  .news-item img {
    width: var(--news-img-w-desktop);
  }
}

.pager {
  margin: var(--space-4) 0;
  text-align: center;
}

/* Motion preferences */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* =============== Mobile Menu & Hamburger =============== */
.menu-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
	height: 48px;
  justify-content: center;
  margin-left: -8px;
	margin-top: -4px;
  padding: 8px;
	width: 48px;
}
.menu-toggle:focus {
  outline: 2px solid #5ab3ff;
  outline-offset: 2px;
}
.menu-toggle__bar {
  background: #fff;
  display: block;
  height: 2px;
	transition: transform 0.2s;
  width: 24px;
}
[aria-hidden="false"] .menu-toggle__bar:nth-child(1),
[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}
[aria-hidden="false"] .menu-toggle__bar:nth-child(2),
[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
  opacity: 0;
}
[aria-hidden="false"] .menu-toggle__bar:nth-child(3),
[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
  transform: translateY(-5px) rotate(-45deg);
}
@media (min-width: 960px) {
  .menu-toggle {
    display: none;
  }
}

.mobile-menu[aria-hidden="true"] {
  opacity: 0;
	transform: translateY(-999vh);
	transition: opacity 0.2s, visibility 0s 0.2s, transform 0s 0.2s;
	visibility: hidden;
}
.mobile-menu[aria-hidden="false"] {
  opacity: 1;
	transform: translateY(0);
	transition: opacity 0.2s;
	visibility: visible;
}
.mobile-menu {
  inset: 0;
  position: fixed;
  z-index: var(--z-overlay);
}
.mobile-menu__overlay {
  background: rgba(0, 0, 0, 0.4);
  inset: 0;
  position: absolute;
  z-index: 0;
}
.mobile-menu__dialog {
  background: #fff; /* white */
  bottom: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  height: 100dvh;
  left: 0;
  max-height: 100dvh;
  overflow: hidden;
  position: absolute;
  top: 0;
  transform: translateX(-100%);
  transition: transform 0.2s ease-out;
  width: min(100vw, 480px);
  z-index: 1; /* ensure above overlay */
}
.mobile-menu[aria-hidden="false"] .mobile-menu__dialog {
  transform: translateX(0);
}
.mobile-menu__header {
  align-items: center;
  background: #fff; /* keep visible */
  border-bottom: 1px solid var(--brown);
  display: flex;
	height: 64px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 2; /* above scrolling content */
}
.mobile-menu__header h2 {
  font-size: 18px;
  margin: 0;
}
.mobile-menu__close {
  align-items: center;
  align-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: inline-flex;
	  display: inline-flex;
  flex-direction: column;
  font-size: 24px;
	gap: 3px;
  height: 48px;
  justify-content: center;
  justify-content: center;
  line-height: 1;
	margin-left: 8px;
  width: 48px;
}

.mobile-menu__close .menu-toggle__bar {
	background: #111;
}
.mobile-menu__content {
	box-sizing: border-box;
  max-height: calc(100dvh - 61px);
  overflow: auto;
  padding: 8px 16px 24px;
}
.mobile-menu__section ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.mobile-menu__section a {
  border-radius: 6px;
  color: #111;
  display: block;
	margin: 1px 0;
  padding: 12px 8px;
  text-decoration: none;
}
.mobile-menu__section a:hover,
.mobile-menu__section a:focus {
  background: var(--brand-blue);
	color: var(--bg);
}
.mobile-menu__section a[aria-current],
.mobile-menu__section a[aria-current="page"] {
  background: var(--brand-blue);
	color: var(--bg);
  font-weight: 600;
}
.mobile-menu__top a {
  text-transform: uppercase;
}
.mobile-menu__divider {
  background: var(--brown);
  border: 0;
  height: 3px;
  margin: 12px 0 8px;
}

/* Lowercase aside links (modal + desktop sidebar) */
.mobile-menu__side a {
  text-transform: capitalize;
}
.side-nav a {
  text-transform: capitalize;
}

/* Ensure header content shows on mobile to host the button */
@media (max-width: 959.98px) {
  .site-header__content {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  }
}

hr {
  margin: var(--space-6) 0;
}

.gallery-inline {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(2, 1fr);
  margin: var(--space-6) 0;
  width: 100%;

  a, img {
    display: block;
    width: 100%;
  }
}
