<template>
    <section class="landing">
      <div class="landing-container">
        <div class="landing-content animate-splash">
          <div class="terminal-duck-container">
            <div class="terminal-wrapper">
              <DuckTerminal />
            </div>
            <div class="duck-container">
              <div class="duck-placeholder">
                <img
                  src="../assets/duck.gif"
                  alt="Dancing Duck"
                  class="dancing-duck"
                  @load="duckLoaded = true"
                  :class="{ 'duck-loaded': duckLoaded }"
                />
                <div class="duck-loading" v-if="!duckLoaded">
                  <span class="loading-text">Chargement du canard...</span>
                </div>
              </div>
            </div>
          </div>
          <div class="landing-buttons">
            <button class="btn btn-primary">
              Voir mon parcours
              <svg
                xmlns="http://www.w3.org/2000/svg"
                width="24"
                height="24"
                viewBox="0 0 24 24"
                fill="none"
                stroke="currentColor"
                stroke-width="2"
                stroke-linecap="round"
                stroke-linejoin="round"
                class="btn-icon"
              >
                <path d="M12 5v14"></path>
                <path d="m19 12-7 7-7-7"></path>
              </svg>
            </button>
            <a href="mailto:contact@maric.ro" class="btn btn-secondary"
              >Me contacter</a
            >
          </div>
          <div class="duck-container-small">
            <DuckSvg svgClass="duck-svg animate-float" />
          </div>
        </div>
      </div>
  
      <!-- Background Duck Elements -->
      <div class="bg-duck bg-duck-1">
        <DuckSvg />
      </div>
      <div class="bg-duck bg-duck-2">
        <DuckSvg />
      </div>
      <div class="bg-duck bg-duck-3">
        <DuckSvg />
      </div>
    </section>
  </template>
  
  <script>
  import DuckSvg from "./ducks/Duck1.vue";
  import DuckTerminal from "./DuckTerminal.vue";
  
  export default {
    name: "Landing",
    components: {
      DuckSvg,
      DuckTerminal,
    },
    data() {
      return {
        duckLoaded: false,
      };
    },
  };
  </script>
  
  <style scoped>
  .landing {
    padding: 4rem 1rem;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
  }
  
  .landing-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 90%;
    margin: 0 auto;
    z-index: 10;
  }
  
  .landing-content {
    text-align: center;
    width: 100%;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .terminal-duck-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 1.5rem;
  }
  
  .terminal-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
  }
  
  .duck-container {
    margin-top: 1.5rem;
    width: 100%;
    display: flex;
    justify-content: center;
  }
  
  .landing-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
  }
  
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.75rem;
    border-radius: 0.375rem;
    padding: 0 2rem;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
  }
  
  .btn-primary {
    background-color: var(--duck-yellow);
    color: black;
    border: none;
  }
  
  .btn-primary:hover {
    background-color: rgba(255, 219, 88, 0.9);
  }
  
  .btn-secondary {
    background-color: transparent;
    border: 1px solid var(--duck-blue);
    color: var(--duck-blue);
  }
  
  .btn-secondary:hover {
    background-color: rgba(70, 130, 180, 0.1);
  }
  
  .btn-icon {
    width: 1rem;
    height: 1rem;
    margin-left: 0.5rem;
  }
  
  .duck-container-small {
    display: flex;
    justify-content: center;
  }
  
  .duck-svg {
    width: 5rem;
    height: 5rem;
  }
  
  .dancing-duck {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .duck-placeholder {
    width: 320px;
    height: 320px;
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .duck-loaded {
    opacity: 1;
  }
  
  .duck-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0.5rem;
  }
  
  .loading-text {
    color: var(--duck-yellow, #ffdb58);
    font-family: "Courier New", monospace;
    font-size: 1rem;
    animation: duck-bounce 1.5s infinite;
  }
  
  @keyframes duck-bounce {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-10px);
    }
  }
  
  /* Background Duck Elements */
  .bg-duck {
    position: absolute;
    opacity: 0.1;
    z-index: 1;
  }
  
  .bg-duck-1 {
    top: 8rem;
    right: 2.5rem;
    transform: rotate(12deg);
    display: none;
  }
  
  .bg-duck-1 svg {
    width: 16rem;
    height: 16rem;
  }
  
  .bg-duck-2 {
    bottom: 40%;
    left: 0;
    transform: rotate(-12deg);
    display: none;
  }
  
  .bg-duck-2 svg {
    width: 12rem;
    height: 12rem;
  }
  
  .bg-duck-3 {
    bottom: 33.333%;
    right: 33.333%;
    opacity: 0.05;
    transform: rotate(45deg);
    display: none;
  }
  
  .bg-duck-3 svg {
    width: 24rem;
    height: 24rem;
  }
  
  @media (min-width: 768px) {
    .landing-content {
      text-align: left;
      align-items: flex-start;
    }
  
    .terminal-duck-container {
      flex-direction: row;
      align-items: flex-start;
      justify-content: space-between;
    }
  
    .terminal-wrapper {
      width: 60%;
      margin-right: 2rem;
    }
  
    .duck-container {
      width: 40%;
      margin-top: 0;
    }
  
    .landing-buttons {
      justify-content: flex-start;
    }
  
    .duck-placeholder {
      width: 100%;
      max-width: 320px;
    }
  
    .bg-duck-1,
    .bg-duck-2 {
      display: block;
    }
  }
  
  @media (min-width: 1024px) {
    .bg-duck-3 {
      display: block;
    }
  }
  </style>