/* Design Tokens & CSS Reset */
:root {
  --color-dark: #303030;
  --color-red: #FF0138;
  --color-pink-hover: rgba(255, 1, 56, 0.075);
  --color-pink-border: rgba(255, 1, 56, 0.2);
  --color-bg: #FAFAFA;
  --color-text-muted: #888888;
  --color-border-light: rgba(0, 0, 0, 0.08);

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  
  --grid-cols: 9;
  --grid-margin: 20px;
  --grid-gutter: 10px;
}

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

html, body {
  width: 100%;
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-dark);
  font-family: var(--font-family);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Home Page Specific Zero-Scroll 100vh Desktop Layout */
body.home-page {
  height: 100%;
  overflow: hidden;
}

body.home-page .site-wrapper {
  height: 100vh;
  overflow: hidden;
}

/* Portfolio Page Specific Full Vertical Scroll */
body.portfolio-page {
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.portfolio-page .site-wrapper {
  height: auto !important;
  min-height: 100vh;
  overflow: visible !important;
}

/* 9-Column Background Grid Lines */
.bg-grid-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 100vh;
  padding: 0 var(--grid-margin);
  pointer-events: none;
  z-index: 0;
}

.bg-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--grid-gutter);
  height: 100%;
  width: 100%;
}

.bg-grid-col {
  border-left: 1px solid var(--color-border-light);
  border-right: 1px solid var(--color-border-light);
  height: 100%;
}

/* Main Container Layout */
.site-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 var(--grid-margin);
}

/* Block 1: Header Grid Alignment */
.site-header {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: var(--grid-gutter);
  align-items: center;
  padding: 20px 0 12px 0;
  width: 100%;
}

.logo-link {
  grid-column: 1 / 2;
  display: block;
  width: 100%;
}

.brand-logo {
  width: 100%;
  height: auto;
  display: block;
}

.brand-tagline {
  grid-column: 2 / 4;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-dark);
}

.header-nav-links {
  grid-column: 7 / 9;
  display: flex;
  align-items: center;
  gap: 35px;
  margin-left: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  margin: -8px -10px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-decoration: none;
  color: var(--color-dark);
  transition: color 0.2s ease;
  cursor: pointer;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-red);
}

.lang-selector-wrapper {
  grid-column: 9 / 10;
  justify-self: end;
  position: relative;
  z-index: 100;
}

.lang-selector {
  background-color: var(--color-red);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border: none;
  border-radius: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.2s ease, background-color 0.2s ease;
}

.lang-selector:hover {
  opacity: 0.9;
}

.lang-chevron {
  width: 10px;
  height: 10px;
  transition: transform 0.25s ease;
}

.lang-selector-wrapper.open .lang-chevron {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background-color: var(--color-red);
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(255, 1, 56, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 101;
  width: 100%;
  min-width: 72px;
}

.lang-selector-wrapper.open .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  background: transparent;
  border: none;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
  width: 100%;
}

.lang-option:hover, .lang-option.active {
  background-color: rgba(0, 0, 0, 0.2);
}

/* Block 2: Middle Hero Section (Auto-Stretching) */
.hero-section {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: var(--grid-gutter);
  align-items: center;
  position: relative;
  padding: 10px 0;
  overflow: visible;
}

.hero-title-container {
  grid-column: 1 / 5;
  width: 100%;
  z-index: 3;
}

.hero-title {
  font-size: clamp(38px, 4.5vw, 65px);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  color: var(--color-dark);
  margin-left: -2px;
}

.hero-title .accent-product {
  color: var(--color-red);
  font-style: italic;
  font-weight: 300;
  letter-spacing: -0.01em;
}

.hero-canvas-container {
  grid-column: 5 / 10;
  height: 100%;
  min-height: 0;
  position: relative;
  z-index: 1;
  overflow: visible;
}

#canvas-container {
  width: 100%;
  height: 120%;
  position: absolute;
  top: -10%;
  left: 0;
  overflow: visible;
}

#canvas-container canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* Block 3: Services Table & Footer (Fixed Bottom Anchor) */
.services-section {
  flex-shrink: 0;
  padding: 8px 0 0 0;
  width: 100%;
}

.services-table {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.service-row {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: var(--grid-gutter);
  background-color: rgba(255, 255, 255, 0.4);
  border: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  cursor: pointer;
  transition: background-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.25s ease;
  text-decoration: none;
  color: var(--color-dark);
}

.service-row:hover, .service-row.active {
  background-color: var(--color-pink-hover);
  border-color: var(--color-pink-border);
}

/* Corner Technical Markers (+ / ↗ / ↖) */
.corner-marker {
  position: absolute;
  font-size: 13px;
  font-weight: 300;
  color: rgba(0, 0, 0, 0.35);
  line-height: 1;
  user-select: none;
  pointer-events: none;
  transition: color 0.2s ease;
}

.service-row:hover .corner-marker, .service-row.active .corner-marker {
  color: var(--color-red);
}

.marker-top-left { top: 4px; left: 6px; }
.marker-top-right { top: 4px; right: 6px; }
.marker-bottom-left { bottom: 4px; left: 6px; }
.marker-bottom-right { bottom: 4px; right: 6px; }

/* Service Row Columns */
.service-cell {
  padding: 24px 16px;
  display: flex;
  align-items: center;
  position: relative;
}

.service-title-cell {
  grid-column: 1 / 4;
}

.service-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.service-desc-cell {
  grid-column: 4 / 7;
}

.service-desc {
  font-size: 13px;
  font-weight: 400;
  font-style: italic;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #555555;
}

.service-btn-cell {
  grid-column: 7 / 10;
  justify-content: flex-end;
}

.service-btn {
  background-color: var(--color-red);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 8px 14px;
  border-radius: 0;
  width: 135px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-btn .btn-arrow {
  margin-left: auto;
  font-size: 13px;
}

.service-row:hover .service-btn {
  transform: translateX(3px);
  box-shadow: 0 4px 12px rgba(255, 1, 56, 0.3);
}

/* Footer (Fixed Bottom Anchor) */
.site-footer {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 0 16px 0;
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.site-footer strong {
  font-weight: 700;
  color: var(--color-dark);
}

.footer-text {
  flex: 1 1 auto;
}

.footer-nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.footer-link {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-dark);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--color-red);
}

/* Mobile Prototype Tabs Architecture */
.mobile-tabs-wrapper {
  display: none;
}

@media (max-width: 1024px) {
  .hero-title {
    font-size: clamp(40px, 5vw, 56px);
  }
  .service-cell {
    padding: 18px 12px;
  }
}

@media (max-width: 768px) {
  html, body {
    height: auto;
    min-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .bg-grid-container {
    padding: 0 16px;
  }

  .site-wrapper {
    height: auto;
    min-height: 100vh;
    overflow: visible;
    padding: 0 16px;
  }

  /* Header mobile layout */
  .site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 12px 0;
    gap: 12px;
  }

  .logo-link {
    width: 72px;
    grid-column: auto;
  }

  .brand-tagline {
    font-size: 9px;
    line-height: 1.1;
    grid-column: auto;
  }

  .header-nav-links {
    gap: 20px;
    margin-left: 0;
    grid-column: auto;
  }

  .lang-selector-wrapper {
    grid-column: auto;
    justify-self: end;
  }

  /* Hero Section mobile layout */
  .hero-section {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    padding: 12px 0 0 0;
    min-height: auto;
    gap: 8px;
  }

  .hero-title-container {
    width: 100%;
  }

  .hero-title {
    font-size: clamp(28px, 7.5vw, 42px);
    line-height: 1.05;
    margin-left: 0;
  }

  .hero-canvas-container {
    width: calc(100% + 32px);
    margin-left: -16px;
    margin-right: -16px;
    height: 380px;
    min-height: 340px;
    margin-top: 0;
    margin-bottom: -45px;
    grid-column: auto;
    position: relative;
    overflow: visible;
  }

  #canvas-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    overflow: visible;
  }

  /* Hide Desktop Table on Mobile */
  .services-table {
    display: none;
  }

  /* Show Mobile Prototype Tabs */
  .services-section {
    flex: 0 0 auto;
    margin-top: 0;
    padding: 0;
  }

  .mobile-tabs-wrapper {
    display: block;
    width: 100%;
  }

  .mobile-tabs-bar {
    display: flex;
    align-items: center;
    border-bottom: 1.5px solid var(--color-dark);
    gap: 0;
    margin-bottom: 20px;
    width: 100%;
  }

  .mobile-tab {
    background: transparent;
    border: none;
    border-radius: 0;
    color: var(--color-dark);
    font-family: var(--font-family);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.05em;
    padding: 10px 18px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
  }

  .mobile-tab.active {
    background-color: var(--color-red);
    color: #FFFFFF;
  }

  .mobile-tab-card {
    padding: 6px 0 12px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .mobile-card-title {
    font-size: clamp(24px, 6vw, 32px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-transform: uppercase;
    color: var(--color-dark);
  }

  .mobile-card-desc {
    font-size: 12px;
    font-weight: 400;
    font-style: italic;
    letter-spacing: 0.03em;
    color: var(--color-dark);
  }

  .mobile-card-btn {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    width: 175px;
    margin-top: 6px;
    padding: 10px 16px;
    background-color: var(--color-red);
    color: #FFFFFF;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-decoration: none;
    border-radius: 0;
    box-shadow: 0 4px 12px rgba(255, 1, 56, 0.25);
    transition: transform 0.2s ease, background-color 0.2s ease;
  }

  .mobile-card-btn:active {
    background-color: #d6002d;
    transform: scale(0.98);
  }

  .mobile-card-desc {
    color: #555555;
    line-height: 1.4;
  }

  .site-footer {
    padding: 16px 0 24px 0;
  }
}

@media (max-width: 480px) {
  .site-header {
    gap: 10px;
  }

  .brand-tagline {
    display: none;
  }

  .hero-title {
    font-size: clamp(26px, 8vw, 36px);
  }

  .hero-canvas-container {
    height: 260px;
    min-height: 250px;
  }

  .mobile-tab {
    padding: 8px 12px;
    font-size: 12px;
  }
}
