:root {
  --color-primary: #2e5266;
  --color-secondary: #e2c044;
  --color-accent: #ffcc00;
  --color-text: #333333;
  --color-bg: #ffffff;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --space-xl: 64px;
}

* {
  box-sizing: border-box;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background-color: var(--color-secondary);
  color: var(--color-text);
}

header {
  background-color: var(--color-primary);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-lg);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.modal.open {
  opacity: 1;
  pointer-events: auto;
}

.modal.open .modal-content {
  animation: modalBloom 240ms cubic-bezier(0.25, 0.8, 0.25, 1) both;
  opacity: 1;
  transform: scale(1);
}

.modal.viewer-active {
  background-color: transparent;
}

.modal.viewer-active .modal-content {
  opacity: 0;
  transform: scale(0.96);
  pointer-events: none;
}

@keyframes modalBloom {
  0% {
    transform: scale(0.88);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-content {
  transform: scale(0.88);
  opacity: 0;
  transition: transform 240ms cubic-bezier(0.25, 0.8, 0.25, 1), opacity 140ms ease-in;
}

.logo img {
  max-height: 60px;
  width: auto;
  display: block;
}


.nav-toggle {
  background: none;
  border: none;
  font-size: 2rem;
  color: white;
  display: none;
  cursor: pointer;
}

nav ul {
  list-style: none;
  display: flex;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
}

nav ul li a {
  color: white;
  text-decoration: none;
  font-weight: bold;
}

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

  nav {
    display: none;
    width: 100%;
  }

  .nav-toggle[aria-expanded="true"] + nav {
    display: block;
  }

  nav ul {
    flex-direction: column;
    gap: var(--space-sm);
    text-align: center;
  }
}

.hero {
  background: linear-gradient(rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.42)), url('bilder/Färggranna hus.jpg') center/cover no-repeat;
  color: white;
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--space-md);
}

.hero h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  margin: 0;
}

.hero p {
  max-width: 680px;
  margin: 0 auto;
  font-size: 1.1rem;
  line-height: 1.7;
}

.cta {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: var(--space-md) auto 0;
  padding: var(--space-sm) var(--space-lg);
  max-width: 280px;
  width: auto;
  white-space: nowrap;
  background-color: var(--color-accent);
  color: var(--color-primary);
  text-decoration: none;
  font-weight: bold;
  border-radius: 5px;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.cta:hover,
.cta:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.16);
}

section {
  padding: var(--space-lg) var(--space-md);
}

.section-intro {
  text-align: center;
  margin-top: 3.5rem;
  margin-bottom: 2.5rem;
}

.section-intro p {
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.18rem;
  line-height: 1.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-lg);
}

.card {
  position: relative;
  height: 300px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
}

.card-content {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  padding: var(--space-md);
}

.details {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 0.3s ease, max-height 0.3s ease;
}

.card:hover .details {
  opacity: 1;
  max-height: 200px;
}

@media (hover: none) {
  .card:hover .details {
    opacity: 0;
    max-height: 0;
  }
}

.card.active .details {
  opacity: 1;
  max-height: 200px;
}

form {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 500px;
}

input,
textarea {
  padding: var(--space-md);
  border: 1px solid #ccc;
  border-radius: 4px;
  font: inherit;
}

input:focus,
textarea:focus,
button:focus-visible,
.cta:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.contact-info {
  margin-top: var(--space-lg);
  font-style: normal;
  line-height: 1.7;
}

.contact-info a {
  color: var(--color-primary);
  text-decoration: none;
}

.contact-info a:hover,
.contact-info a:focus-visible {
  text-decoration: underline;
}

button {
  background-color: var(--color-primary);
  color: white;
  padding: var(--space-md);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.project {
  margin-bottom: var(--space-xl);
  padding: var(--space-lg);
  background-color: var(--color-bg);
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.project h3 {
  color: var(--color-primary);
  margin-bottom: var(--space-md);
}

.project-images {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  overflow-x: auto;
  padding-bottom: var(--space-sm);
}

.project-images img {
  flex: 0 0 300px;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
  .project-images {
    flex-wrap: nowrap;
  }

  .project-images img {
    flex: 0 0 250px;
  }
}

footer {
  background-color: var(--color-primary);
  color: white;
  text-align: center;
  padding: var(--space-lg);
}

/* Modal/Lightbox för Altantak */
.modal-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: calc(var(--space-md) * 1.2) calc(var(--space-lg) * 1.2);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.15rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.modal-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.32);
}

.modal-btn-thumbs {
  display: flex;
  gap: 0.4rem;
  justify-content: center;
}

.modal-btn-thumbs img {
  width: 60px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
}

.modal-btn-label {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.modal {
  display: flex;
  justify-content: center;
  align-items: center;
  position: fixed;
  z-index: 1000;
  inset: 0;
  padding: var(--space-xl);
  background-color: rgba(0, 0, 0, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-in-out;
}

.modal-content {
  position: relative;
  padding: var(--space-lg);
  width: 90%;
  max-width: 900px;
  background: white;
  border-radius: 8px;
  max-height: 90vh;
  overflow: auto;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 20px;
  font-size: 2rem;
  cursor: pointer;
  color: var(--color-primary);
}

.modal-main-image {
  position: relative;
  text-align: center;
  margin-bottom: var(--space-lg);
  display: flex;
  justify-content: center;
  align-items: center;
  max-height: 70vh;
}

.modal-image-wrapper {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 700px;
  max-height: 70vh;
  overflow: visible;
}

.modal-image-wrapper.is-loading::after,
.image-viewer-stage.is-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-top-color: rgba(255, 255, 255, 0.95);
  animation: viewerSpin 0.8s linear infinite;
  pointer-events: none;
}

.modal-image-wrapper.is-loading::after {
  border-color: rgba(46, 82, 102, 0.18);
  border-top-color: rgba(46, 82, 102, 0.95);
}

.modal-main-image img {
  width: 100%;
  max-width: 700px;
  max-height: 500px;
  object-fit: contain;
  border-radius: 8px;
  cursor: zoom-in;
  transition: opacity 180ms ease;
}

.modal-image-text {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.5rem;
  font-weight: bold;
  color: white;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
  background: rgba(0, 0, 0, 0.3);
  padding: 10px 20px;
  border-radius: 4px;
  max-width: 90%;
  text-align: center;
}

.modal-navigation {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 var(--space-md);
}

@media (max-width: 640px) {
  .modal-navigation {
    position: static;
    transform: none;
    justify-content: center;
    padding: 0;
    margin-top: var(--space-sm);
  }

  .modal-nav-btn {
    display: none;
  }

  .modal-main-image {
    touch-action: pan-y;
    flex-direction: column;
    align-items: stretch;
  }

  .modal-image-text {
    position: static;
    transform: none;
    background: transparent;
    color: var(--color-text);
    text-shadow: none;
    padding: 0;
    margin: var(--space-sm) auto 0;
    font-size: 1.1rem;
    max-width: 100%;
  }

  .modal-counter {
    margin: var(--space-sm) auto 0;
  }
}

.modal-nav-btn {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: none;
  padding: var(--space-md);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
}

.modal-counter {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  padding: var(--space-sm) var(--space-md);
  border-radius: 20px;
  font-weight: bold;
}

.modal-thumbnails {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.modal-thumb {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.3s, transform 0.2s, box-shadow 0.2s;
}

.modal-thumb:hover {
  opacity: 0.95;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.modal-thumb.active {
  opacity: 1;
  border: 2px solid var(--color-primary);
}

.modal-description {
  text-align: center;
  padding: var(--space-md);
  background: var(--color-secondary);
  border-radius: 4px;
}

body.viewer-open {
  overflow: hidden;
}

.image-viewer {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 5vh 5vw;
  background: rgba(0, 0, 0, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-in-out;
}

.image-viewer.open {
  opacity: 1;
  pointer-events: auto;
}

.image-viewer-panel {
  position: relative;
  width: 90vw;
  height: 90vh;
  background: rgba(0, 0, 0, 0.88);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.image-viewer-close {
  position: absolute;
  top: 18px;
  right: 20px;
  z-index: 3;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: white;
  font-size: 2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.image-viewer-close:hover,
.image-viewer-nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

.image-viewer-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  font-size: 2rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
}

.image-viewer-nav-prev {
  left: 18px;
}

.image-viewer-nav-next {
  right: 18px;
}

.image-viewer-stage {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}

.image-viewer-image {
  max-width: 40vw;
  max-height: 40vh;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 120ms ease-out;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.image-viewer-hint {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  margin: 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  text-align: center;
  pointer-events: none;
}

@keyframes viewerSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .image-viewer-image {
    max-width: 54vw;
    max-height: 46vh;
  }
}

@media (max-width: 640px) {
  .image-viewer-nav {
    display: none;
  }

  .image-viewer {
    padding: 3vh 3vw;
  }

  .image-viewer-panel {
    width: 94vw;
    height: 90vh;
    border-radius: 14px;
  }

  .image-viewer-image {
    max-width: 72vw;
    max-height: 42vh;
  }

  .image-viewer-hint {
    width: calc(100% - 24px);
    bottom: 12px;
    font-size: 0.85rem;
  }
}

:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}