/* style.css — merged from 3 inline <style> blocks, deduped */

/* -------- Layers -------- */
@layer base, components, utilities;

/* ======================== */
/*          BASE            */
/* ======================== */
@layer base {
  /* CSS Reset & Variables */
  :root {
    /* Color palette - OKLCH with HSL fallbacks (oklch overrides) */
    --primary-hsl: 222, 84%, 53%;
    --primary-dark-hsl: 221, 83%, 48%;
    --accent-hsl: 158, 84%, 39%;

    --primary: hsl(var(--primary-hsl));
    --primary: oklch(55% 0.2 250);
    --primary-dark: hsl(var(--primary-dark-hsl));
    --primary-dark: oklch(45% 0.2 250);
    --accent: hsl(var(--accent-hsl));
    --accent: oklch(60% 0.16 160);

    /* System colors */
    --secondary: #64748b;
    --light: #f8fafc;
    --dark: #1e293b;
    --gray: #94a3b8;
    --border: #e2e8f0;

    /* Footer specific colors */
    --footer-bg: #f8fafc;
    --footer-text: #000203;

    /* UI properties */
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-elevated: 0 10px 25px -5px rgb(0 0 0 / 0.15);
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;

    /* Theme colors */
    --bg-main: #f8fafc;
    --bg-main-rgb: 248, 250, 252;
    --text-main: #1e293b;
    --card-bg: #ffffff;
    --highlight: #eef2ff; /* unified */

    /* Form colors (from contact page) */
    --form-focus-ring: rgb(37 99 235 / 0.2);
    --success-bg: #f0fdf4;
    --success-text: #166534;
    --success-border: #bbf7d0;
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --error-border: #fecaca;

    /* Spacing scale (rem) */
    --space-1: clamp(0.25rem, 0.5vw, 0.5rem);
    --space-2: clamp(0.5rem, 1vw, 0.75rem);
    --space-3: clamp(0.75rem, 1.5vw, 1rem);
    --space-4: clamp(1rem, 2vw, 1.5rem);
    --space-5: clamp(1.5rem, 3vw, 2rem);
    --space-6: clamp(2rem, 4vw, 3rem);

    /* System properties */
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Default color scheme */
    color-scheme: light;
  }

  /* Dark theme variables */
  @media (prefers-color-scheme: dark) {
    :root {
      color-scheme: dark;
    }

    :root:not([data-theme="light"]) {
      --primary: oklch(65% 0.2 250);
      --primary-dark: oklch(55% 0.2 250);
      --secondary: #94a3b8;
      --light: #1e293b;
      --dark: #f8fafc;
      --gray: #cbd5e1;
      --border: #334155;
      --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
      --bg-main: #0f172a;
      --bg-main-rgb: 15, 23, 42;
      --text-main: #f8fafc;
      --card-bg: #1e293b;
      --highlight: #0b1224;

      /* Form colors - dark mode */
      --form-focus-ring: rgb(96 165 250 / 0.3);
      --success-bg: #022c22;
      --success-text: #4ade80;
      --success-border: #064e3b;
      --error-bg: #450a0a;
      --error-text: #f87171;
      --error-border: #7f1d1d;

      /* Footer specific colors - dark mode */
      --footer-bg: #1e293b;
      --footer-text: #f8fafc;
    }
  }

  /* Manual theme override */
  [data-theme="dark"] {
    color-scheme: dark;
    --primary: oklch(65% 0.2 250);
    --primary-dark: oklch(55% 0.2 250);
    --secondary: #94a3b8;
    --light: #1e293b;
    --dark: #f8fafc;
    --gray: #cbd5e1;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
    --bg-main: #0f172a;
    --bg-main-rgb: 15, 23, 42;
    --text-main: #f8fafc;
    --card-bg: #1e293b;
    --highlight: #0b1224;

    /* Form colors - dark mode */
    --form-focus-ring: rgb(96 165 250 / 0.3);
    --success-bg: #022c22;
    --success-text: #4ade80;
    --success-border: #064e3b;
    --error-bg: #450a0a;
    --error-text: #f87171;
    --error-border: #7f1d1d;

    /* Footer specific colors - dark mode */
    --footer-bg: #1e293b;
    --footer-text: #f8fafc;
  }

  /* CSS Reset */
  *,
  *::before,
  *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  /* Improved defaults */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }
  }

  body {
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont,
      sans-serif;
    /* Fluid base font size */
    font-size: clamp(1rem, 0.75rem + 0.5vw, 1.125rem);
    line-height: 1.6;
    color: var(--text-main);
    background: var(--bg-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
  }

  /* Fluid typography (use largest set) */
  h1 {
    font-size: clamp(2.5rem, 2rem + 2vw, 4rem);
    line-height: 1.1;
  }
  h2 {
    font-size: clamp(2rem, 1.5rem + 1.5vw, 3rem);
    line-height: 1.2;
  }
  h3 {
    font-size: clamp(1.5rem, 1.25rem + 0.8vw, 2rem);
    line-height: 1.3;
  }
  h4 {
    font-size: clamp(1.25rem, 1rem + 0.5vw, 1.5rem);
    line-height: 1.4;
  }

  /* Focus */
  :focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
  }

  /* Media defaults */
  img,
  svg,
  video {
    display: block;
    max-width: 100%;
    height: auto;
  }

  /* Buttons reset */
  button {
    font: inherit;
    color: inherit;
    border: none;
    background: none;
    cursor: pointer;
  }

  /* Form base reset */
  input,
  select,
  textarea {
    font: inherit;
    color: inherit;
  }
}

/* ======================== */
/*        COMPONENTS        */
/* ======================== */
@layer components {
  .container {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-4);
  }

  /* Navigation */
  #navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(var(--bg-main-rgb), 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    padding-block: var(--space-3);
    transition: background-color 0.3s ease, transform 0.3s ease,
      box-shadow 0.3s ease;
  }
  #navbar.scrolled {
    background: var(--bg-main);
    box-shadow: var(--shadow);
  }

  .nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: var(--space-4);
  }

  .logo {
    font-size: clamp(1.25rem, 1rem + 1vw, 1.5rem);
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
  }

  .nav-links {
    display: flex;
    gap: clamp(1rem, 2vw, 2rem);
    align-items: center;
  }

  .nav-links a {
    position: relative;
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s ease;
    padding: var(--space-2);
  }
  .nav-links a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width 0.3s ease;
  }
  .nav-links a:hover {
    color: var(--primary);
  }
  .nav-links a:hover::after {
    width: 100%;
  }
  .nav-links a.active {
    color: var(--primary);
    font-weight: 600;
  }
  .nav-links a.active::after {
    width: 100%;
  }

  .cta-button {
    background: var(--primary);
    color: #fff;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    transition: background 0.3s ease, transform 0.2s ease;
    text-decoration: none;
  }
  .cta-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
  }
  .cta-button:active {
    transform: translateY(0);
  }

  .mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: background-color 0.3s ease;
  }
  .mobile-menu-toggle:hover {
    background-color: var(--highlight);
  }
  .mobile-menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--dark);
    transition: 0.3s;
    border-radius: 2px;
  }

  /* Theme Toggle */
  .theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: transparent;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    margin-inline-start: var(--space-3);
  }
  .theme-toggle:hover {
    background: var(--border);
  }

  /* Hero */
  .hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-block: 6rem 2rem;
    padding-inline: var(--space-4);
    position: relative;
    background: linear-gradient(135deg, var(--light) 0%, var(--highlight) 100%);
    transition: background 0.3s ease;
    scroll-margin-top: 5rem;
  }
  .hero-content {
    width: 100%;
    max-width: 1200px;
    margin-inline: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(1.5rem, 5vw, 3rem);
    align-items: center;
  }
  .hero-text h1 {
    margin-bottom: var(--space-5);
    color: var(--dark);
  }
  .hero-text p {
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.25rem);
    color: var(--secondary);
    margin-bottom: var(--space-5);
  }

  .value-prop {
    margin-bottom: var(--space-5);
  }
  .value-prop h3 {
    margin-bottom: var(--space-2);
    color: var(--dark);
  }

  .hero-buttons {
    display: flex;
    gap: var(--space-3);
  }

  /* Buttons */
  .primary-button,
  .secondary-button,
  .enhanced-cta {
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    z-index: 1;
  }

  .enhanced-cta {
    background: var(--primary);
    color: #fff;
  }
  .enhanced-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--primary-dark);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: -1;
  }
  .enhanced-cta:hover::before {
    transform: translateY(0);
  }
  .enhanced-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  }

  .primary-button {
    background: var(--primary);
    color: #fff;
  }
  .primary-button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--primary-dark);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: -1;
  }
  .primary-button:hover::before {
    transform: translateY(0);
  }
  .primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  }

  .secondary-button {
    border: 2px solid var(--primary);
    color: var(--primary);
  }
  .secondary-button::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--primary);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: -1;
  }
  .secondary-button:hover::before {
    transform: translateX(0);
  }
  .secondary-button:hover {
    color: #fff;
    transform: translateY(-2px);
  }

  .hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .floating-cards {
    position: relative;
    height: 400px;
    width: 100%;
  }
  .floating-card {
    position: absolute;
    background: var(--card-bg);
    padding: var(--space-4);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
  }
  .floating-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-elevated);
  }

  @media (prefers-reduced-motion: no-preference) {
    .card-1 {
      top: 0;
      left: 0;
      animation: float 3s ease-in-out infinite;
    }
    .card-2 {
      top: 50%;
      right: 0;
      animation: float 3s ease-in-out infinite 1s;
    }
    .card-3 {
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      animation: float 3s ease-in-out infinite 2s;
    }
    @keyframes float {
      0%,
      100% {
        transform: translateY(0);
      }
      50% {
        transform: translateY(-10px);
      }
    }
  }

  /* Sections */
  section {
    padding: var(--space-6) var(--space-4);
    scroll-margin-top: 5rem;
  }

  .section-header {
    text-align: center;
    margin-bottom: var(--space-6);
    max-width: 65ch;
    margin-inline: auto;
  }
  .section-header h2 {
    margin-bottom: var(--space-3);
    color: var(--dark);
  }
  .section-header p {
    font-size: clamp(1.1rem, 1rem + 0.3vw, 1.25rem);
    color: var(--secondary);
    max-width: 50ch;
    margin-inline: auto;
  }

  /* Services */
  @container services (min-width: 600px) {
    .service-card {
      transition: transform 0.3s ease;
    }
    .service-card:hover {
      transform: translateY(-5px);
    }
  }

  .services-grid {
    container: services / inline-size;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--space-5);
  }

  .service-card {
    background: var(--card-bg);
    padding: var(--space-5);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, box-shadow 0.3s ease,
      transform 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .service-card:hover {
    box-shadow: var(--shadow-elevated);
  }
  .service-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
  }
  .service-card h3 {
    font-size: clamp(1.25rem, 1rem + 0.5vw, 1.5rem);
    margin-bottom: var(--space-3);
    color: var(--dark);
  }
  .service-card p {
    color: var(--secondary);
  }
  .service-card ul {
    margin-top: auto;
    list-style: none;
  }
  .service-card li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: var(--space-2);
    color: var(--secondary);
  }
  .service-card li::before {
    content: "✓";
    color: var(--accent);
    position: absolute;
    left: 0;
  }
  .service-card .cta-button {
    margin-top: var(--space-4);
    align-self: flex-start;
    width: 100%;
    text-align: center;
  }

  .service-spotlight {
    grid-column: span 2;
    grid-row: span 1;
  }
  @container services (max-width: 768px) {
    .service-spotlight {
      grid-column: span 1;
    }
  }

  /* Tags */
  .tag {
    display: inline-block;
    background: var(--highlight);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    margin-right: 0.5rem;
    margin-bottom: var(--space-3);
    color: var(--text-main);
    transition: background-color 0.3s ease;
  }

  /* Portfolio */
  .portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: var(--space-5);
  }

  .portfolio-item {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease,
      background-color 0.3s ease;
  }
  .portfolio-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
  }

  /* Image wrapper now supports real images with graceful fallback */
  .portfolio-image {
    position: relative;
    overflow: hidden;
    background: linear-gradient(
      45deg,
      #e0f2fe,
      #f0f9ff
    ); /* fallback skeleton */
    isolation: isolate; /* keep overlay above image only */
    /* Fallback height when aspect-ratio not supported */
    height: 200px;
  }

  /* Prefer aspect-ratio when supported */
  @supports (aspect-ratio: 16 / 9) {
    .portfolio-image {
      height: auto;
      aspect-ratio: 16 / 9;
    }
  }

  /* Actual image fills the wrapper */
  .portfolio-image > img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform 0.45s ease;
    will-change: transform;
  }

  /* Subtle overlay to improve text contrast near edges */
  .portfolio-image::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
      to top,
      rgba(var(--bg-main-rgb), 0.28) 0%,
      rgba(0, 0, 0, 0) 65%
    );
    z-index: 1;
  }
  /* Slightly stronger overlay in dark mode */
  :root:not([data-theme="light"]) .portfolio-image::after,
  [data-theme="dark"] .portfolio-image::after {
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.35) 0%,
      rgba(0, 0, 0, 0) 65%
    );
  }

  /* Hover zoom for a bit of depth (respects reduced motion below) */
  .portfolio-item:hover .portfolio-image > img {
    transform: scale(1.03);
  }

  /* Content */
  .portfolio-content {
    padding: var(--space-4);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-2);
    align-items: center;
    cursor: pointer;
  }
  .portfolio-content h3 {
    color: var(--dark);
  }

  .portfolio-tags {
    padding-inline: var(--space-4);
    margin-bottom: var(--space-3);
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
  }

  .portfolio-details {
    padding: 0 var(--space-4) var(--space-4);
    display: none;
  }
  .portfolio-details ul {
    list-style: none;
  }
  .portfolio-details li {
    padding: 0.5rem 0;
    color: var(--secondary);
  }
  .portfolio-details li::before {
    content: "✓";
    color: var(--accent);
    margin-right: 0.5rem;
    display: inline-block;
  }

  .portfolio-note {
    font-size: 0.875rem;
    color: var(--gray);
    margin-top: var(--space-3);
    font-style: italic;
    text-align: center;
    max-width: 600px;
    margin-inline: auto;
  }

  /* Mobile tweaks: a little taller viewport for narrow cards */
  @media (max-width: 480px) {
    @supports (aspect-ratio: 4 / 3) {
      .portfolio-image {
        aspect-ratio: 4 / 3;
      }
    }
  }

  /* Respect reduced motion */
  @media (prefers-reduced-motion: reduce) {
    .portfolio-item:hover .portfolio-image > img {
      transform: none;
      transition: none;
    }
  }

  /* About */
  .about-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: clamp(1.5rem, 5vw, 3rem);
    align-items: start;
  }
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-5);
  }
  .stat-card {
    text-align: center;
    padding: var(--space-4);
    background: var(--card-bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, background-color 0.3s ease,
      box-shadow 0.3s ease;
  }
  .stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-elevated);
  }
  .stat-number {
    font-size: clamp(1.75rem, 1.5rem + 1vw, 2.25rem);
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-2);
  }
  .stat-label {
    color: var(--secondary);
  }

  /* Contact (cards/links) */
  .contact-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-5);
    margin-top: var(--space-6);
  }
  .contact-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease,
      background-color 0.3s ease;
  }
  .contact-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
  }
  .contact-icon {
    font-size: 2rem;
    transition: transform 0.3s ease;
  }
  .contact-item:hover .contact-icon {
    transform: scale(1.1);
  }

  /* Contact Form Section (from third block) */
  .contact-form-section {
    padding-block: 8rem 3rem;
    padding-inline: var(--space-4);
    background: linear-gradient(135deg, var(--light) 0%, var(--highlight) 100%);
    min-height: 100vh;
    transition: background 0.3s ease;
  }
  .contact-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: clamp(1.5rem, 3vw, 3rem);
    margin-bottom: var(--space-6);
    container: contact-layout / inline-size;
  }
  .contact-form {
    background: var(--card-bg);
    padding: clamp(1.5rem, 3vw, 2.5rem);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
  }
  .form-group {
    margin-bottom: var(--space-4);
  }
  .form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    color: var(--dark);
  }
  .form-control {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    background-color: var(--bg-main);
    color: var(--text-main);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
  }
  .form-control:hover {
    border-color: var(--gray);
  }
  .form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--form-focus-ring);
  }
  .form-control::placeholder {
    color: var(--gray);
    opacity: 0.7;
  }
  .form-control:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
  select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
  }
  textarea.form-control {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
  }
  .cf-turnstile {
    margin-block: var(--space-4);
  }

  .submit-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    position: relative;
    overflow: hidden;
    z-index: 1;
  }
  .submit-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--primary-dark);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: -1;
  }
  .submit-btn:hover::before {
    transform: translateY(0);
  }
  .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
  }
  .submit-btn:active {
    transform: translateY(0);
  }

  .loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  @keyframes spin {
    to {
      transform: rotate(360deg);
    }
  }

  .form-message {
    padding: var(--space-3);
    border-radius: var(--radius);
    margin-top: var(--space-3);
    display: none;
    animation: fadeIn 0.3s ease;
  }
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
  .success-message {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-border);
  }
  .error-message {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-border);
  }

  .contact-info-sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
  }
  .contact-card,
  .why-us-card {
    background: var(--card-bg);
    padding: var(--space-5);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: background-color 0.3s ease, transform 0.3s ease;
  }
  .contact-card:hover,
  .why-us-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-elevated);
  }
  .contact-card h3,
  .why-us-card h3 {
    margin-bottom: var(--space-4);
    color: var(--dark);
    font-weight: 600;
  }
  .contact-method {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
  }
  .contact-method:last-child {
    margin-bottom: 0;
  }
  .contact-method .icon {
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--light);
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.3s ease, transform 0.3s ease;
  }
  .contact-method:hover .icon {
    transform: scale(1.1);
    background: var(--highlight);
  }
  .contact-method h4 {
    margin-bottom: 0.25rem;
    color: var(--dark);
    font-weight: 600;
  }
  .contact-method p {
    color: var(--secondary);
    font-size: 0.95rem;
    line-height: 1.6;
  }

  .why-us-card ul {
    list-style: none;
  }
  .why-us-card li {
    padding: var(--space-2) 0;
    color: var(--secondary);
    position: relative;
    padding-left: 1.5rem;
  }
  .why-us-card li::before {
    content: "✓";
    color: var(--accent);
    position: absolute;
    left: 0;
  }

  /* Footer */
  footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: var(--space-6) var(--space-4);
    text-align: center;
    transition: background-color 0.3s ease, color 0.3s ease;
  }
  .footer-content {
    max-width: 600px;
    margin-inline: auto;
  }
  footer a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.3s ease;
  }
  footer a:hover {
    opacity: 0.8;
  }
}

/* ======================== */
/*         UTILITIES        */
/* ======================== */
@layer utilities {
  /* Responsive utilities */
  @media (max-width: 768px) {
    .hero-content {
      grid-template-columns: 1fr;
      text-align: center;
    }
    .nav-links {
      display: none;
    }
    .mobile-menu-toggle {
      display: flex;
    }
    .about-content {
      grid-template-columns: 1fr;
    }
    .floating-cards {
      height: 300px;
      margin-top: var(--space-5);
    }
    .theme-toggle {
      margin-right: var(--space-3);
    }
    .contact-form {
      padding: var(--space-4);
    }
    .contact-grid {
      gap: var(--space-5);
    }
  }

  @media (max-width: 480px) {
    .hero-buttons {
      flex-direction: column;
      width: 100%;
    }
    .hero-buttons > * {
      width: 100%;
    }
    .stats-grid {
      grid-template-columns: 1fr;
    }
    .section-header h1 {
      font-size: clamp(1.75rem, 1.5rem + 1vw, 2rem);
    }
    .contact-item {
      flex-direction: column;
      text-align: center;
      padding: var(--space-5);
    }
    .contact-icon {
      margin-bottom: var(--space-2);
    }
  }

  /* Container query fallbacks */
  @container contact-layout (max-width: 968px) {
    .contact-grid {
      grid-template-columns: 1fr;
    }
    .contact-info-sidebar {
      order: -1;
    }
  }
  @media (max-width: 968px) {
    .contact-grid {
      grid-template-columns: 1fr;
    }
    .contact-info-sidebar {
      order: -1;
    }
  }

  /* Show navigation when expanded (mobile) */
  .nav-links.show {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-main);
    padding: var(--space-4);
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border);
    z-index: 999;
  }
}

/* ======================== */
/*   CHAT WIDGET RESTYLE    */
/* ======================== */
#rc-chat-btn {
  position: fixed;
  bottom: max(30px, var(--safe-bottom));
  right: 30px;
  z-index: 10000;
  width: 60px;
  height: 60px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#rc-chat-btn:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  background: #0da66e;
}

#rc-chat-panel {
  position: fixed;
  bottom: max(100px, calc(var(--safe-bottom) + 70px));
  right: clamp(20px, 5vw, 30px);
  width: clamp(300px, 95vw, 420px);
  height: clamp(400px, 70vh, 600px);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2), 0 10px 30px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 10010;
  background: var(--card-bg);
  border: 1px solid var(--border);
  animation: chatSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s ease;
  max-height: 80vh;
  max-width: calc(100vw - 40px);
  will-change: transform, opacity;
}
@keyframes chatSlideIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

#rc-chat-close {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 20px;
  background: rgba(var(--bg-main-rgb), 0.7);
  border: none;
  color: var(--text-main);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  z-index: 2;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
#rc-chat-close:hover {
  background: var(--primary);
  color: #fff;
  transform: rotate(90deg);
}

#rc-chat-panel iframe {
  width: 100%;
  height: 100%;
  border: none;
  margin: 0;
  padding: 0;
  display: block;
  border-radius: 20px;
}

.chat-iframe-container {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  display: flex;
}

/* Chat responsive */
@media (max-width: 768px) {
  #rc-chat-panel {
    width: calc(100% - 30px);
    height: clamp(350px, 70vh, 550px);
    bottom: 90px;
    right: 15px;
    left: 15px;
    margin: 0 auto;
    border-radius: 16px;
  }
  #rc-chat-btn {
    bottom: max(20px, var(--safe-bottom));
    right: 20px;
    width: 55px;
    height: 55px;
    font-size: 24px;
  }
}
@media (max-width: 480px) {
  #rc-chat-panel {
    height: 60vh;
    bottom: 80px;
  }
  #rc-chat-btn {
    width: 50px;
    height: 50px;
  }
}
/* Small height devices */
@media (max-height: 600px) {
  #rc-chat-panel {
    height: 80vh;
    max-height: 450px;
  }
}

/* Reduced motion tweaks */
@media (prefers-reduced-motion: reduce) {
  .cta-button:hover,
  .cta-button:active,
  .primary-button:hover,
  .secondary-button:hover,
  .enhanced-cta:hover,
  .enhanced-cta::before,
  .primary-button::before,
  .secondary-button::before,
  .floating-card:hover {
    transform: none;
    transition: background-color 0.3s ease;
  }

  .loader {
    animation: none;
    border: 2px solid #fff;
    opacity: 0.7;
  }
}
/* === Portfolio image height: ORDER-PROOF PATCH === */
/* Target BOTH pages */
section.portfolio .portfolio-item,
section#portofoliu .portfolio-item {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Ratio box that always reserves space (even if CSS loads late) */
section.portfolio .portfolio-image,
section#portofoliu .portfolio-image {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(45deg, #e0f2fe, #f0f9ff); /* fallback skeleton */
  isolation: isolate;
}

/* Reserve 16:9 height (56.25%) + a floor for tiny screens */
section.portfolio .portfolio-image::before,
section#portofoliu .portfolio-image::before {
  content: "";
  display: block;
  padding-top: 56.25%; /* 16:9 space reservation */
  min-height: 220px; /* floor so it never collapses */
}

/* Absolutely fill the reserved box */
section.portfolio .portfolio-image > img,
section#portofoliu .portfolio-image > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.45s ease;
  transform: translateZ(0);
}

/* Gentle overlay only within the image box */
section.portfolio .portfolio-image::after,
section#portofoliu .portfolio-image::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.18) 0%,
    rgba(0, 0, 0, 0) 65%
  );
  z-index: 1;
}

/* A touch stronger in dark theme */
:root[data-theme="dark"] section.portfolio .portfolio-image::after,
:root:not([data-theme="light"]) section.portfolio .portfolio-image::after,
:root[data-theme="dark"] section#portofoliu .portfolio-image::after,
:root:not([data-theme="light"]) section#portofoliu .portfolio-image::after {
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0) 65%
  );
}

/* Ensure text sits in normal flow above (no accidental overlay) */
section.portfolio .portfolio-tags,
section.portofoliu .portfolio-tags,
section.portfolio .portfolio-content,
section.portofoliu .portfolio-content,
section.portfolio .portfolio-details,
section.portofoliu .portfolio-details {
  position: relative;
  z-index: 0;
  background: transparent;
  clear: both;
}

/* Optional: subtle hover without causing layout weirdness */
section.portfolio .portfolio-item:hover .portfolio-image > img,
section#portofoliu .portfolio-item:hover .portfolio-image > img {
  transform: scale(1.02);
}
@media (prefers-reduced-motion: reduce) {
  section.portfolio .portfolio-item:hover .portfolio-image > img,
  section#portofoliu .portfolio-item:hover .portfolio-image > img {
    transform: none;
    transition: none;
  }
}

/* Mobile: give a bit more height */
@media (max-width: 480px) {
  section.portfolio .portfolio-image::before,
  section#portofoliu .portfolio-image::before {
    min-height: 240px;
  }
}
