/* ==========================================================================
   Design Tokens & Modern CSS Architecture
   ========================================================================== */

@layer reset, base, theme, components, layout, utilities;

@layer reset {

  /* Modern target-specific resets */
  html {
    box-sizing: border-box;
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
    scroll-behavior: smooth;
  }

  *,
  *::before,
  *::after {
    box-sizing: inherit;
  }

  body {
    margin: 0;
    padding: 0;
    min-block-size: 100dvh;
    overflow-x: hidden;
  }

  img,
  svg {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
  }

  button,
  input {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
  }

  button {
    cursor: pointer;
  }
}

@layer theme {
  :root {
    /* Theme colors (OKLCH based) */
    --color-dark-bg: #0b1510;
    --color-forest: #162a1f;
    --color-forest-glow: #1f3b2c;
    --color-cream: #f4efe2;
    --color-cream-subtle: #dcd6c5;
    --color-gold: #d49f39;
    --color-gold-glow: rgba(212, 159, 57, 0.25);
    --color-wood: #3e261a;
    --color-wood-dark: #22140d;
    --color-white-trans: rgba(255, 255, 255, 0.05);
    --color-border: rgba(244, 239, 226, 0.12);

    /* Typography */
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: 'Playfair Display', Georgia, Cambria, "Times New Roman", serif;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2.5rem;
    --space-xl: 4rem;

    /* Interactive Custom Properties (Updated via JS) */
    --mx: 0px;
    --my: 0px;
  }
}

@layer base {
  body {
    background-color: var(--color-dark-bg);
    background-image:
      radial-gradient(circle at 50% 30%, rgba(22, 42, 31, 0.75), var(--color-dark-bg) 80%),
      linear-gradient(to bottom, rgba(11, 21, 16, 0.4), rgba(11, 21, 16, 0.95)),
      url('assets/hero.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-blend-mode: multiply;
    color: var(--color-cream);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-serif);
    color: var(--color-cream);
    text-wrap: balance;
    margin: 0;
    font-weight: 600;
  }

  p {
    text-wrap: pretty;
    margin: 0;
  }

  /* Custom Scrollbar */
  ::-webkit-scrollbar {
    width: 8px;
  }

  ::-webkit-scrollbar-track {
    background: var(--color-dark-bg);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--color-forest);
    border-radius: 4px;
    border: 2px solid var(--color-dark-bg);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--color-gold);
  }

  /* High contrast mode adaptations */
  @media (forced-colors: active) {
    body {
      background-image: none !important;
    }

    .info-card {
      border: 2px solid CanvasText !important;
    }
  }
}

@layer layout {
  .layout-wrapper {
    position: relative;
    min-block-size: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    padding-inline: var(--space-md);
    padding-block-end: var(--space-md);
  }

  .site-header {
    max-inline-size: 1200px;
    margin-inline: auto;
    width: 100%;
    padding-block: var(--space-md);
    display: flex;
    justify-content: flex-end;
    z-index: 100;
  }

  .main-content {
    max-inline-size: 800px;
    margin-inline: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
    z-index: 10;
  }

  .site-footer {
    text-align: center;
    padding-block-top: var(--space-md);
    color: var(--color-cream-subtle);
    font-size: 0.9rem;
    opacity: 0.7;
    z-index: 10;
  }
}

@layer components {

  /* Language Toggle */
  .lang-switch-btn {
    background: var(--color-white-trans);
    border: 1px solid var(--color-border);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(8px);
  }

  .lang-switch-btn:hover {
    background: var(--color-cream);
    color: var(--color-dark-bg);
    border-color: var(--color-cream);
    transform: translateY(-1px);
  }

  .lang-switch-btn:focus-visible {
    outline: 2px solid var(--color-gold);
    outline-offset: 3px;
  }

  /* Fairy Lights Animation */
  .fairy-lights-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
  }

  .fairy-lights-svg {
    width: 100%;
    height: 100%;
  }

  .bulb {
    fill: #ffd573;
    filter: drop-shadow(0 0 4px #ffd573);
    animation: flicker infinite alternate;
  }

  .bulb-1 {
    animation-duration: 0.9s;
  }

  .bulb-2 {
    animation-duration: 1.4s;
    animation-delay: 0.2s;
  }

  .bulb-3 {
    animation-duration: 1.1s;
    animation-delay: 0.5s;
  }

  .bulb-4 {
    animation-duration: 1.6s;
    animation-delay: 0.8s;
  }

  @keyframes flicker {
    0% {
      opacity: 0.4;
      filter: drop-shadow(0 0 1px #ffd573);
    }

    100% {
      opacity: 1;
      filter: drop-shadow(0 0 8px #ffb300);
    }
  }

  /* Side Lanterns & Brackets */
  .lantern-bracket {
    position: absolute;
    top: 80px;
    width: 100px;
    height: 150px;
    pointer-events: none;
    z-index: 8;
    display: none;
    /* Desktop only */
  }

  @media (min-width: 1100px) {
    .lantern-bracket {
      display: block;
    }
  }

  .left-lantern {
    left: calc(50% - 580px);
  }

  .right-lantern {
    right: calc(50% - 580px);
  }

  .bracket-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
  }

  .lantern-body {
    position: absolute;
    top: 60px;
    width: 50px;
    height: 75px;
    transition: transform 0.1s ease-out;
  }

  .left-lantern .lantern-body {
    left: 55px;
    transform: translate(var(--mx), var(--my));
  }

  .right-lantern .lantern-body {
    right: 55px;
    transform: translate(calc(-1 * var(--mx)), var(--my));
  }

  .lantern-frame {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
  }

  .lantern-glow {
    position: absolute;
    top: 15px;
    left: 5px;
    width: 40px;
    height: 50px;
    border-radius: 50% 50% 40% 40%;
    background: radial-gradient(circle, #ffe699 10%, #ffd043 50%, rgba(212, 159, 57, 0) 80%);
    box-shadow:
      0 0 20px #ffc107,
      0 0 45px rgba(255, 193, 7, 0.4),
      0 0 70px rgba(255, 193, 7, 0.2);
    z-index: 1;
    animation: glowPulse 4s infinite ease-in-out alternate;
  }

  @keyframes glowPulse {
    0% {
      transform: scale(0.95);
      opacity: 0.85;
    }

    100% {
      transform: scale(1.05);
      opacity: 1;
      box-shadow:
        0 0 25px #ffc107,
        0 0 55px rgba(255, 193, 7, 0.5),
        0 0 85px rgba(255, 193, 7, 0.3);
    }
  }

  /* Hero Brand Section */
  .brand-hero {
    text-align: center;
  }

  .logo-container {
    margin-inline: auto;
    margin-block-end: var(--space-sm);
    width: clamp(140px, 15vw, 180px);
    aspect-ratio: 1;
    border-radius: 50%;
    border: 3px solid var(--color-gold);
    padding: 4px;
    background: var(--color-dark-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 25px rgba(212, 159, 57, 0.15);
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }

  .logo-container:hover {
    transform: rotate(3deg) scale(1.04);
  }

  .brand-logo {
    width: 100%;
    height: 100%;
    /* object-fit: cover; */
    border-radius: 50%;
    transform: scale(1.12);
  }

  .brand-name {
    font-size: clamp(2.2rem, 1rem + 4vw, 3.8rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-block-end: 0.2rem;
    color: var(--color-cream);
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  }

  .brand-tagline {
    font-size: clamp(0.95rem, 0.8rem + 1vw, 1.3rem);
    font-family: var(--font-sans);
    color: var(--color-gold);
    letter-spacing: 0.15em;
    font-weight: 500;
    text-transform: uppercase;
    margin-block-end: var(--space-sm);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  }

  .divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    color: var(--color-cream-subtle);
    opacity: 0.8;
    font-size: 1.1rem;
  }

  .divider .heart {
    color: #c94a4a;
    font-size: 0.9rem;
    animation: heartbeat 2s infinite ease-in-out;
  }

  @keyframes heartbeat {

    0%,
    100% {
      transform: scale(1);
    }

    50% {
      transform: scale(1.2);
    }
  }

  /* Glassmorphic Card */
  .info-card {
    position: relative;
    width: 100%;
    border-radius: 24px;
    background: rgba(22, 42, 31, 0.45);
    border: 1px solid var(--color-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    overflow: hidden;
  }

  .card-header-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: linear-gradient(to right, var(--color-gold), #ffd043, var(--color-gold));
  }

  .card-content {
    padding: clamp(1.5rem, 3vw, 3rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }

  .status-title {
    font-size: clamp(1.4rem, 1rem + 2vw, 2rem);
    color: var(--color-cream);
    text-align: center;
  }

  .status-description {
    font-size: clamp(0.95rem, 0.85rem + 0.5vw, 1.1rem);
    text-align: center;
    color: var(--color-cream-subtle);
    max-inline-size: 600px;
    margin-inline: auto;
    line-height: 1.7;
    opacity: 0.9;
  }

  /* Countdown */
  .countdown-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 1.5vw, 1.5rem);
    margin-block: var(--space-sm);
    background: rgba(0, 0, 0, 0.25);
    padding: var(--space-sm) var(--space-md);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.03);
  }

  .countdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-inline-size: clamp(55px, 10vw, 75px);
  }

  .countdown-item.separator {
    min-inline-size: auto;
    font-size: clamp(1.5rem, 2vw, 2.5rem);
    font-family: var(--font-serif);
    color: var(--color-gold);
    opacity: 0.8;
    transform: translateY(-8px);
  }

  .time-num {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 1rem + 3vw, 2.8rem);
    color: var(--color-gold);
    font-weight: 700;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  }

  .time-label {
    font-size: clamp(0.7rem, 0.65rem + 0.2vw, 0.85rem);
    color: var(--color-cream-subtle);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-block-start: 4px;
  }

  /* Signup Container */
  .signup-container {
    width: 100%;
    max-inline-size: 550px;
    margin-inline: auto;
    margin-block-top: var(--space-xs);
    text-align: center;
  }

  .signup-title {
    font-size: 1.1rem;
    font-family: var(--font-sans);
    color: var(--color-cream);
    font-weight: 500;
    margin-block-end: var(--space-sm);
  }

  .signup-form {
    width: 100%;
  }

  .floating-input-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
  }

  @media (min-width: 500px) {
    .floating-input-group {
      flex-direction: row;
      gap: 0;
      background: rgba(0, 0, 0, 0.3);
      border: 1px solid var(--color-border);
      border-radius: 50px;
      padding: 5px;
      transition: border-color 0.3s, box-shadow 0.3s;
    }

    .floating-input-group:focus-within {
      border-color: var(--color-gold);
      box-shadow: 0 0 0 3px rgba(212, 159, 57, 0.2);
    }
  }

  .email-input {
    width: 100%;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--color-border);
    border-radius: 30px;
    color: var(--color-cream);
    transition: border-color 0.3s;
  }

  @media (min-width: 500px) {
    .email-input {
      background: transparent;
      border: none;
      padding-inline: 1.5rem 0.5rem;
      border-radius: 0;
    }

    .email-input:focus {
      outline: none;
    }
  }

  /* Floating Label */
  .input-label {
    position: absolute;
    left: 1.5rem;
    top: 1rem;
    color: var(--color-cream-subtle);
    opacity: 0.6;
    pointer-events: none;
    transition: transform 0.3s, font-size 0.3s, opacity 0.3s;
    transform-origin: left top;
  }

  /* Float the label when input has content or is focused */
  .email-input:focus~.input-label,
  .email-input:not(:placeholder-shown)~.input-label,
  .email-input:-webkit-autofill~.input-label,
  .email-input:valid~.input-label {
    transform: translate(-10px, -1.8rem) scale(0.85);
    opacity: 1;
    color: var(--color-gold);
  }

  /* Make placeholder label behavior work nicely with floating input group in desktop */
  @media (min-width: 500px) {

    .email-input:focus~.input-label,
    .email-input:not(:placeholder-shown)~.input-label,
    .email-input:-webkit-autofill~.input-label,
    .email-input:valid~.input-label {
      transform: translate(0px, -1.7rem) scale(0.85);
    }
  }

  /* Email Validation Styling */
  .email-input:user-invalid {
    border-color: #c94a4a;
  }

  .email-input:user-invalid~.input-label {
    color: #c94a4a;
  }

  .signup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    background: var(--color-gold);
    color: var(--color-dark-bg);
    font-weight: 600;
    padding: 0.9rem 1.8rem;
    border-radius: 30px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(212, 159, 57, 0.3);
  }

  @media (min-width: 500px) {
    .signup-btn {
      padding-block: 0.8rem;
      border-radius: 50px;
    }
  }

  .signup-btn:hover:not(:disabled) {
    background: #ffe082;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212, 159, 57, 0.5);
  }

  .signup-btn:active {
    transform: translateY(1px);
  }

  .signup-btn:focus-visible {
    outline: 2px solid var(--color-cream);
    outline-offset: 2px;
  }

  .privacy-note {
    font-size: 0.8rem;
    color: var(--color-cream-subtle);
    opacity: 0.6;
    margin-block-start: var(--space-sm);
  }

  /* Steaming Cup Icon on Signup Button */
  .steam-cup {
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    height: 20px;
    width: 20px;
    color: currentColor;
  }

  .cup-svg {
    width: 100%;
    height: 100%;
  }

  .steam {
    position: absolute;
    top: -12px;
    font-family: monospace;
    font-size: 11px;
    line-height: 1;
    font-weight: bold;
    opacity: 0;
    transform: scaleX(0.7) rotate(90deg);
    animation: rise 3s infinite linear;
  }

  .steam-1 {
    left: 5px;
    animation-delay: 0.2s;
  }

  .steam-2 {
    right: 5px;
    animation-delay: 1.7s;
  }

  @keyframes rise {
    0% {
      transform: translateY(4px) scaleX(0.7) rotate(90deg);
      opacity: 0;
    }

    30% {
      opacity: 0.8;
    }

    60% {
      opacity: 0.5;
    }

    100% {
      transform: translateY(-8px) scaleX(0.5) rotate(70deg) translateX(2px);
      opacity: 0;
    }
  }
}

@layer utilities {

  /* CSS-driven Language Selection */
  html[lang="de"] .lang-en {
    display: none !important;
  }

  html[lang="en"] .lang-de {
    display: none !important;
  }
}