/* ============================================
   ARKADESC İnşaat — CSS Custom Properties
   Design System: Dark + Gold + Cream
   ============================================ */

@layer reset, base, components, utilities;

/* ============================================
   LAYER: RESET
   ============================================ */

@layer reset {
  *,
  *::before,
  *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  html {
    scroll-behavior: smooth;
  }

  body,
  html {
    width: 100%;
    height: 100%;
  }

  button,
  a {
    font-family: inherit;
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

  input,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }
}

/* ============================================
   LAYER: BASE — CSS Custom Properties
   ============================================ */

@layer base {
  :root {
    /* COLOR PALETTE */
    --bg: #0A0A0A;
    --surface: #141414;
    --surface-hover: #1A1A1A;
    --text: #E8E4DC;
    --text-secondary: #B8B4AC;
    --gold: #F5C518;
    --gold-hover: #FFD94D;
    --gold-light: rgba(245, 193, 24, 0.12);
    --gold-border: rgba(245, 193, 24, 0.2);
    --cream: #F5F0E8;
    --cream-dark: #E8DFD0;
    --error: #FF6B6B;
    --success: #51CF66;
    --warning: #FFA500;

    /* TYPOGRAPHY */
    --font-heading: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-accent: 'Cormorant Garamond', serif;

    --fs-hero: clamp(3rem, 8vw, 7rem);
    --fs-h1: clamp(2rem, 6vw, 4rem);
    --fs-h2: clamp(1.5rem, 4vw, 2.5rem);
    --fs-h3: clamp(1.25rem, 3vw, 2rem);
    --fs-body: clamp(1rem, 2vw, 1.25rem);
    --fs-small: 0.875rem;
    --fs-tiny: 0.75rem;

    --fw-light: 400;
    --fw-regular: 500;
    --fw-semibold: 600;
    --fw-bold: 700;
    --fw-black: 900;

    --lh-tight: 1.2;
    --lh-normal: 1.6;
    --lh-relaxed: 1.8;

    --ls-tight: -0.02em;
    --ls-normal: 0em;
    --ls-loose: 0.05em;

    /* SPACING */
    --xs: 0.25rem;
    --sm: 0.5rem;
    --md: 1rem;
    --lg: 1.5rem;
    --xl: 2rem;
    --2xl: 3rem;
    --3xl: 4rem;
    --4xl: 6rem;
    --5xl: 8rem;

    /* BORDER RADIUS */
    --radius-none: 0;
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;
    --radius-full: 9999px;

    /* SHADOWS */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px 0 rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 10px 15px 0 rgba(0, 0, 0, 0.8);
    --shadow-xl: 0 20px 25px 0 rgba(0, 0, 0, 0.9);
    --shadow-glow-gold: 0 0 20px rgba(245, 193, 24, 0.3);

    /* TRANSITIONS */
    --transition-fast: 0.2s ease-out;
    --transition-normal: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);

    /* COMPONENT COMPOSITES */
    --card-bg: rgba(245, 193, 24, 0.08);
    --card-border: 1px solid rgba(245, 193, 24, 0.2);
    --card-border-radius: 1rem;
    --card-padding: 2rem;
    --card-blur: blur(12px);

    --header-bg: rgba(10, 10, 10, 0.95);
    --header-border: 1px solid rgba(245, 193, 24, 0.1);
    --header-blur: blur(12px);
    --header-height: 4rem;

    --button-padding: 0.875rem 1.75rem;
    --button-radius: 0.5rem;
    --button-transition: all 0.2s ease-out;

    /* Z-INDEX */
    --z-header: 1000;
    --z-mobile-menu: 999;
    --z-fab: 100;
    --z-modal: 1001;
  }

  /* DARK MODE - ENFORCED */
  body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-normal);
    font-weight: var(--fw-regular);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: var(--font-heading);
    font-weight: var(--fw-bold);
    letter-spacing: var(--ls-tight);
    line-height: var(--lh-tight);
  }

  h1 {
    font-size: var(--fs-h1);
  }

  h2 {
    font-size: var(--fs-h2);
  }

  h3 {
    font-size: var(--fs-h3);
  }

  a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--transition-fast);
  }

  a:hover {
    color: var(--gold-hover);
  }

  a:focus-visible {
    outline: var(--shadow-glow-gold) 2px solid;
    outline-offset: 2px;
  }

  button,
  input[type='button'],
  input[type='submit'] {
    cursor: pointer;
    border: none;
    transition: var(--button-transition);
  }

  button:focus-visible,
  input[type='button']:focus-visible,
  input[type='submit']:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
  }

  input,
  textarea,
  select {
    background-color: var(--surface);
    border: 1px solid var(--gold-border);
    border-radius: var(--radius-md);
    padding: var(--md);
    color: var(--text);
    transition: var(--transition-fast);
  }

  input:focus,
  textarea:focus,
  select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 2px rgba(245, 193, 24, 0.1);
  }

  input::placeholder {
    color: var(--text-secondary);
  }
}

/* ============================================
   LAYER: COMPONENTS
   ============================================ */

@layer components {
  /* CARD GLASSMORPHISM */
  .card,
  .stat-card,
  .project-card,
  .service-card {
    background: var(--card-bg);
    backdrop-filter: var(--card-blur);
    border: var(--card-border);
    border-radius: var(--card-border-radius);
    padding: var(--card-padding);
    transition: var(--transition-normal);
  }

  .card:hover,
  .stat-card:hover,
  .project-card:hover {
    background: rgba(245, 193, 24, 0.12);
    border-color: rgba(245, 193, 24, 0.3);
    transform: translateY(-2px);
  }

  /* BUTTONS */
  .btn,
  button {
    padding: var(--button-padding);
    border-radius: var(--button-radius);
    font-weight: var(--fw-semibold);
    font-size: 1rem;
    transition: var(--button-transition);
  }

  .btn-primary,
  .btn-cta {
    background-color: var(--gold);
    color: var(--bg);
    box-shadow: var(--shadow-sm);
  }

  .btn-primary:hover,
  .btn-cta:hover {
    background-color: var(--gold-hover);
    box-shadow: var(--shadow-glow-gold);
    transform: translateY(-2px);
  }

  .btn-secondary {
    background-color: transparent;
    border: 2px solid var(--gold);
    color: var(--gold);
  }

  .btn-secondary:hover {
    background-color: var(--gold-light);
    border-color: var(--gold-hover);
  }

  /* HEADER / STICKY NAV */
  header,
  nav.sticky {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--header-bg);
    backdrop-filter: var(--header-blur);
    border-bottom: var(--header-border);
    height: var(--header-height);
  }

  /* MOBILE HAMBURGER */
  .hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.5rem;
  }

  .hamburger span {
    width: 24px;
    height: 3px;
    background-color: var(--gold);
    margin: 4px 0;
    transition: var(--transition-fast);
    transform-origin: center;
  }

  .hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(10px, 10px);
  }

  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
  }

  @media (max-width: 768px) {
    .hamburger {
      display: flex;
    }
  }

  /* SKIP LINK */
  .skip-link {
    position: absolute;
    left: -9999px;
    top: -9999px;
    z-index: 9999;
    padding: 1rem;
    background-color: var(--gold);
    color: var(--bg);
    text-decoration: none;
    border-radius: var(--radius-md);
  }

  .skip-link:focus {
    left: 1rem;
    top: 1rem;
  }

  /* ANNOUNCEMENT BAR */
  .announcement-bar {
    background: linear-gradient(90deg, rgba(245, 193, 24, 0.15), rgba(245, 193, 24, 0.08));
    border-bottom: 1px solid var(--gold-border);
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: var(--fs-small);
    color: var(--cream);
  }

  .announcement-bar a {
    color: var(--gold);
    font-weight: var(--fw-semibold);
  }

  /* SECTION STRUCTURE */
  section {
    padding: var(--4xl) var(--2xl);
  }

  section:nth-child(odd) {
    background-color: var(--bg);
  }

  section:nth-child(even) {
    background-color: var(--surface);
  }

  @media (max-width: 768px) {
    section {
      padding: var(--2xl) var(--lg);
    }
  }

  /* GRID LAYOUTS */
  .grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--2xl);
  }

  .grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--2xl);
  }

  .grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--2xl);
  }

  @media (max-width: 768px) {
    .grid-3,
    .grid-4 {
      grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
  }

  /* ANIMATION STATES */
  [data-animate] {
    opacity: 0;
    transform: translateY(30px);
  }

  [data-animate].visible {
    opacity: 1;
    transform: translateY(0);
    transition: var(--transition-normal);
  }

  /* SCROLL-DRIVEN ANIMATION FALLBACK */
  @supports (animation-timeline: view()) {
    [data-scroll-animate] {
      animation: slideUp linear forwards;
      animation-timeline: view();
      animation-range: entry 0% entry 50%;
    }

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

  /* 3D BUILDING PERSPECTIVE */
  .building-3d-container {
    perspective: 1000px;
    perspective-origin: center;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .building-cube {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
  }

  @media (prefers-reduced-motion: no-preference) {
    .building-cube {
      animation: rotateBuilding 8s linear infinite;
    }

    @keyframes rotateBuilding {
      from {
        transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
      }
      to {
        transform: rotateX(10deg) rotateY(360deg) rotateZ(-5deg);
      }
    }
  }

  /* CLIP-PATH REVEALS */
  .project-overlay,
  .service-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.9), rgba(245, 193, 24, 0.3));
    clip-path: polygon(0 100%, 100% 100%, 100% 100%, 0 100%);
    transition: clip-path 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
  }

  .project-card:hover .project-overlay,
  .service-card:hover .service-overlay {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  }

  /* SVG DRAWING ANIMATION */
  .blueprint-svg path {
    stroke: var(--gold);
    stroke-width: 2;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
  }

  @media (prefers-reduced-motion: no-preference) {
    .blueprint-svg path {
      animation: drawLine 3s ease forwards;
      animation-timeline: view();
    }

    @keyframes drawLine {
      to {
        stroke-dashoffset: 0;
      }
    }
  }

  /* CONTAINMENT OPTIMIZATION */
  .project-card,
  .stat-card,
  .service-card,
  article {
    contain: layout paint style;
  }

  /* CANVAS CONTAINER */
  #particles-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 0;
  }

  .hero-content {
    position: relative;
    z-index: 1;
  }
}

/* ============================================
   LAYER: UTILITIES
   ============================================ */

@layer utilities {
  /* FLEXBOX */
  .flex {
    display: flex;
  }

  .flex-col {
    flex-direction: column;
  }

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

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

  .justify-center {
    justify-content: center;
  }

  .justify-between {
    justify-content: space-between;
  }

  .gap-md {
    gap: var(--md);
  }

  .gap-lg {
    gap: var(--lg);
  }

  /* TEXT */
  .text-center {
    text-align: center;
  }

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

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

  .text-gold {
    color: var(--gold);
  }

  .text-cream {
    color: var(--cream);
  }

  .text-small {
    font-size: var(--fs-small);
  }

  /* BACKGROUNDS */
  .bg-surface {
    background-color: var(--surface);
  }

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

  /* VISIBILITY */
  .hidden {
    display: none;
  }

  .invisible {
    visibility: hidden;
  }

  /* CONTAINER QUERIES */
  .card-container {
    container-type: inline-size;
  }

  @container (min-width: 400px) {
    .card-grid-layout {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--lg);
    }
  }

  @container (max-width: 300px) {
    .card-title {
      font-size: 1.2rem;
    }
  }

  /* RESPONSIVE UTILITIES */
  @media (max-width: 768px) {
    .hide-mobile {
      display: none;
    }

    .flex-col-mobile {
      flex-direction: column;
    }
  }

  @media (min-width: 1440px) {
    .show-desktop {
      display: block;
    }
  }

  /* WILL-CHANGE PERFORMANCE */
  .animate-gpu {
    will-change: transform, opacity;
  }

  /* MOTION PREFERENCES */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

/* ============================================
   WHATSAPP FAB
   ============================================ */

.whatsapp-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-fab);
  opacity: 0;
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
  transform: scale(0.8);
  text-decoration: none;
}

.whatsapp-fab.visible {
  opacity: 1;
  transform: scale(1);
}

.whatsapp-fab:hover {
  background-color: var(--gold-hover);
  transform: scale(1.1);
}

.whatsapp-fab svg {
  width: 30px;
  height: 30px;
  fill: var(--bg);
}

@media (max-width: 768px) {
  .whatsapp-fab {
    bottom: 1rem;
    right: 1rem;
  }
}
