/* Custom Variables based on nar8tive/tailwind.config.js and index.css */
:root {
  --accent: #2d8b84;
  --accent-light: #3da59d;
  --text-primary: #333333;
  --text-secondary: #555555; /* Improved contrast from #666666 */
  --bg-primary: #fdfbf7;
  --bg-secondary: #f5f1eb;
}

body {
  font-family: "Inter", sans-serif;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  padding-top: 76px; /* Offset for fixed header */
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Playfair Display", serif;
}

.font-script {
  font-family: "Caveat", cursive;
}

/* Font-display is handled by Google Fonts (&display=swap) */

.text-accent {
  color: var(--accent) !important;
}

.bg-light-gray {
  background-color: var(--bg-secondary);
}

/* Buttons */
.btn-primary-custom {
  background-color: var(--accent);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  border: none;
  transition: all 0.3s ease;
}

.btn-primary-custom:hover {
  background-color: var(--accent-light);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-secondary-custom {
  border: 2px solid var(--accent);
  color: var(--accent);
  background: transparent;
  padding: 0.75rem 1.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-secondary-custom:hover {
  background-color: var(--accent);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Section Title Underline */
.section-title {
  position: relative;
  display: inline-block;
  margin-bottom: 2rem;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60px;
  height: 3px;
  background-color: var(--accent);
}

.section-title.centered::after {
  left: 50%;
  transform: translateX(-50%);
}

/* Navbar */
.navbar {
  transition: all 0.3s ease, transform 0.3s ease;
}

.nav-link.active {
  color: var(--accent) !important;
}

.nav-link:hover {
  color: var(--accent);
}

/* Section fade effect to prevent mixing */
section {
  position: relative;
  z-index: 1;
}

section .container {
  position: relative;
  z-index: 2;
}

/* Fade sections as they scroll out of view */
section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: inherit;
  z-index: 1;
  opacity: 1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

/* JavaScript-driven styles */
.loaded #hero {
  animation: fadeInUp 0.8s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form validation styles */
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #dc3545;
}

.invalid-feedback {
  color: #dc3545;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.btn-success {
  background-color: #28a745;
  border-color: #28a745;
  color: white;
}

.btn-success:hover {
  background-color: #218838;
  border-color: #1e7e34;
}

/* Service Cards */
.service-card {
  transition: all 0.3s ease;
  height: 100%;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Portfolio */
.portfolio-item {
  overflow: hidden;
  position: relative;
  height: 100%;
}

.portfolio-item .position-relative {
  position: relative;
}

.portfolio-item img {
  transition: transform 0.5s ease;
  width: 100%;
  height: 450px;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.portfolio-item:hover img {
  transform: scale(1.05);
}

/* Always visible title at bottom of image */
.portfolio-item .position-relative > .p-3 {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.95) 0%,
    rgba(0, 0, 0, 0.85) 70%,
    transparent 100%
  );
  z-index: 2;
  padding: 1.5rem 1rem 1rem 1rem;
  margin: 0;
}

.portfolio-item .position-relative > .p-3 h3 {
  color: white !important;
  margin-bottom: 0.25rem;
  font-size: 1rem !important;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.9);
  font-weight: 700 !important;
}

.portfolio-item .position-relative > .p-3 p {
  color: rgba(255, 255, 255, 0.9) !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
  margin-bottom: 0;
}

.portfolio-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(42, 111, 115, 0.7),
    rgba(42, 111, 115, 0.95)
  );
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 3;
}

.portfolio-item:hover .portfolio-overlay {
  opacity: 1;
}

/* Hero Background */
#hero {
  position: relative;
}

.hero-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("assets/hero-bg-cinematic.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(10, 15, 20, 0.9) 0%,
    rgba(10, 15, 20, 0.7) 40%,
    rgba(10, 15, 20, 0.5) 100%
  );
  z-index: 1;
}

#hero .container {
  position: relative;
  z-index: 2;
}

#hero h1,
#hero .lead,
#hero .font-script {
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#hero .text-secondary {
  color: rgba(255, 255, 255, 0.9) !important;
}

#hero .text-accent {
  color: #5edcd1 !important; /* Lighter teal for dark background */
}

/* Abstract Hero Shapes - Keep for fallback */
.hero-shape {
  position: absolute;
  z-index: -1;
  opacity: 0.05;
}

/* ===================================
   RESPONSIVE STYLES
   =================================== */

/* Tablet and Below (992px) */
@media (max-width: 991.98px) {
  /* Reduce navbar brand logo */
  .navbar-brand img {
    height: 45px !important;
  }

  .navbar-brand .fs-3 {
    font-size: 1.5rem !important;
  }

  /* Hero section adjustments */
  #hero {
    min-height: 70vh !important;
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  #hero h1 {
    font-size: 2.5rem !important;
  }

  #hero .lead {
    font-size: 1rem;
  }

  /* Reduce hero shapes */
  .hero-shape {
    opacity: 0.05;
  }

  .hero-shape:first-child {
    width: 200px !important;
    height: 200px !important;
  }

  .hero-shape:last-child {
    width: 150px !important;
    height: 150px !important;
  }

  /* Section padding */
  section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  .container.py-5 {
    bottom: auto !important;
    left: auto !important;
    transform: none !important;
    /*margin: 1rem 0 0 0 !important;*/
  }
}

/* Mobile Landscape and Below (768px) */
@media (max-width: 767.98px) {
  /* Typography adjustments */
  .display-3 {
    font-size: 2rem !important;
  }

  .fs-1 {
    font-size: 1.75rem !important;
  }

  .fs-3 {
    font-size: 1.25rem !important;
  }

  /* Hero section */
  #hero {
    min-height: 60vh !important;
  }

  #hero h1 {
    font-size: 2rem !important;
    line-height: 1.3;
  }

  #hero .font-script {
    font-size: 1.5rem !important;
  }

  /* Buttons stack on mobile */
  #hero .d-flex.gap-3 {
    flex-direction: column;
  }

  .btn-primary-custom,
  .btn-secondary-custom {
    width: 100%;
    padding: 1rem 1.5rem;
  }

  /* Service cards full width on small tablets */
  .service-card {
    margin-bottom: 1rem;
  }

  /* Contact section */
  #contact .col-lg-5 {
    margin-bottom: 2rem;
  }

  /* Footer adjustments */
  footer .col-lg-4,
  footer .col-md-6 {
    margin-bottom: 2rem;
  }

  /* Testimonial carousel */
  #testimonialCarousel {
    padding: 2rem 1.5rem !important;
  }

  #testimonialCarousel .fs-4 {
    font-size: 1.1rem !important;
  }

  /* Form inputs larger touch targets */
  .form-control,
  .form-select {
    padding: 0.875rem !important;
    font-size: 1rem;
  }
}

/* Mobile Portrait (576px) */
@media (max-width: 575.98px) {
  /* Body padding */
  body {
    padding-top: 70px;
  }

  /* Navbar adjustments */
  .navbar {
    padding: 0.5rem 0;
  }

  .navbar-brand img {
    height: 40px !important;
  }

  .navbar-brand .fs-3 {
    font-size: 1.25rem !important;
  }

  .navbar-nav {
    padding-top: 1rem;
  }

  .navbar-nav .nav-item {
    padding: 0.5rem 0;
  }

  .navbar-nav .btn-primary-custom {
    width: 100%;
    margin-top: 0.5rem;
  }

  /* Hero section */
  #hero {
    min-height: 50vh !important;
    padding-top: 1.5rem;
  }

  #hero h1 {
    font-size: 1.75rem !important;
  }

  #hero .lead {
    font-size: 0.95rem;
  }

  /* Hide hero shapes on very small screens */
  .hero-shape {
    display: none;
  }

  /* Section titles */
  .section-title {
    font-size: 1.5rem !important;
  }

  /* Contact info stacks better */
  #contact .d-flex.gap-4 {
    gap: 1rem !important;
  }

  /* Portfolio items */
  .portfolio-item img {
    height: 350px;
  }

  /* Testimonial images smaller */
  #testimonialCarousel img {
    width: 50px !important;
    height: 50px !important;
  }

  /* Contact form padding */
  .bg-white.p-4.p-md-5 {
    padding: 1.5rem !important;
  }

  /* Footer logo */
  footer .navbar-brand img,
  footer img {
    height: 40px !important;
  }

  /* Smaller section padding */
  section {
    padding-top: 2rem !important;
    padding-bottom: 2rem !important;
  }

  .container.py-5 {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
}

/* Extra Small Devices (400px and below) */
@media (max-width: 399.98px) {
  /* Further reduce typography */
  #hero h1 {
    font-size: 1.5rem !important;
  }

  .section-title {
    font-size: 1.35rem !important;
  }

  /* Tighter spacing */
  .btn-primary-custom,
  .btn-secondary-custom {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Service card icons */
  .service-card .bi {
    font-size: 1.5rem !important;
  }

  .service-card h3 {
    font-size: 1.1rem !important;
  }
}

/* Landscape phone optimization */
@media (max-height: 500px) and (orientation: landscape) {
  #hero {
    min-height: 100vh !important;
  }

  body {
    padding-top: 60px;
  }
}

/* ===================================
   FLIP CARD CONTACT FORM
   =================================== */

/* User Type Toggle Buttons */
.user-type-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.user-type-btn {
  flex: 1;
  min-width: 140px;
  padding: 1rem 1.25rem;
  border: 2px solid var(--bg-secondary);
  background: white;
  border-radius: 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-type-btn .btn-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-type-btn .btn-content > i {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.user-type-btn .btn-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
}

.user-type-btn .btn-title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.user-type-btn .btn-subtitle {
  font-size: 0.75rem;
  font-weight: 400;
  opacity: 0.8;
  line-height: 1.3;
}

.user-type-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(45, 139, 132, 0.15);
}

.user-type-btn.active {
  background: linear-gradient(
    135deg,
    var(--accent) 0%,
    var(--accent-light) 100%
  );
  border-color: var(--accent);
  color: white;
  box-shadow: 0 4px 15px rgba(45, 139, 132, 0.3);
}

/* Flip Card Container */
.flip-card {
  perspective: 1500px;
  width: 100%;
  min-height: 700px;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.flip-card-inner.flipped {
  transform: rotateY(180deg);
}

.flip-card-front,
.flip-card-back {
  width: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.flip-card-front {
  position: relative;
}

.flip-card-back {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotateY(180deg);
}

/* Flip card animation enhancements */
.flip-card-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(45, 139, 132, 0.1) 0%,
    transparent 50%
  );
  border-radius: 0.5rem;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 1;
}

.flip-card:hover .flip-card-inner::before {
  opacity: 1;
}

/* Form styling inside flip cards */
.flip-card-front .bg-light-gray,
.flip-card-back .bg-light-gray {
  border: 1px solid rgba(45, 139, 132, 0.1);
  transition: box-shadow 0.3s ease;
}

.flip-card-front .bg-light-gray:hover,
.flip-card-back .bg-light-gray:hover {
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

/* Responsive adjustments for flip card */
@media (max-width: 767.98px) {
  .flip-card {
    min-height: 720px;
  }

  .user-type-btn {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
  }
}

@media (max-width: 575.98px) {
  .flip-card {
    min-height: 850px;
  }

  .user-type-toggle {
    flex-direction: column;
  }

  .user-type-btn {
    min-width: 100%;
  }
}

/* Improve touch targets for all interactive elements */
@media (hover: none) and (pointer: coarse) {
  /* Better touch targets */
  .nav-link {
    padding: 0.75rem 1rem;
  }

  button,
  .btn {
    min-height: 44px;
  }

  a {
    padding: 0.25rem 0;
  }

  /* Form elements */
  input,
  select,
  textarea {
    min-height: 44px;
  }
}
