/* Base styles - inherit to all elements */
body {
  font-family: 'Space Grotesk', sans-serif;
  color: black;
  font-size: 1rem;
  line-height: 1.625;
  background-color: #eef2f7;
}

@media (min-width: 768px) {
  body {
    font-size: 1.125rem;
  }
}

/* Section labels */
.section-label {
  font-family: 'Space Mono', monospace;
  font-weight: 500;
  color: rgba(0,0,0,0.3);
  font-size: 1.125rem;
  text-transform: uppercase;
}

@media (min-width: 768px) {
  .section-label { font-size: 1.25rem; }
}

/* Section headlines */
.section-headline {
  font-family: 'Space Mono', monospace;
  font-weight: 300;
  text-transform: uppercase;
  line-height: 1.1;
  font-size: 1.875rem;
}

@media (min-width: 640px) { .section-headline { font-size: 2.25rem; } }
@media (min-width: 768px) { .section-headline { font-size: 3rem; } }
@media (min-width: 1024px) { .section-headline { font-size: 57px; } }

/* Skeuomorphic CTA Button */
.cta-button {
  position: relative;
  background: linear-gradient(to bottom, #4d8fff 0%, #1d6aff 10%, #0c4fd0 100%);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-top-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cta-button::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.cta-button:hover::after {
  opacity: 1;
}

.cta-button:hover {
  transform: translateY(-3px);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.2),
    0 6px 12px rgba(0, 0, 0, 0.12),
    0 3px 6px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.cta-button:active {
  transform: translateY(-1px);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.15),
    0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

/* Dark Button Variant */
.btn-dark {
  position: relative;
  background: linear-gradient(to bottom, #4a4a4a 0%, #2a2a2a 10%, #1a1a1a 100%);
  border: 1px solid rgba(0, 0, 0, 0.4);
  border-top-color: rgba(255, 255, 255, 0.1);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.15),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  transform: translateY(0);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-dark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.btn-dark:hover::after {
  opacity: 1;
}

.btn-dark:hover {
  transform: translateY(-3px);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.25),
    0 6px 12px rgba(0, 0, 0, 0.18),
    0 3px 6px rgba(0, 0, 0, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.2),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

.btn-dark:active {
  transform: translateY(-1px);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}

/* Button Sizes */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.1rem;
}

.btn-md {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-lg {
  padding: 1rem 2rem;
  font-size: 1.25rem;
}

/* Icon Button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  padding: 0;
  aspect-ratio: 1;
}

.btn-icon svg {
  width: 50%;
  height: 50%;
  fill: currentColor;
}

/* Icon Button Sizes */
.btn-icon.btn-sm {
  width: 2rem;
  height: 2rem;
  padding: 0;
}

.btn-icon.btn-md {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
}

.btn-icon.btn-lg {
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
}

/* Tooltip */
.has-tooltip {
  position: relative;
}

.has-tooltip::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 0.375rem 0.75rem;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.1rem;
  white-space: nowrap;
  border-radius: 0.375rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  pointer-events: none;
  z-index: 50;
}

.has-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* Logo link */
.logo-link {
  font-style: italic;
  display: inline-block;
  transform: translateY(0);
  transition: transform 0.2s ease;
}

.logo-link:hover {
  transform: translateY(-2px);
}

/* Portfolio item with hover CTA */
.portfolio-item {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 0.5rem;
}

@media (min-width: 768px) {
  .portfolio-item {
    padding: 3rem 2.5rem;
  }
}

@media (min-width: 1024px) {
  .portfolio-item {
    padding: 4rem;
  }
}

/* Portfolio CTA wrapper - handles positioning and visibility */
.portfolio-cta-wrap {
  position: absolute;
  bottom: 3.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (min-width: 768px) {
  .portfolio-cta-wrap {
    bottom: 4.5rem;
  }
}

@media (min-width: 1024px) {
  .portfolio-cta-wrap {
    bottom: 6rem;
  }
}

/* Desktop: show on hover */
.portfolio-item:hover .portfolio-cta-wrap {
  opacity: 1;
  pointer-events: auto;
}

/* Hide CTA when dialogue is open */
.portfolio-item.active .portfolio-cta-wrap {
  opacity: 0;
  pointer-events: none;
}

/* Mobile: tap to reveal */
.portfolio-item.tapped .portfolio-cta-wrap {
  opacity: 1;
  pointer-events: auto;
}

/* Portfolio CTA button */
.portfolio-cta {
  text-decoration: none;
  white-space: nowrap;
}

/* Portfolio grid lines - large screens only */
@media (min-width: 768px) {
  .portfolio-item {
    border-bottom: 1px solid #c9d5e3;
  }

  /* Vertical line only between HW pairs (left item of pair) */
  .portfolio-item.hw-left {
    border-right: 1px solid #c9d5e3;
  }

  /* Remove bottom border from last row */
  .portfolio-item:last-child {
    border-bottom: none;
  }
}

/* Progressive image loading fade-in */
.portfolio-item img {
  max-width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.portfolio-item img.loaded {
  opacity: 1;
}

/* Portfolio image lightbox - desktop only */
@media (min-width: 768px) {
  .portfolio-item img.loaded {
    cursor: zoom-in;
  }
}

.portfolio-lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  cursor: zoom-out;
}

.portfolio-lightbox.visible {
  opacity: 1;
  visibility: visible;
}

.portfolio-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.portfolio-lightbox.visible img {
  transform: scale(1);
}

/* Text links - auto-styled inside text content */
:where(p, li, address, dd, td, figcaption) a {
  position: relative;
  text-decoration: none;
}

:where(p, li, address, dd, td, figcaption) a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background-color: currentColor;
  z-index: -1;
  transition: height 0.15s ease, background-color 0.15s ease;
}

:where(p, li, address, dd, td, figcaption) a:hover::after {
  height: 0.5em;
  background-color: #0057ff;
}

/* Contact Dialogue */
.contact-dialogue {
  position: fixed;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.96);
  transform-origin: bottom center;
  transition:
    opacity 0.15s ease-out,
    transform 0.15s ease-out,
    visibility 0.15s;
}

.contact-dialogue.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition:
    opacity 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    visibility 0.3s;
}

/* Card */
.contact-dialogue-card {
  position: relative;
  width: 340px;
  padding: 1.5rem;
  background: linear-gradient(165deg, #ffffff 0%, #fafbff 100%);
  border-radius: 1.25rem;
  border: 1px solid rgba(0, 87, 255, 0.08);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.8) inset,
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 4px 8px rgba(0, 0, 0, 0.04),
    0 8px 16px rgba(0, 0, 0, 0.04),
    0 16px 32px rgba(0, 87, 255, 0.08),
    0 32px 64px rgba(0, 87, 255, 0.06);
}

/* Close button */
.contact-dialogue-close {
  display: none;
  position: absolute;
  top: 1rem;
  right: 1rem;
  padding: 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.3);
  transition: color 0.15s ease, transform 0.15s ease;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.contact-dialogue-close:hover {
  color: rgba(0, 0, 0, 0.6);
}

.contact-dialogue-close:active {
  transform: scale(0.92);
}

/* Illustration */
.contact-dialogue-illustration {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

/* Header */
.contact-dialogue-header {
  margin-bottom: 1rem;
  text-align: center;
}

.contact-dialogue-label {
  font-family: 'Space Mono', monospace;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #0057ff;
}

/* Message area */
.contact-dialogue-message-wrap {
  margin-bottom: 1.25rem;
}

/* Speech bubble */
.contact-dialogue-bubble {
  position: relative;
  background: #eef2f7;
  border-radius: 1rem;
  padding: 1rem;
}

.contact-dialogue-bubble::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #eef2f7;
}

.contact-dialogue-textarea {
  width: 100%;
  padding: 0;
  background: transparent;
  border: none;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: black;
  resize: none;
  text-align: center;
}

.contact-dialogue-textarea::placeholder {
  color: rgba(0, 0, 0, 0.35);
}

.contact-dialogue-textarea:focus {
  outline: none;
}

/* Footer */
.contact-dialogue-footer {
  margin: 1rem 0 0 0;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.75rem;
  color: rgba(0, 0, 0, 0.35);
}

/* QR toggle button */
.contact-dialogue-qr-toggle {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.5rem;
  border: none;
  background: none;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.3);
  transition: color 0.15s ease, transform 0.15s ease;
  z-index: 10;
}

.contact-dialogue-qr-toggle:hover {
  color: rgba(0, 0, 0, 0.6);
}

.contact-dialogue-qr-toggle:active {
  transform: scale(0.92);
}

.contact-dialogue-qr-toggle.active {
  color: #0057ff;
}

/* QR code view */
.contact-dialogue-qr-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  height: 100%;
}

.contact-dialogue-qr-code {
  background: white;
  padding: 1rem;
  border-radius: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-bottom: 1.25rem;
}

.contact-dialogue-qr-code img {
  display: block;
}

.contact-dialogue-qr-instructions {
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.8125rem;
  color: rgba(0, 0, 0, 0.5);
  line-height: 1.5;
  max-width: 220px;
}

/* Mobile styles */
@media (max-width: 767px) {
  .contact-dialogue {
    top: 1rem !important;
    right: 1rem !important;
    bottom: 1rem !important;
    left: 1rem !important;
    width: auto !important;
    transform: translateY(20px) scale(0.97);
    transform-origin: center center;
  }

  .contact-dialogue.visible {
    transform: translateY(0) scale(1);
  }

  .contact-dialogue-card {
    width: 100% !important;
    max-width: none;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.75rem;
  }

  .contact-dialogue-close {
    display: flex;
  }

  .contact-dialogue-header {
    margin-bottom: 1.5rem;
  }

  .contact-dialogue-label {
    font-size: 0.875rem;
  }

  .contact-dialogue-message-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
  }

  .contact-dialogue-bubble {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .contact-dialogue-textarea {
    flex: 1;
    min-height: 120px;
    font-size: 1rem;
  }

  .contact-dialogue-footer {
    margin-top: 1.25rem;
  }
}

/* Inverse text - for dark backgrounds */
.text-inverse {
  color: white;
}

.text-inverse .section-label {
  color: rgba(255, 255, 255, 0.5);
}

.text-inverse :where(p, li, address, dd, td, figcaption) a {
  color: inherit;
}

.text-inverse :where(p, li, address, dd, td, figcaption) a:hover::after {
  background-color: rgba(255, 255, 255, 0.5);
}

/* Hero section - default/landscape */
#hero-section {
  overflow: hidden;
}

/* Hero section - portrait/tall orientation adjustments (4:3 or taller) */
@media (max-aspect-ratio: 4/3) {
  #hero-section {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  #hero-footer {
    position: sticky;
    bottom: 0;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    margin-bottom: -2.5rem;
    padding: 3rem 1.5rem 2.5rem;
    background: linear-gradient(to top, #0057ff 50%, transparent);
  }
}

@media (max-aspect-ratio: 4/3) and (min-width: 768px) {
  #hero-footer {
    margin-left: -2.5rem;
    margin-right: -2.5rem;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

@media (max-aspect-ratio: 4/3) and (min-width: 1024px) {
  #hero-footer {
    margin-left: -4rem;
    margin-right: -4rem;
    padding-left: 4rem;
    padding-right: 4rem;
  }
}
