/* ==========================================
   CSS RESET & BASE STYLES
   ========================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ==========================================
   CSS CUSTOM PROPERTIES
   ========================================== */

:root {
  /* Color Palette */
  --gray: #6b6b6b;
  --gray-dark: #4a4a4a;
  --blue: #5b4bd4;
  --beige: #f5f0eb;
  --white: #ffffff;
  --white-hover: rgba(255, 255, 255, 0.3);

  /* Layout */
  --max-width: 1280px;
  --grid-gap: 0;
  --header-height: 48px;
  --stroke-width: 2px;
  --stroke-color: #ffffff;

  /* Typography */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
}

/* ==========================================
   FONT LOADING
   ========================================== */

@font-face {
  font-family: 'Inter';
  src: url('font/Inter18pt-Light.woff2') format('woff2'),
       url('font/Inter18pt-Light.woff') format('woff'),
       url('font/Inter18pt-Light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('font/Inter18pt-SemiBold.woff2') format('woff2'),
       url('font/Inter18pt-SemiBold.woff') format('woff'),
       url('font/Inter18pt-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('font/Inter24pt-Light.woff2') format('woff2'),
       url('font/Inter24pt-Light.woff') format('woff'),
       url('font/Inter24pt-Light.ttf') format('truetype');
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('font/Inter24pt-SemiBold.woff2') format('woff2'),
       url('font/Inter24pt-SemiBold.woff') format('woff'),
       url('font/Inter24pt-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}

/* ==========================================
   GLOBAL STYLES
   ========================================== */

body {
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background-color: var(--clar);
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   HEADER - STICKY NAVIGATION
   ========================================== */

.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background-color: var(--clar);
  height: var(--header-height);
  width: 100%;
  display: flex;
  justify-content: center;
  border-bottom: var(--stroke-width) solid var(--stroke-color);
}

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 30px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  position: fixed;
  right: 20px;
  top: 9px;
  transition: background-color 0.3s ease;
}

.hamburger.open {
  background-color: var(--clar);
}

.hamburger span {
  width: 30px;
  height: 3px;
  background-color: var(--white);
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
}

.hamburger.open span:nth-child(1) {
  transform: rotate(45deg);
}

.hamburger.open span:nth-child(2) {
  opacity: 0;
  transform: translateX(20px);
}

.hamburger.open span:nth-child(3) {
  transform: rotate(-45deg);
}

.nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 100%;
  max-width: var(--max-width);
  width: 100%;
  border-left: var(--stroke-width) solid var(--stroke-color);
  border-right: var(--stroke-width) solid var(--stroke-color);
}

.nav a {
  padding: 0 20px;
  text-decoration: none;
  color: var(--white);
  font-size: 19px;
  font-weight: 600;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: var(--stroke-width) solid var(--stroke-color);
  border-bottom: var(--stroke-width) solid var(--stroke-color);
  text-align: center;
  background-color: var(--clar);
}

/* Header menu specific classes */
.header-menu-1,
.header-menu-2,
.header-menu-3 {
  border-right: var(--stroke-width) solid var(--stroke-color);
}

.header-menu-4 {
  border-right: none;
}

.header-active {
  background-color: var(--fosc) !important;
}

.nav a:hover {
  background-color: var(--white-hover);
}



.nav a:focus-visible {
  outline: 2px solid var(--white);
  outline-offset: -2px;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */

.main-content {
  flex: 1;
  width: 100%;
  display: flex;
  justify-content: center;
}

/* ==========================================
   GRID SYSTEM - 4 COLUMNS
   ========================================== */

.grid-container {
  max-width: var(--max-width);
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  border-left: var(--stroke-width) solid var(--stroke-color);
  border-right: var(--stroke-width) solid var(--stroke-color);
}

.grid-item {
  padding: 30px 20px;
  color: var(--white);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: var(--stroke-width) solid var(--stroke-color);
  position: relative;
}

/* Special styling for specific items */
.grid-item:nth-child(1),
.grid-item:nth-child(2),
.grid-item:nth-child(3) {
  justify-content: flex-start;
}

.grid-item:nth-child(2) {
  padding-top: 40px;
}

.grid-item:nth-child(3) {
  padding-top: 40px;
}

/* Height for photo section (blue + beige blocks) */
.grid-item:nth-child(11),
.grid-item:nth-child(12) {
  min-height: 600px;
}

/* ==========================================
   GRID WIDTH CLASSES - DESKTOP
   ========================================== */

.g-col-1 {
  grid-column: span 1;
}

.g-col-2 {
  grid-column: span 2;
}

.g-col-3 {
  grid-column: span 3;
}

.g-col-4 {
  grid-column: span 4;
}

/* ==========================================
   GRID BORDER CLASSES - DESKTOP
   ========================================== */

.g-contorn-dret {
  border-right: var(--stroke-width) solid var(--stroke-color);
}

.g-no-contorn-baix {
  border-bottom: none;
}

/* ==========================================
   BACKGROUND COLORS
   ========================================== */

.bg-fosc {
  background-color: var(--fosc);
}

.bg-clar {
  background-color: var(--clar);
}

.bg-beige {
  background-color: var(--beige);
  color: #333;
  background-image: url('img/imatge-mostra-1.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
}

/* Background Image Support */
.bg-image {
  background-image: linear-gradient(rgba(158, 53, 103, 0.3), rgba(158, 53, 103, 0.3)),
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 400"><rect fill="%239e3567" width="1200" height="400"/><circle cx="200" cy="200" r="100" fill="%23b04479" opacity="0.3"/><circle cx="800" cy="150" r="120" fill="%238b2958" opacity="0.3"/><circle cx="1000" cy="300" r="80" fill="%23b04479" opacity="0.3"/></svg>');
  background-size: cover;
  background-position: center;
  min-height: 300px;
}

/* Image Container */
.image-container {
  padding: 25px;
}

.image-container img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ==========================================
   TYPOGRAPHY
   ========================================== */

.grid-item h1 {
  font-size: 42px;
  line-height: 1.1em;
  font-weight: 300;
  margin: 0;
}

.grid-item h2 {
  font-size: 42px;
  line-height: 1.1em;
  font-weight: 300;
  margin: 0;
}

.grid-item p {
  font-size: 16px;
  line-height: 1.1em;
  font-weight: 300;
  margin: 0;
}

/* ==========================================
   IMAGE PLACEHOLDER
   ========================================== */

.image-placeholder {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.image-placeholder svg {
  width: 100%;
  height: auto;
}

/* ==========================================
   FOOTER
   ========================================== */

.footer {
  background-color: var(--clar);
  color: var(--white);
  width: 100%;
  display: flex;
  justify-content: center;
  border-top: var(--stroke-width) solid var(--stroke-color);
}

.footer-content {
  max-width: var(--max-width);
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--grid-gap);
  border-left: var(--stroke-width) solid var(--stroke-color);
  border-right: var(--stroke-width) solid var(--stroke-color);
}

.footer-item {
  padding: 20px 16px;
  font-size: 19px;
  font-weight: 600;
  display: flex;
  align-items: center;
  border-right: var(--stroke-width) solid var(--stroke-color);
  height: 50px;
}

/* Footer specific classes */
.footer-div-1 {
  cursor: pointer;
  transition: background-color 0.2s ease;
  text-decoration: none;
  color: inherit;
}

.footer-div-1:hover {
  background-color: var(--white-hover);
}

.footer-div-1,
.footer-div-2,
.footer-div-3 {
  border-right: var(--stroke-width) solid var(--stroke-color);
}

.footer-div-4 {
  border-right: none;
}

.footer-logo {
  justify-content: flex-end;
  padding-top: 0;
  padding-bottom: 0;
}

.footer-logo img {
  max-width: 200px;
  height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

/* ==========================================
   RESPONSIVE DESIGN - TABLET (≤768px)
   ========================================== */

/* ==========================================
   RESPONSIVE DESIGN - MEDIUM SCREENS (870px - 950px)
   ========================================== */

@media (max-width: 950px) and (min-width: 871px) {
  .nav a {
    font-size: 16px;
  }
}

/* ==========================================
   RESPONSIVE DESIGN - TABLET (≤870px)
   ========================================== */

@media (max-width: 870px) {
  /* Hamburger menu */
  .hamburger {
    display: flex;
    right: 15px;
  }

  .footer-div-2,
  .footer-div-3 {
    display: none!important;
  }
  .footer-logo {
    padding: 0px 10px 0px 0px!important;
  }

  
  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--clar);
    transform: translateY(-100%);
    transition: transform 0.3s ease;
    border-bottom: var(--stroke-width) solid var(--stroke-color);
    max-width: 100%;
  }

  .nav.open {
    transform: translateY(0);
  }

  .nav a {
    border-right: none;
    border-bottom: var(--stroke-width) solid var(--stroke-color);
    height: 50px;
    font-size: 16px;
  }

  /* All menu items have border-bottom in mobile */
  .header-menu-1,
  .header-menu-2,
  .header-menu-3,
  .header-menu-4 {
    border-right: none;
    border-bottom: var(--stroke-width) solid var(--stroke-color);
  }

  /* Grid switches to 2 columns */
  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    margin: 0;
  }

  /* ==========================================
     GRID WIDTH CLASSES - MOBILE/TABLET
     ========================================== */

  /* Desktop classes adapt to 2-column grid */
  .g-col-1 {
    grid-column: span 1;
  }

  .g-col-2 {
    grid-column: span 2;
  }

  .g-col-3 {
    grid-column: span 2;
  }

  .g-col-4 {
    grid-column: span 2;
  }

  /* Mobile classes override desktop classes */
  .p-col-1 {
    grid-column: span 1;
  }

  .p-col-2 {
    grid-column: span 2;
  }

  /* ==========================================
     GRID BORDER CLASSES - MOBILE/TABLET
     ========================================== */

  /* Remove desktop border classes in mobile */
  .g-contorn-dret {
    border-right: none;
  }

  .g-no-contorn-baix {
    border-bottom: var(--stroke-width) solid var(--stroke-color);
  }

  /* Apply mobile border classes (these override desktop classes) */
  .p-contorn-dret {
    border-right: var(--stroke-width) solid var(--stroke-color);
  }

  .p-no-contorn-baix {
    border-bottom: none;
  }

  /* Footer adapts to 2 columns */
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    border-left: none;
    border-right: none;
  }

  /* Footer responsive borders */
  .footer-div-1 {
    border-right: var(--stroke-width) solid var(--stroke-color);
  }

  .footer-div-2,
  .footer-div-4 {
    border-right: none;
  }

  /* Typography adjustments */
  .grid-item h1 {
    font-size: 24px;
  }

  .grid-item h2 {
    font-size: 20px;
  }

  .grid-item {
    padding: 24px 16px;
  }

  /* Typography adjustments for tablet */
  .grid-item h1,
  .grid-item h2 {
    font-size: 32px;
  }

  .footer-item {
    padding: 20px 16px;
  }
}

/* ==========================================
   RESPONSIVE DESIGN - MOBILE (≤480px)
   ========================================== */

@media (max-width: 480px) {
  .hamburger {
    right: 15px;
  }

  .grid-item h1 {
    font-size: 20px;
  }

  .grid-item h2 {
    font-size: 18px;
  }

  .grid-item p {
    font-size: 13px;
  }

  .grid-item {
    padding: 20px 12px;
    min-height: 150px;
  }

  /* Remove fixed height for B8 in mobile (now item 11) */
  .grid-item:nth-child(11) {
    min-height: 150px;
  }

  .footer-item {
    padding: 12px;
    height: 45px;
  }

  .footer-logo img {
    max-width: 120px;
  }
}

/* ==========================================
   LARGE SCREENS (>1280px)
   ========================================== */

@media (min-width: 1281px) {
  /* Content stays at max-width, centered on larger screens */
  .grid-container,
  .footer-content {
    margin: 0 auto;
  }
}

/* ==========================================
   ACCESSIBILITY & INTERACTIONS
   ========================================== */

/* Focus states for keyboard navigation removed - now in nav section */

/* Smooth scrolling for anchor links */
html {
  scroll-behavior: smooth;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==========================================
   UTILITY CLASSES FOR CONTENT BLOCKS
   ========================================== */

.block-center {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.block-start {
  justify-content: flex-start;
  align-items: flex-start;
}

.block-end {
  justify-content: flex-end;
  align-items: flex-end;
}

.padding-sm {
  padding: 20px 15px;
}

.padding-md {
  padding: 30px 20px;
}

.padding-lg {
  padding: 40px 30px;
}

.text-left {
  text-align: left;
}

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}
