/* =========================================================
   CAFFÈ ROSSO LOYALTY
   Premium animated café experience
   ========================================================= */

:root {
  --cream: #f8f1e7;
  --cream-light: #fffaf3;
  --brown: #3b2418;
  --brown-soft: #684535;
  --red: #9f2f24;
  --red-dark: #762019;
  --gold: #c79245;
  --gold-light: #e4bc76;
  --green: #3f6b4d;
  --text: #2d211b;
  --muted: #806f64;
  --white: rgba(255, 252, 247, 0.94);

  --shadow:
    0 25px 70px rgba(43, 25, 14, 0.25),
    0 8px 25px rgba(43, 25, 14, 0.12);

  --soft-shadow:
    0 12px 35px rgba(43, 25, 14, 0.15);

  --radius: 26px;
}


/* =========================================================
   RESET
   ========================================================= */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;

  font-family:
    "Work Sans",
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  color: var(--text);

  background:
    #24150f;

  overflow-x: hidden;
}


/* =========================================================
   ANIMATED CAFÉ BACKGROUND
   ========================================================= */

.bgLayer {
  position: fixed;
  inset: 0;

  z-index: 0;

  overflow: hidden;

  background:
    linear-gradient(
      135deg,
      rgba(35, 20, 13, 0.78),
      rgba(93, 35, 25, 0.45),
      rgba(30, 19, 13, 0.78)
    );

  pointer-events: none;
}


/* Actual café photograph */

.bgLayer::before {
  content: "";

  position: absolute;
  inset: -8%;

  background-image:
    linear-gradient(
      rgba(35, 20, 13, 0.38),
      rgba(35, 20, 13, 0.55)
    ),
    url("/cafe-bg.jpg");

  background-size: cover;
  background-position: center center;

  filter:
    saturate(0.9)
    contrast(0.95)
    brightness(0.78);

  transform: scale(1.04);

  animation:
    cafeBackground 22s ease-in-out infinite alternate;
}


/* Moving warm atmospheric layer */

.bgLayer::after {
  content: "";

  position: absolute;
  inset: -20%;

  background:
    radial-gradient(
      circle at 20% 30%,
      rgba(231, 166, 76, 0.25),
      transparent 28%
    ),
    radial-gradient(
      circle at 80% 25%,
      rgba(159, 47, 36, 0.22),
      transparent 30%
    ),
    radial-gradient(
      circle at 50% 85%,
      rgba(208, 139, 65, 0.18),
      transparent 30%
    );

  mix-blend-mode: screen;

  animation:
    atmosphereMove 16s ease-in-out infinite alternate;
}


/* =========================================================
   FLOATING LIGHT BLOBS
   ========================================================= */

.bgBlob {
  position: absolute;

  width: 420px;
  height: 420px;

  border-radius: 50%;

  filter: blur(65px);

  opacity: 0.34;

  will-change: transform;

  mix-blend-mode: screen;
}


.bgBlob1 {
  top: -170px;
  left: -120px;

  background:
    radial-gradient(
      circle,
      rgba(224, 164, 79, 0.65),
      rgba(224, 164, 79, 0)
    );

  animation:
    blobOne 14s ease-in-out infinite alternate;
}


.bgBlob2 {
  top: 25%;
  right: -190px;

  background:
    radial-gradient(
      circle,
      rgba(159, 47, 36, 0.62),
      rgba(159, 47, 36, 0)
    );

  animation:
    blobTwo 18s ease-in-out infinite alternate;
}


.bgBlob3 {
  bottom: -190px;
  left: 25%;

  background:
    radial-gradient(
      circle,
      rgba(231, 184, 104, 0.45),
      rgba(231, 184, 104, 0)
    );

  animation:
    blobThree 20s ease-in-out infinite alternate;
}


/* =========================================================
   FLOATING PARTICLE EFFECT
   ========================================================= */

.bgLayer .bgBlob1::after,
.bgLayer .bgBlob2::after,
.bgLayer .bgBlob3::after {
  content: "";

  position: absolute;

  width: 10px;
  height: 10px;

  border-radius: 50%;

  background: rgba(255, 220, 157, 0.55);

  box-shadow:
    120px 80px 0 rgba(255, 220, 157, 0.3),
    260px 180px 0 rgba(255, 220, 157, 0.22),
    70px 290px 0 rgba(255, 220, 157, 0.25),
    330px 90px 0 rgba(255, 220, 157, 0.2);

  animation:
    particles 9s ease-in-out infinite alternate;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

.container {
  position: relative;

  z-index: 2;

  width: min(100% - 32px, 540px);

  margin:
    0 auto;

  padding:
    48px 0 70px;
}


/* =========================================================
   BRAND
   ========================================================= */

.brand {
  display: flex;

  align-items: center;
  justify-content: center;

  gap: 10px;

  margin-bottom: 20px;

  color: #fff8ef;

  font-family:
    "Fraunces",
    Georgia,
    serif;

  font-size: 20px;
  font-weight: 600;

  letter-spacing: 0.02em;

  text-shadow:
    0 3px 20px rgba(0, 0, 0, 0.35);

  animation:
    brandReveal 1s ease both;
}


.brandIcon {
  width: 40px;
  height: 40px;

  overflow: visible;
}


.steam {
  fill: none;

  stroke: #f6d49c;

  stroke-width: 2;

  stroke-linecap: round;

  opacity: 0.75;
}


.steam1 {
  animation:
    steamFloat 3.1s ease-in-out infinite;
}


.steam2 {
  animation:
    steamFloat 3.1s ease-in-out 0.7s infinite;
}


.steam3 {
  animation:
    steamFloat 3.1s ease-in-out 1.4s infinite;
}


.cupBody {
  fill: rgba(255, 248, 236, 0.94);
}


.cupHandle {
  fill: none;

  stroke: rgba(255, 248, 236, 0.94);

  stroke-width: 2;
}


.cupSaucer {
  fill: rgba(255, 248, 236, 0.94);
}


/* =========================================================
   HEADING
   ========================================================= */

h1,
h2,
h3 {
  font-family:
    "Fraunces",
    Georgia,
    serif;

  color: var(--brown);

  margin-top: 0;
}


h1 {
  margin-bottom: 7px;

  color: #fff8ef;

  text-align: center;

  font-size:
    clamp(36px, 8vw, 52px);

  line-height: 1.05;

  letter-spacing: -0.035em;

  text-shadow:
    0 5px 30px rgba(0, 0, 0, 0.35);

  animation:
    headingReveal 1s ease 0.15s both;
}


h2 {
  font-size: 26px;

  margin-bottom: 8px;
}


h3 {
  font-size: 21px;

  margin-bottom: 8px;
}


.muted {
  color: var(--muted);

  line-height: 1.6;
}


.container > .muted {
  margin:
    0 auto 28px;

  color: rgba(255, 248, 239, 0.78);

  text-align: center;

  animation:
    fadeUp 1s ease 0.3s both;
}


/* =========================================================
   PANELS
   ========================================================= */

.panel {
  position: relative;

  overflow: hidden;

  background:
    linear-gradient(
      145deg,
      rgba(255, 251, 245, 0.96),
      rgba(249, 239, 226, 0.91)
    );

  border:
    1px solid rgba(255, 255, 255, 0.62);

  border-radius:
    var(--radius);

  box-shadow:
    var(--shadow);

  backdrop-filter:
    blur(22px);

  -webkit-backdrop-filter:
    blur(22px);

  animation:
    panelReveal 0.9s cubic-bezier(.22, 1, .36, 1) both;
}


/* Moving light across cards */

.panel::before {
  content: "";

  position: absolute;

  top: -120%;
  left: -45%;

  width: 55%;
  height: 320%;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.3),
      transparent
    );

  transform:
    rotate(20deg)
    translateX(-100%);

  pointer-events: none;

  animation:
    cardShine 9s ease-in-out infinite;
}


.cardSection {
  padding: 30px;
}


.existingMember {
  padding:
    0 30px 30px;
}


.divider {
  display: flex;

  align-items: center;

  gap: 12px;

  margin:
    4px 0 24px;

  color: #a08e82;

  font-size: 12px;

  text-transform: uppercase;

  letter-spacing: 0.08em;
}


.divider::before,
.divider::after {
  content: "";

  height: 1px;

  flex: 1;

  background:
    rgba(107, 76, 58, 0.16);
}


/* =========================================================
   FORMS
   ========================================================= */

form {
  display: flex;

  flex-direction: column;

  gap: 17px;
}


label {
  display: flex;

  flex-direction: column;

  gap: 8px;

  color: var(--brown);

  font-size: 14px;

  font-weight: 600;
}


input {
  width: 100%;

  min-height: 52px;

  padding:
    0 16px;

  border:
    1px solid rgba(101, 72, 54, 0.18);

  border-radius: 15px;

  background:
    rgba(255, 255, 255, 0.72);

  color: var(--text);

  font:
    inherit;

  outline: none;

  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}


input::placeholder {
  color: #ad9b8e;
}


input:focus {
  border-color:
    rgba(159, 47, 36, 0.65);

  background:
    rgba(255, 255, 255, 0.92);

  box-shadow:
    0 0 0 4px rgba(159, 47, 36, 0.1);

  transform:
    translateY(-1px);
}


/* =========================================================
   BUTTONS
   ========================================================= */

button {
  position: relative;

  min-height: 53px;

  padding:
    0 22px;

  border: 0;

  border-radius: 15px;

  background:
    linear-gradient(
      135deg,
      var(--red),
      var(--red-dark)
    );

  color: white;

  font:
    inherit;

  font-weight: 700;

  cursor: pointer;

  overflow: hidden;

  box-shadow:
    0 10px 24px rgba(118, 32, 25, 0.24);

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}


button::after {
  content: "";

  position: absolute;

  top: 0;
  left: -100%;

  width: 70%;
  height: 100%;

  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(255, 255, 255, 0.25),
      transparent
    );

  transform:
    skewX(-20deg);

  transition:
    left 0.5s ease;
}


button:hover::after {
  left: 140%;
}


button:hover {
  transform:
    translateY(-2px);

  box-shadow:
    0 15px 30px rgba(118, 32, 25, 0.3);

  filter:
    brightness(1.04);
}


button:active {
  transform:
    translateY(0);
}


button:disabled {
  opacity: 0.55;

  cursor: wait;

  transform: none;

  box-shadow: none;
}


.secondaryButton {
  background:
    rgba(255, 255, 255, 0.5);

  color:
    var(--brown);

  border:
    1px solid rgba(101, 72, 54, 0.18);

  box-shadow:
    none;
}


.secondaryButton:hover {
  background:
    rgba(255, 255, 255, 0.78);

  box-shadow:
    0 8px 20px rgba(43, 25, 14, 0.1);
}


/* =========================================================
   LOYALTY CARD
   ========================================================= */

#loyaltyCard {
  padding:
    30px;

  animation:
    loyaltyCardReveal 0.9s cubic-bezier(.22, 1, .36, 1) both;
}


.welcome {
  margin:
    0 0 18px;

  text-align: center;

  color:
    var(--muted);
}


.welcome strong {
  color:
    var(--brown);

  font-family:
    "Fraunces",
    Georgia,
    serif;

  font-size: 24px;
}


/* =========================================================
   PROGRESS RING
   ========================================================= */

.progressWrap {
  position: relative;

  display: grid;

  place-items: center;

  width: 230px;
  height: 230px;

  margin:
    8px auto 16px;
}


.progressRing {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  transform:
    rotate(-90deg);
}


.progressRingBg {
  fill: none;

  stroke:
    rgba(101, 72, 54, 0.11);

  stroke-width: 9;
}


.progressRingFill {
  fill: none;

  stroke:
    url("#none");

  stroke:
    var(--red);

  stroke-width: 9;

  stroke-linecap: round;

  stroke-dasharray:
    483.8;

  stroke-dashoffset:
    483.8;

  transition:
    stroke-dashoffset 1.2s cubic-bezier(.22, 1, .36, 1);

  filter:
    drop-shadow(
      0 4px 7px rgba(159, 47, 36, 0.22)
    );
}


.stampCircle {
  position: relative;

  display: flex;

  align-items: baseline;

  justify-content: center;

  width: 175px;
  height: 175px;

  border-radius: 50%;

  background:
    radial-gradient(
      circle at 35% 25%,
      #fffdf8,
      #f2dfca
    );

  box-shadow:
    inset 0 2px 12px rgba(255, 255, 255, 0.8),
    0 15px 35px rgba(76, 43, 27, 0.15);

  animation:
    stampPulse 5s ease-in-out infinite;
}


.stampCircle span {
  align-self: center;

  margin-top: 3px;

  color:
    var(--brown);

  font-family:
    "Fraunces",
    Georgia,
    serif;

  font-size: 64px;

  font-weight: 700;

  line-height: 1;
}


.stampCircle small {
  align-self: center;

  margin-left: 4px;

  color:
    var(--muted);

  font-size: 17px;
}


.stampMessage {
  margin:
    0 0 26px;

  color:
    var(--muted);

  text-align: center;

  font-size: 14px;
}


/* =========================================================
   STAMP BOX
   ========================================================= */

.stampBox,
.redeemBox {
  position: relative;

  margin-top: 20px;

  padding: 23px;

  border-radius: 20px;

  background:
    rgba(255, 255, 255, 0.52);

  border:
    1px solid rgba(101, 72, 54, 0.1);

  box-shadow:
    0 8px 25px rgba(52, 31, 20, 0.07);
}


.stampBox h2,
.redeemBox h2 {
  font-size: 21px;
}


.stampBox .muted,
.redeemBox .muted {
  margin-top: -3px;

  font-size: 13px;
}


/* =========================================================
   REWARD
   ========================================================= */

.reward {
  position: relative;

  margin-top: 20px;

  padding: 21px;

  border-radius: 19px;

  color: #fff;

  background:
    linear-gradient(
      135deg,
      #6c8f61,
      #3f6b4d
    );

  box-shadow:
    0 15px 30px rgba(63, 107, 77, 0.22);

  text-align: center;

  animation:
    rewardAppear 0.75s cubic-bezier(.22, 1, .36, 1) both;
}


.reward::before {
  content: "✦";

  position: absolute;

  top: 10px;
  left: 17px;

  opacity: 0.55;

  animation:
    sparkle 2s ease-in-out infinite;
}


.reward::after {
  content: "✦";

  position: absolute;

  right: 17px;
  bottom: 10px;

  opacity: 0.55;

  animation:
    sparkle 2s ease-in-out 0.7s infinite;
}


.reward strong {
  font-size: 20px;
}


.reward span {
  opacity: 0.9;

  font-size: 13px;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.error {
  min-height: 20px;

  margin:
    8px 0 0;

  color:
    #a42b22;

  font-size: 13px;
}


.success {
  min-height: 20px;

  margin:
    8px 0 0;

  color:
    var(--green);

  font-size: 13px;

  font-weight: 600;
}


/* =========================================================
   CHANGE USER
   ========================================================= */

#changeUserButton {
  width: 100%;

  margin-top: 24px;
}


#changeUserCard {
  padding: 30px;
}


#cancelChangeUserButton {
  display: block;
  width: min(100%, 260px);
  margin: 12px auto 0;
}


/* =========================================================
   FOOTER TEXT
   ========================================================= */

.tiny {
  margin:
    20px 0 0;

  color:
    rgba(45, 33, 27, 0.48);

  text-align: center;

  font-size: 11px;
}


/* =========================================================
   HIDDEN
   ========================================================= */

.hidden {
  display: none !important;
}


/* =========================================================
   KEYFRAMES
   ========================================================= */

@keyframes cafeBackground {
  0% {
    transform:
      scale(1.04)
      translate3d(-1%, -1%, 0);
  }

  50% {
    transform:
      scale(1.08)
      translate3d(1%, 0.5%, 0);
  }

  100% {
    transform:
      scale(1.05)
      translate3d(-0.5%, 1%, 0);
  }
}


@keyframes atmosphereMove {
  0% {
    transform:
      translate3d(-4%, -2%, 0)
      scale(1);
  }

  50% {
    transform:
      translate3d(3%, 2%, 0)
      scale(1.08);
  }

  100% {
    transform:
      translate3d(-2%, 4%, 0)
      scale(1.03);
  }
}


@keyframes blobOne {
  0% {
    transform:
      translate3d(0, 0, 0)
      scale(1);
  }

  50% {
    transform:
      translate3d(130px, 80px, 0)
      scale(1.25);
  }

  100% {
    transform:
      translate3d(40px, 180px, 0)
      scale(0.9);
  }
}


@keyframes blobTwo {
  0% {
    transform:
      translate3d(0, 0, 0)
      scale(0.95);
  }

  50% {
    transform:
      translate3d(-140px, 100px, 0)
      scale(1.2);
  }

  100% {
    transform:
      translate3d(-60px, -90px, 0)
      scale(0.88);
  }
}


@keyframes blobThree {
  0% {
    transform:
      translate3d(0, 0, 0)
      scale(1);
  }

  50% {
    transform:
      translate3d(120px, -100px, 0)
      scale(1.22);
  }

  100% {
    transform:
      translate3d(-100px, -40px, 0)
      scale(0.9);
  }
}


@keyframes particles {
  0% {
    transform:
      translate3d(-15px, 15px, 0)
      scale(0.8);

    opacity: 0.25;
  }

  50% {
    transform:
      translate3d(20px, -35px, 0)
      scale(1.1);

    opacity: 0.55;
  }

  100% {
    transform:
      translate3d(-5px, -70px, 0)
      scale(0.7);

    opacity: 0.15;
  }
}


@keyframes steamFloat {
  0% {
    opacity: 0.25;

    transform:
      translateY(5px)
      scaleY(0.9);
  }

  50% {
    opacity: 0.9;

    transform:
      translateY(-3px)
      scaleY(1.08);
  }

  100% {
    opacity: 0.2;

    transform:
      translateY(-9px)
      scaleY(0.9);
  }
}


@keyframes brandReveal {
  from {
    opacity: 0;

    transform:
      translateY(-15px);
  }

  to {
    opacity: 1;

    transform:
      translateY(0);
  }
}


@keyframes headingReveal {
  from {
    opacity: 0;

    transform:
      translateY(15px)
      scale(0.98);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }
}


@keyframes fadeUp {
  from {
    opacity: 0;

    transform:
      translateY(12px);
  }

  to {
    opacity: 1;

    transform:
      translateY(0);
  }
}


@keyframes panelReveal {
  from {
    opacity: 0;

    transform:
      translateY(30px)
      scale(0.97);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }
}


@keyframes loyaltyCardReveal {
  from {
    opacity: 0;

    transform:
      translateY(25px)
      scale(0.96);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }
}


@keyframes cardShine {
  0%,
  60% {
    transform:
      rotate(20deg)
      translateX(-140%);
  }

  80%,
  100% {
    transform:
      rotate(20deg)
      translateX(260%);
  }
}


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

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


@keyframes rewardAppear {
  from {
    opacity: 0;

    transform:
      translateY(20px)
      scale(0.94);
  }

  70% {
    transform:
      translateY(-3px)
      scale(1.015);
  }

  to {
    opacity: 1;

    transform:
      translateY(0)
      scale(1);
  }
}


@keyframes sparkle {
  0%,
  100% {
    transform:
      scale(0.7)
      rotate(0deg);

    opacity: 0.35;
  }

  50% {
    transform:
      scale(1.25)
      rotate(180deg);

    opacity: 0.9;
  }
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 600px) {

  .container {
    width:
      min(100% - 20px, 540px);

    padding:
      30px 0 50px;
  }


  .brand {
    font-size: 18px;
  }


  h1 {
    font-size: 37px;
  }


  .cardSection,
  .existingMember,
  #loyaltyCard,
  #changeUserCard {
    padding-left: 22px;
    padding-right: 22px;
  }


  .progressWrap {
    width: 210px;
    height: 210px;
  }


  .stampCircle {
    width: 160px;
    height: 160px;
  }


  .stampCircle span {
    font-size: 56px;
  }


  .bgBlob {
    width: 300px;
    height: 300px;

    filter: blur(50px);
  }


  .panel {
    border-radius: 22px;
  }
}


/* =========================================================
   ACCESSIBILITY
   ========================================================= */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .bgLayer::before {
    transform: scale(1.04);
  }

  .bgLayer::after {
    transform: none;
  }

  .bgBlob {
    transform: none;
  }
}

/* =========================================================
   PHONE NUMBER COUNTRY CODE INPUTS
   ========================================================= */

.phoneInputGroup {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
}

.phoneCountryCode {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 10px;
  border: 1px solid rgba(101, 72, 54, 0.18);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  font: inherit;
  outline: none;
}

.phoneCountryCode:focus {
  border-color: rgba(159, 47, 36, 0.65);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(159, 47, 36, 0.1);
}

.phoneInputGroup input {
  min-width: 0;
}

.phoneHelp {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

/* Create New Card sits beneath the page's content panels. */
.createNewCardButton {
  display: block;
  width: min(100%, 280px);
  margin: 24px auto 0;
}

@media (max-width: 380px) {
  .phoneInputGroup {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 8px;
  }

  .phoneCountryCode {
    padding: 0 7px;
    font-size: 14px;
  }
}
