/* ---- Design tokens ---- */
:root {
  --color-bg: #f7f5f2;
  --color-surface: #ffffff;
  --color-text: #1c1a17;
  --color-text-muted: #6b6559;
  --color-border: #e2ded6;
  --color-accent: #c9622a;
  --color-accent-dark: #a54f21;
  --color-header-bg: #ffffff;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-heading: var(--font-body);

  --radius: 10px;
  --radius-sm: 6px;
  --border: 1px solid var(--color-border);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;

  --max-width: 1120px;
}

/* ---- Reset ---- */
* {
  box-sizing: border-box;
}

button {
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.25;
  margin: 0 0 var(--space-2);
}

h1 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.15rem; }

p { margin: 0 0 var(--space-2); }

a {
  color: var(--color-accent-dark);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

ul { margin: 0; padding: 0; }

/* Every content image gets a border + rounded corners */
img {
  max-width: 100%;
  display: block;
  border-radius: var(--radius);
  border: var(--border);
  background: var(--color-surface);
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* ---- Header / Nav ---- */
.site-header {
  background: var(--color-header-bg);
  border-bottom: var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.site-logo {
  display: flex;
  align-items: center;
}

.site-logo img {
  height: 121px;
  width: auto;
  border: none;
  border-radius: 0;
  background: transparent;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 90px;
  height: 90px;
  background: none;
  color: #777777;
  border: var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
  font-size: 3.5rem;
  line-height: 1;
  cursor: pointer;
}

.nav-toggle:hover {
  background: none;
}

.nav-toggle[aria-expanded="true"],
.nav-toggle[aria-expanded="true"]:hover {
  background: var(--color-border);
}

.main-nav > ul {
  display: flex;
  gap: var(--space-3);
  list-style: none;
}

.main-nav a {
  color: var(--color-text);
  font-weight: 500;
}

.main-nav a[aria-current="page"] {
  color: var(--color-accent-dark);
}

.main-nav a:hover { color: var(--color-accent-dark); }

/* Dropdown: collapsed until hovered */
.has-dropdown {
  position: relative;
}

.dropdown {
  display: none;
  position: absolute;
  /* no gap between the link and this box: a margin here would create a
     dead zone the mouse has to cross, breaking :hover before it arrives */
  top: 100%;
  left: 0;
  flex-direction: column;
  min-width: 240px;
  padding: 0.65rem 0 0.4rem;
  list-style: none;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  z-index: 30;
}

.has-dropdown:hover .dropdown {
  display: flex;
}

.dropdown a {
  display: block;
  padding: 0.5rem 1rem;
  font-weight: 400;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .main-nav {
    display: none;
    width: 100%;
    order: 3;
  }

  .main-nav.is-open { display: block; }

  .main-nav > ul {
    flex-direction: column;
    gap: 0;
    padding: var(--space-2) 0;
  }

  .main-nav > ul > li {
    border-top: var(--border);
  }

  .main-nav a {
    display: block;
    padding: var(--space-2) 0;
  }

  .site-header .container {
    flex-wrap: wrap;
  }
}

/* ---- Hero ---- */
.hero {
  padding: var(--space-5) 0 var(--space-4);
}

.hero-tagline {
  color: var(--color-text-muted);
  font-size: 1.1rem;
  max-width: 40rem;
}

.hero-carousel {
  position: relative;
  margin-top: var(--space-4);
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  border: var(--border);
  background: var(--color-surface);
}

.hero-carousel img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  border-radius: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.hero-carousel img.is-active {
  opacity: 1;
}

.hero-carousel-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 1;
}

.hero-carousel-nav:hover {
  background: none;
}

@media (max-width: 720px) {
  /* Leave the middle half of the image as a dead zone on mobile,
     so swiping/tapping near the center doesn't accidentally change slides */
  .hero-carousel-nav {
    width: 25%;
  }
}

.hero-carousel-prev { left: 0; }
.hero-carousel-next { right: 0; }

.hero-carousel-controls {
  position: absolute;
  bottom: var(--space-2);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
  z-index: 2;
}

.hero-carousel-dot {
  position: relative;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.hero-carousel-dot:hover {
  background: none;
}

.hero-carousel-dot-svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-carousel-dot-fill {
  fill: rgba(255, 255, 255, 0.4);
  stroke: #fff;
  stroke-width: 1;
}

.hero-carousel-dot:hover .hero-carousel-dot-fill {
  fill: rgba(255, 255, 255, 0.4);
}

.hero-carousel-dot.is-active .hero-carousel-dot-fill,
.hero-carousel-dot.is-active:hover .hero-carousel-dot-fill {
  fill: #fff;
}

.hero-carousel-dot-ring {
  fill: none;
  stroke: red;
  stroke-width: 2.25;
  stroke-dasharray: 41.62;
  stroke-dashoffset: 41.62;
}

.hero-carousel-dot.is-active .hero-carousel-dot-ring {
  animation: hero-carousel-progress 5s linear forwards;
}

@keyframes hero-carousel-progress {
  to { stroke-dashoffset: 0; }
}

/* ---- Sections ---- */
section {
  padding: var(--space-4) 0;
}

.section-intro {
  max-width: 42rem;
  color: var(--color-text-muted);
}

/* ---- Image grid / gallery ---- */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.gallery-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

/* Stacked gallery: one image per row, centered, sized to the container
   (the same width the header content spans) rather than a multi-column grid */
.stacked-gallery {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.stacked-gallery img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Portfolio collage: one large image + two stacked smaller images,
   mirrored left/right per section (matches the rbdesign.lv layout) */
.portfolio-collage {
  display: grid;
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.portfolio-collage-item {
  border-radius: var(--radius);
  border: var(--border);
  background: var(--color-surface);
  overflow: hidden;
}

.portfolio-collage-item img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: none;
  border-radius: 0;
}

@media (min-width: 750px) {
  .portfolio-collage {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: column;
  }

  .portfolio-collage-item img {
    aspect-ratio: auto;
  }

  .portfolio-collage--big-left .portfolio-collage-item:nth-child(1) {
    grid-column: 1 / span 2;
    grid-row: span 2;
  }

  .portfolio-collage--big-left .portfolio-collage-item:nth-child(2),
  .portfolio-collage--big-left .portfolio-collage-item:nth-child(3) {
    grid-column-start: 3;
  }

  .portfolio-collage--big-right .portfolio-collage-item:nth-child(1),
  .portfolio-collage--big-right .portfolio-collage-item:nth-child(2) {
    grid-column-start: 1;
  }

  .portfolio-collage--big-right .portfolio-collage-item:nth-child(3) {
    grid-column: 2 / span 2;
    grid-row: span 2;
  }
}

/* ---- Product gallery (one large image + switchable thumbnails) ---- */
.product-gallery {
  margin-top: var(--space-3);
}

.product-gallery-main {
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 520px;
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.product-gallery-main img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.product-gallery-thumb {
  flex-shrink: 0;
  width: 84px;
  height: 84px;
  padding: 0;
  overflow: hidden;
  background: none;
  border: var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.product-gallery-thumb:hover {
  background: none;
}

.product-gallery-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border: none;
  border-radius: 0;
}

.product-gallery-thumb:hover:not(.is-active) {
  border-color: var(--color-accent);
}

.product-gallery-thumb.is-active {
  cursor: default;
  opacity: 0.4;
  border-color: var(--color-accent);
}

/* ---- Category picker (hub pages) ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.category-card {
  display: block;
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--color-text);
  transition: border-color 0.2s ease;
}

.category-card:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}

.category-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: none;
  border-radius: 0;
}

.category-card-body {
  padding: var(--space-2) var(--space-3) var(--space-3);
}

.category-card-body h3 {
  margin-bottom: 0.25rem;
}

.category-card-body p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ---- Cards (services / products) ---- */
.card {
  background: var(--color-surface);
  border: var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}

.card:last-child { margin-bottom: 0; }

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1);
}

.card-price {
  color: var(--color-accent-dark);
  font-weight: 600;
}

.feature-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: var(--space-2) 0;
}

.feature-list li { margin-bottom: 0.35rem; }

.note {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

/* ---- Spec layout (image + parameter list side by side) ---- */
.spec-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
  align-items: start;
}

@media (max-width: 720px) {
  .spec-layout {
    grid-template-columns: 1fr;
  }
}

.spec-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem var(--space-2);
  margin: 0;
}

.spec-list dt {
  font-weight: 600;
  color: var(--color-text-muted);
}

.spec-list dd {
  margin: 0;
}

.spec-list dd.spec-price {
  font-weight: 600;
  color: var(--color-accent-dark);
}

/* ---- Contact ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 720px) {
  .contact-grid { grid-template-columns: 1fr; }
}

.contact-details a {
  font-weight: 600;
}

form {
  display: grid;
  gap: var(--space-2);
}

label {
  font-weight: 600;
  font-size: 0.9rem;
}

input, textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: var(--border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

textarea { resize: vertical; min-height: 120px; }

button, .button {
  font: inherit;
  font-weight: 600;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  width: fit-content;
}

button:hover, .button:hover {
  background: var(--color-accent-dark);
  text-decoration: none;
}

/* ---- Footer ---- */
.site-footer {
  border-top: var(--border);
  padding: var(--space-3) 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2);
}
