/* Design tokens shared by the layout, heart, button, and responsive rules. */
:root {
  --background: #f8f9fa;
  --text: #212529;
  --accent: #4f9fd6;
  --accent-hover: #d8c7ff;
  --white: #ffffff;
  --panel: rgba(16, 19, 24, 0.72);
  --panel-strong: rgba(13, 16, 20, 0.9);
  --line: rgba(255, 255, 255, 0.42);
  --muted: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

/* Baseline sizing keeps padding and borders predictable across elements. */
* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  /* Beach background plus a dark overlay keeps the foreground heart readable. */
  background:
    linear-gradient(rgba(15, 19, 24, 0.58), rgba(15, 19, 24, 0.72)),
    url("assets/beach-palms-background.png") center / cover fixed;
  color: var(--white);
  font-family: "Lato", Arial, sans-serif;
}

/* Additional color wash ties the background image to the blue/lilac UI palette. */
body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 50% 20%, rgba(79, 159, 214, 0.18), transparent 32rem),
    linear-gradient(90deg, rgba(10, 16, 26, 0.5), rgba(216, 199, 255, 0.1), rgba(10, 16, 26, 0.52));
  content: "";
}

/* Full-screen shell centers the generator both vertically and horizontally. */
.page-shell {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 3rem);
}

/* Width cap keeps the heart readable on wide screens while remaining fluid on mobile. */
.generator-shell {
  width: min(100%, 46rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Small title identifies the tool without competing with the compliment output. */
h1 {
  position: relative;
  margin: 0;
  padding-bottom: 0.65rem;
  font-size: clamp(0.95rem, 2vw, 1.3rem);
  line-height: 1.08;
  font-weight: 800;
  font-family: "Nunito", Arial, sans-serif;
  text-transform: uppercase;
}

/* Thin divider borrows the Dimension-inspired linework style. */
h1::after {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(12rem, 42vw);
  height: 1px;
  background: var(--line);
  transform: translateX(-50%);
  content: "";
}

/* Helper line includes the purpose phrase and JavaScript-generated Paris date. */
.intro-text {
  max-width: 24rem;
  margin: 0.45rem auto 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.85rem, 1.4vw, 0.95rem);
  line-height: 1.55;
}

/* Heart panel is the animated container for the generator content. */
.compliment-panel {
  position: relative;
  width: 100%;
  min-height: clamp(34rem, 62vw, 42rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 7vw, 4.5rem);
  transform-origin: 50% 48%;
}

/* Applied by JavaScript after each button click to replay the heartbeat. */
.compliment-panel.is-beating {
  animation: heartBeat 520ms ease-in-out;
}

/* Subtle beat with a tiny shake gives feedback without disrupting readability. */
@keyframes heartBeat {
  0% {
    transform: scale(1) translateX(0);
  }

  18% {
    transform: scale(1.035) translateX(-2px);
  }

  34% {
    transform: scale(0.992) translateX(2px);
  }

  52% {
    transform: scale(1.025) translateX(-1px);
  }

  72% {
    transform: scale(0.998) translateX(1px);
  }

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

/* SVG heart sits behind the content and carries the depth shadow. */
.heart-shape {
  position: absolute;
  inset: -4% -3% -2%;
  z-index: 0;
  width: 106%;
  height: 106%;
  filter:
    drop-shadow(0 26px 54px rgba(0, 0, 0, 0.45))
    drop-shadow(0 10px 18px rgba(79, 159, 214, 0.12));
  pointer-events: none;
}

/* Main heart surface, outline, and 3D-style gradient. */
.heart-base {
  fill: url("#heartFill");
  stroke: rgba(79, 159, 214, 0.82);
  stroke-width: 0.38;
}

/* Soft highlight layer gives the heart a little dimensionality. */
.heart-highlight {
  fill: url("#heartHighlight");
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 0.22;
}

/* Content safe area keeps text and button inside the heart shape. */
.panel-content {
  position: relative;
  z-index: 2;
  width: min(100%, 25.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(0.55rem, 1.6vw, 0.95rem);
  transform: translateY(-1.35rem);
}

/* Main compliment display; JavaScript swaps its text on button click. */
.compliment-text {
  position: relative;
  min-height: 8.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.15rem 0 0;
  color: var(--white);
  font-size: clamp(2rem, 4.4vw, 2.75rem);
  line-height: 1.12;
  font-weight: 800;
  font-family: "Nunito", Arial, sans-serif;
}

/* Decorative quotation marks are CSS-generated so compliment strings stay clean. */
.compliment-copy::before {
  content: "\201C";
}

/* Length-based classes are toggled by JavaScript to keep longer compliments inside the heart. */
.compliment-copy.is-long {
  font-size: 0.88em;
}

.compliment-copy.is-extra-long {
  font-size: 0.76em;
}

.compliment-copy::after {
  content: "\201D";
}

/* Primary action button for generating the next compliment. */
.compliment-button {
  position: relative;
  width: min(100%, 13rem);
  min-height: 3.15rem;
  margin-top: 0.55rem;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 8px;
  padding: 0.95rem 1.4rem;
  background: rgba(79, 159, 214, 0.92);
  color: #ffffff;
  cursor: pointer;
  font-family: "Lato", Arial, sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
  box-shadow: 0 14px 28px rgba(79, 159, 214, 0.26);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

/* Hover feedback is limited to pointer devices so touch taps do not leave a sticky hover color. */
@media (hover: hover) and (pointer: fine) {
  .compliment-button:hover {
    background: var(--accent-hover);
    color: var(--text);
    border-color: rgba(216, 199, 255, 0.82);
    box-shadow: 0 16px 32px rgba(216, 199, 255, 0.22);
    transform: translateY(-2px);
  }
}

.compliment-button:focus-visible {
  outline: 3px solid rgba(216, 199, 255, 0.78);
  outline-offset: 4px;
}

.compliment-button:active {
  transform: translateY(0);
}

/* Respect users who prefer reduced motion by disabling the heartbeat animation. */
@media (prefers-reduced-motion: reduce) {
  .compliment-panel.is-beating {
    animation: none;
  }

  .compliment-button {
    transition: none;
  }
}

/* Mobile layout keeps the content in the safe center of the narrowing heart shape. */
@media (max-width: 520px) {
  body {
    background-attachment: scroll;
  }

  .page-shell {
    align-items: center;
    padding: 1rem;
  }

  .compliment-panel {
    min-height: min(35rem, calc(100svh - 2rem));
    padding: 1.5rem 1rem;
  }

  .panel-content {
    width: min(100%, 15.75rem);
    gap: 0.55rem;
    transform: translateY(-1.25rem);
  }

  h1 {
    font-size: 1rem;
    padding-bottom: 0.55rem;
  }

  .intro-text {
    font-size: 0.85rem;
  }

  .compliment-text {
    min-height: 8.75rem;
    font-size: clamp(1.45rem, 6vw, 1.75rem);
  }

  .compliment-button {
    width: min(100%, 11rem);
    min-height: 2.8rem;
    font-size: 0.76rem;
  }
}

/* Extra-small mobile tuning for older/narrow phones. */
@media (max-width: 374px) {
  .panel-content {
    width: min(100%, 14rem);
    transform: translateY(-1.45rem);
  }

  .compliment-text {
    min-height: 8rem;
    font-size: clamp(1.18rem, 5.4vw, 1.36rem);
  }

  .compliment-button {
    width: 9rem;
    min-height: 2.5rem;
    margin-top: 0.15rem;
    padding: 0.8rem 1rem;
    font-size: 0.68rem;
  }
}

/* Narrowest supported layout keeps all current compliments readable at 320px wide. */
@media (max-width: 340px) {
  .panel-content {
    width: min(100%, 13rem);
    transform: translateY(-1.55rem);
  }

  .compliment-text {
    min-height: 7.75rem;
    font-size: 1.08rem;
  }
}
