/*
Theme Name: Ruby
Theme URI: https://ruby.com
Author: Ruby Studio
Author URI: https://ruby.com
Description: Exclusive minimalist luxury theme for Ruby.
Version: 1.0.0
Text Domain: ruby
*/

:root {
  --ruby-font: 'PT Serif', Georgia, "Times New Roman", serif;
  --ruby-bg-light: #EFE7E2;
  --ruby-dark: #2b2927;
  --ruby-line: #4a4744;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: #0d0f12;
  font-family: var(--ruby-font);
  color: var(--ruby-dark);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.ruby-fullscreen-page {
  overflow: hidden;
}

/* =========================================================
   OPENING SCREEN
   ========================================================= */

.ruby-opening-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background-color: #0d0f12;
  user-select: none;
}

/* Background Scene with zoom-out effect */
.ruby-bg-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  transform-origin: center center;
  animation: rubySceneZoomOut 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, opacity;
  pointer-events: none;
  display: block;
}

@keyframes rubySceneZoomOut {
  0% {
    opacity: 0.6;
    transform: scale(1.22);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Top Left Concierge */
.ruby-concierge {
  position: absolute;
  top: clamp(24px, 3.5vw, 44px);
  top: calc(clamp(24px, 3.5vw, 44px) + env(safe-area-inset-top, 0px));
  left: clamp(20px, 3.5vw, 48px);
  left: calc(clamp(20px, 3.5vw, 48px) + env(safe-area-inset-left, 0px));
  z-index: 10;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  opacity: 0;
  animation: rubyFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 1.9s forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.ruby-concierge img {
  height: clamp(18px, 1.8vw, 24px);
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.ruby-concierge:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

/* Ruby+ Logo: starts centered & large, then scales down and glides to top aligned with Concierge */
.ruby-logo-container {
  position: absolute;
  left: 50.8%;
  z-index: 5;
  pointer-events: none;
  animation: rubyLogoShrinkToTop 2.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  will-change: transform, top, opacity;
}

.ruby-logo-container img {
  width: clamp(105px, 11vw, 160px);
  height: auto;
  display: block;
  filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.85)) 
          drop-shadow(0 0 30px rgba(255, 255, 255, 0.45));
}

@keyframes rubyLogoShrinkToTop {
  0% {
    top: 42%;
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6);
    filter: blur(6px);
  }
  25% {
    top: 42%;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.5);
    filter: blur(0);
  }
  45% {
    top: 42%;
    transform: translate(-50%, -50%) scale(1.5);
  }
  100% {
    top: calc(clamp(24px, 3.5vw, 44px) + clamp(9px, 0.9vw, 12px) + env(safe-area-inset-top, 0px));
    opacity: 1;
    transform: translate(-50%, -46%) scale(1);
    filter: blur(0);
  }
}

/* Bottom Portal CTA Button */
.ruby-cta-container {
  position: absolute;
  bottom: clamp(24px, 3.8vh, 42px);
  bottom: calc(clamp(24px, 3.8vh, 42px) + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  width: max-content;
  max-width: calc(100vw - 40px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  animation: rubyCtaFadeIn 1s cubic-bezier(0.16, 1, 0.3, 1) 2.1s forwards;
  text-align: center;
}

@keyframes rubyCtaFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.ruby-portal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 30px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 9999px;
  color: #ffffff;
  font-family: var(--ruby-font);
  font-size: clamp(12px, 0.95vw, 14px);
  font-weight: 400;
  letter-spacing: 0.03em;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1), inset 0 1px 1px rgba(255, 255, 255, 0.5);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.ruby-portal-btn:hover {
  background: rgba(255, 255, 255, 0.36);
  border-color: rgba(255, 255, 255, 0.75);
  color: #ffffff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14), inset 0 1px 2px rgba(255, 255, 255, 0.8);
  transform: translateY(-2px);
}

.ruby-portal-btn:active {
  transform: translateY(0);
}

@keyframes rubyFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================================================
   PORTAL FLY-IN DRAWER (#EFE7E2) - LUXURY LINE DESIGN
   ========================================================= */

.ruby-drawer-backdrop {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(13, 15, 18, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.ruby-drawer-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ruby-portal-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(340px, 32vw, 450px);
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  background-color: var(--ruby-bg-light);
  color: var(--ruby-dark);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  box-shadow: -15px 0 50px rgba(0, 0, 0, 0.12);
  transform: translateX(100%);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--ruby-font);
}

.ruby-portal-drawer.is-open {
  transform: translateX(0);
}

.ruby-drawer-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 24px 28px 0 28px;
}

.ruby-drawer-close {
  background: transparent;
  border: none;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ruby-dark);
  opacity: 0.6;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.ruby-drawer-close svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.5;
}

.ruby-drawer-close:hover {
  opacity: 1;
  transform: rotate(90deg);
}

.ruby-drawer-body {
  padding: 30px clamp(28px, 4vw, 44px) 50px clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Exclusive Intro Text (PT Serif) */
.ruby-exclusive-intro {
  font-family: var(--ruby-font);
  font-size: clamp(14px, 1.1vw, 15.5px);
  line-height: 1.5;
  color: #383533;
  margin: 0 0 36px 0;
  font-weight: 400;
  max-width: 340px;
}

/* Line Form Groups */
.ruby-field-group {
  border-top: 1px solid var(--ruby-line);
  margin-bottom: 32px;
}

.ruby-line-row {
  border-bottom: 1px solid var(--ruby-line);
  position: relative;
}

.ruby-line-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  padding: 13px 0;
  font-family: var(--ruby-font);
  font-size: 17px;
  color: var(--ruby-dark);
  box-sizing: border-box;
}

.ruby-line-input::placeholder {
  font-family: var(--ruby-font);
  font-size: 17px;
  color: var(--ruby-line);
  opacity: 0.9;
}

.ruby-line-input:focus {
  background: transparent;
}

/* Pill Outline Button */
.ruby-line-submit-wrap {
  margin-top: 36px;
  display: flex;
  justify-content: center;
}

.ruby-pill-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 54px;
  background: transparent;
  border: 1px solid var(--ruby-line);
  border-radius: 9999px;
  font-family: var(--ruby-font);
  font-size: 15px;
  color: var(--ruby-dark);
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
  min-width: 160px;
}

.ruby-pill-btn:hover {
  background: rgba(74, 71, 68, 0.08);
  border-color: var(--ruby-dark);
}

.ruby-pill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer Switch link */
.ruby-form-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 13px;
  color: rgba(56, 53, 51, 0.75);
  font-family: var(--ruby-font);
}

.ruby-switch-link {
  color: var(--ruby-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.ruby-switch-link:hover {
  opacity: 0.65;
}

/* Notices */
.ruby-form-notice {
  display: none;
  padding: 10px 14px;
  margin-bottom: 20px;
  border-radius: 2px;
  font-size: 13px;
  line-height: 1.4;
  font-family: var(--ruby-font);
}

.ruby-notice-error {
  background: rgba(164, 39, 24, 0.08);
  color: #8c1e11;
  border: 1px solid rgba(164, 39, 24, 0.2);
}

.ruby-notice-success {
  background: rgba(30, 102, 56, 0.08);
  color: #1a572f;
  border: 1px solid rgba(30, 102, 56, 0.2);
}

/* =========================================================
   RESPONSIVE BREAKPOINTS
   ========================================================= */

@media (max-width: 900px) {
  .ruby-bg-scene {
    object-position: 50% 68%;
  }

  .ruby-logo-container {
    left: 50%;
  }

  .ruby-logo-container img {
    width: clamp(95px, 15vw, 135px);
  }

  @keyframes rubyLogoShrinkToTop {
    0% {
      top: 40%;
      opacity: 0;
      transform: translate(-50%, -50%) scale(1.45);
      filter: blur(5px);
    }
    25% {
      top: 40%;
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.35);
      filter: blur(0);
    }
    45% {
      top: 40%;
      transform: translate(-50%, -50%) scale(1.35);
    }
    100% {
      top: calc(clamp(20px, 3.5vw, 38px) + clamp(9px, 1.2vw, 11px) + env(safe-area-inset-top, 0px));
      opacity: 1;
      transform: translate(-50%, -46%) scale(1);
      filter: blur(0);
    }
  }
}

@media (max-width: 600px) {
  .ruby-portal-drawer {
    width: 100vw;
  }
}

@media (max-width: 480px) {
  .ruby-bg-scene {
    object-position: 50% 72%;
  }

  .ruby-concierge {
    top: clamp(20px, 5vw, 32px);
    top: calc(clamp(20px, 5vw, 32px) + env(safe-area-inset-top, 0px));
    left: clamp(16px, 4vw, 24px);
    left: calc(clamp(16px, 4vw, 24px) + env(safe-area-inset-left, 0px));
  }

  .ruby-concierge img {
    height: 18px;
  }

  .ruby-logo-container img {
    width: clamp(90px, 28vw, 120px);
  }

  @keyframes rubyLogoShrinkToTop {
    0% {
      top: 38%;
      opacity: 0;
      transform: translate(-50%, -50%) scale(1.4);
      filter: blur(4px);
    }
    25% {
      top: 38%;
      opacity: 1;
      transform: translate(-50%, -50%) scale(1.3);
      filter: blur(0);
    }
    45% {
      top: 38%;
      transform: translate(-50%, -50%) scale(1.3);
    }
    100% {
      top: calc(clamp(20px, 5vw, 32px) + 9px + env(safe-area-inset-top, 0px));
      opacity: 1;
      transform: translate(-50%, -46%) scale(1);
      filter: blur(0);
    }
  }

  .ruby-portal-btn {
    padding: 10px 24px;
    font-size: 12px;
  }
}
