:root {
  --bg: #f6b6cf;
  --bloom: #f39abb;
  --fall: #e879a6;
  --ink: #352a2e;
  --muted: #7d5565;
  --note: #6a3b4c;
  --line: rgba(53, 42, 46, 0.28);
  --rose: #cf5a83;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --sans: "Jost", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(1100px 720px at 50% 112%, color-mix(in srgb, var(--bg), #c94277 30%), transparent 62%),
    radial-gradient(760px 420px at 50% 0%, color-mix(in srgb, var(--bg), white 55%), transparent 70%),
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--bg), white 26%) 0%,
      color-mix(in srgb, var(--bg), white 8%) 28%,
      var(--bg) 62%,
      color-mix(in srgb, var(--bg), #b83a6b 12%) 100%
    );
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ince kağıt dokusu */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.stage {
  position: relative;
  isolation: isolate;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: clamp(18px, 3.2vh, 34px) clamp(18px, 4vw, 56px);
  overflow: hidden;
}

/* çiçeğin arkasındaki yumuşak ışık */
.ambient {
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(130vw, 1100px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    circle,
    rgba(255, 248, 251, 0.8) 0%,
    rgba(255, 240, 246, 0.3) 36%,
    rgba(255, 240, 246, 0) 68%
  );
  filter: blur(10px);
}

/* ---------- çiçek tarlası ---------- */

.field {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.bokeh {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bokeh span {
  position: absolute;
  left: var(--bx);
  top: var(--by);
  width: var(--bs);
  height: var(--bs);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: var(--bo, 0.4);
  filter: blur(2px);
  background: radial-gradient(
    circle,
    rgba(255, 246, 250, 0.9) 0%,
    rgba(255, 240, 246, 0.35) 55%,
    rgba(255, 240, 246, 0) 72%
  );
}

.field-flower {
  position: absolute;
  z-index: 1;
  transform-origin: 50% 100%;
  pointer-events: auto;
  touch-action: none;
  animation: fieldIn 1.2s ease var(--in, 0.6s) backwards;
  will-change: transform;
}

.field-flower.is-falling {
  animation: fieldFall 1.6s cubic-bezier(0.45, 0, 0.8, 0.5) forwards;
}

.ff-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 100%;
  transition: transform 0.85s cubic-bezier(0.2, 1.22, 0.35, 1);
  cursor: grab;
  touch-action: none;
}

.field-flower.is-dragging .ff-svg {
  transition: none;
  cursor: grabbing;
}

.ff-stem {
  fill: none;
  stroke: #4d8763;
  stroke-width: 5;
  stroke-linecap: round;
}

.ff-leaf {
  fill: #4f8a5f;
}

.ff-petal {
  fill: color-mix(in srgb, var(--bloom), white 18%);
}

.field-flower[data-layer="far"] .ff-petal {
  fill: color-mix(in srgb, var(--bloom), white 42%);
}

.field-flower[data-layer="mid"] .ff-petal {
  fill: color-mix(in srgb, var(--bloom), white 22%);
}

.field-flower[data-layer="front"] .ff-petal {
  fill: color-mix(in srgb, var(--bloom), white 10%);
}

.ff-petals--in .ff-petal {
  fill: color-mix(in srgb, var(--bloom), white 55%);
}

.ff-core {
  fill: #f6c75f;
}

.ff-head {
  transform-box: fill-box;
  transform-origin: center;
}

body.growing .ff-head {
  animation: headIn 1.15s cubic-bezier(0.24, 0.9, 0.3, 1.05) var(--bd, 1.2s) backwards;
}

@keyframes fieldIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
}

@keyframes headIn {
  from {
    opacity: 0;
    transform: scale(0.05);
  }
  60% { opacity: 1; }
}

@keyframes fieldFall {
  to {
    transform: translateY(120vh) rotate(24deg);
    opacity: 0;
  }
}

/* ---------- üst başlık ---------- */

.brand {
  position: relative;
  z-index: 4;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  animation: rise 0.9s ease 0.15s backwards;
}

.brand__name {
  font-size: clamp(12px, 1.2vw, 14px);
  font-weight: 500;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  padding-left: 0.42em;
}

.brand__line {
  width: clamp(24px, 4vw, 48px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.brand__sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* ---------- çiçek ---------- */

.flower-wrap {
  position: relative;
  z-index: 3;
  pointer-events: none;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(4px, 1.5vh, 18px) 0;
  animation: fade 1.6s ease 0.1s backwards;
}

.flower-stage {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
}

/* sürükleyerek eğdiğimiz katman */
.flower-tilt {
  pointer-events: auto;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transform-origin: 50% 100%;
  transition: transform 1.6s cubic-bezier(0.2, 1.12, 0.3, 1);
  will-change: transform;
  touch-action: none;
  cursor: grab;
}

.flower-tilt.is-dragging {
  transition: none;
  cursor: grabbing;
}

/* çiçek eğilse de yerinde kalan toprak gölgesi */
.ground-shadow {
  position: absolute;
  left: 50%;
  bottom: 0.8%;
  width: 49%;
  height: 3.2%;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(74, 51, 39, 0.18),
    rgba(74, 51, 39, 0.07) 58%,
    transparent 100%
  );
  filter: blur(2.5px);
  pointer-events: none;
}

.flower {
  height: min(66svh, 660px);
  max-height: 100%;
  width: auto;
  max-width: 92vw;
  overflow: visible;
  transform-origin: 50% 100%;
}

/* gövde ve dallar */
.stem,
.branch {
  fill: none;
  stroke: url(#stemGrad);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.stem {
  stroke-width: 9;
}

.branch {
  stroke-width: 5.5;
}

/* yapraklar */
.leaf {
  transform-box: view-box;
  transform-origin: 0 0;
  transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(var(--s));
}

/* taç yapraklar */
.petal {
  transform-box: view-box;
  transform-origin: 300px 312px;
  transform: rotate(var(--a)) scale(1);
}

.core {
  transform-box: view-box;
  transform-origin: 300px 312px;
  transform: scale(1);
}

.receptacle {
  transform-box: view-box;
  transform-origin: 300px 332px;
  transform: scale(1);
}

/* dallardaki küçük pembe çiçekler */
.blossom {
  transform-box: fill-box;
  transform-origin: center;
}

/* ayarlardan seçilebilen çiçek rengi */
#petalGrad stop:nth-child(1) {
  stop-color: color-mix(in srgb, var(--bloom), white 55%);
}
#petalGrad stop:nth-child(2) {
  stop-color: color-mix(in srgb, var(--bloom), white 15%);
}
#petalGrad stop:nth-child(3) {
  stop-color: color-mix(in srgb, var(--bloom), black 4%);
}
#innerGrad stop:nth-child(1) {
  stop-color: color-mix(in srgb, var(--bloom), white 80%);
}
#innerGrad stop:nth-child(2) {
  stop-color: color-mix(in srgb, var(--bloom), white 45%);
}
#innerGrad stop:nth-child(3) {
  stop-color: color-mix(in srgb, var(--bloom), white 15%);
}

.blossom-petals {
  fill: color-mix(in srgb, var(--bloom), white 22%);
}

/* ---------- büyüme zaman çizelgesi ---------- */

body.growing .stem {
  animation: draw 5s cubic-bezier(0.5, 0.08, 0.35, 1) backwards;
}

body.growing .branch {
  animation: draw 1.6s cubic-bezier(0.4, 0.1, 0.4, 1) var(--d, 0s) backwards;
}

body.growing .leaf {
  animation: leafIn 1.1s cubic-bezier(0.34, 0.7, 0.3, 1) var(--d, 0s) backwards;
}

body.growing .petal {
  animation: bloom 1.5s cubic-bezier(0.22, 0.9, 0.32, 1.04) var(--d, 0s) backwards;
}

body.growing .core,
body.growing .receptacle {
  animation: coreIn 0.9s cubic-bezier(0.3, 0.7, 0.3, 1) var(--d, 0s) backwards;
}

body.growing .blossom {
  animation: blossomIn 1s cubic-bezier(0.24, 0.9, 0.3, 1.05) var(--d, 5s) backwards;
}

/* büyüdükten sonra hafif salınım */
body.growing .flower {
  animation: sway 10s ease-in-out 8.5s infinite alternate;
}

@keyframes draw {
  from { stroke-dashoffset: 100; }
  to   { stroke-dashoffset: 0; }
}

@keyframes leafIn {
  from {
    opacity: 0;
    transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(0);
  }
}

@keyframes bloom {
  from {
    opacity: 0;
    transform: rotate(var(--a)) scale(0.04);
  }
  55% { opacity: 1; }
}

@keyframes coreIn {
  from {
    opacity: 0;
    transform: scale(0.2);
  }
}

@keyframes blossomIn {
  from {
    opacity: 0;
    transform: scale(0.04);
  }
  60% { opacity: 1; }
}

@keyframes sway {
  from { transform: rotate(-0.55deg); }
  to   { transform: rotate(0.75deg); }
}

/* ---------- düşen yapraklar ---------- */

.petals {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.petals span {
  position: absolute;
  top: -12vh;
  left: var(--l);
  width: var(--w);
  height: calc(var(--w) * 1.7);
  border-radius: 60% 0 60% 60% / 60% 0 60% 60%;
  background: linear-gradient(160deg, color-mix(in srgb, var(--fall), white 35%), var(--fall));
  opacity: 0;
  animation: fall var(--dur) linear var(--delay) infinite;
}

@keyframes fall {
  0% {
    transform: translate3d(0, -12vh, 0) rotate(0deg);
    opacity: 0;
  }
  8% { opacity: 0.9; }
  85% { opacity: 0.55; }
  100% {
    transform: translate3d(var(--drift), 112vh, 0) rotate(620deg);
    opacity: 0;
  }
}

/* ---------- alt metin ---------- */

.caption {
  position: relative;
  z-index: 4;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 18px);
  padding-bottom: clamp(2px, 1.2vh, 14px);
  animation: rise 1s ease 1s backwards;
}

.caption__line {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(23px, 3.2vw, 38px);
  line-height: 1.25;
  letter-spacing: 0.005em;
  text-align: center;
}

.caption__line em {
  font-style: italic;
  color: var(--rose);
}

.caption__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.caption__note {
  margin: 0;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--note);
}

.replay {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 22px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  pointer-events: auto;
  cursor: pointer;
  transition: color 0.35s ease, border-color 0.35s ease, background 0.35s ease, transform 0.15s ease;
}

.replay svg {
  transition: transform 0.6s cubic-bezier(0.3, 0.7, 0.3, 1);
}

.replay:hover {
  color: var(--rose);
  border-color: rgba(215, 107, 147, 0.55);
  background: rgba(215, 107, 147, 0.08);
}

.replay:hover svg {
  transform: rotate(-180deg);
}

.replay:active {
  transform: scale(0.97);
}

.replay:focus-visible {
  outline: 2px solid var(--rose);
  outline-offset: 4px;
}

.replay--icon {
  width: 38px;
  height: 38px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

/* müzik düğmesi */
.replay--music {
  position: relative;
}

.replay--music:hover svg {
  transform: none;
}

.replay--music.is-off {
  opacity: 0.72;
  border-style: dashed;
}

.replay--music.is-playing::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 999px;
  border: 1px solid rgba(207, 90, 131, 0.5);
  animation: musicPulse 2.6s ease-out infinite;
  pointer-events: none;
}

@keyframes musicPulse {
  0% {
    transform: scale(0.92);
    opacity: 0.65;
  }
  70% {
    transform: scale(1.14);
    opacity: 0;
  }
  100% {
    transform: scale(1.14);
    opacity: 0;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes fade {
  from { opacity: 0; }
}

/* ---------- ayarlar menüsü ---------- */

.settings-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  background: rgba(70, 35, 50, 0.28);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.settings-backdrop.is-open {
  opacity: 1;
  pointer-events: auto;
}

.settings {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  width: min(360px, 90vw);
  display: flex;
  flex-direction: column;
  padding: clamp(22px, 3.4vh, 34px);
  color: #3a2a31;
  background: linear-gradient(180deg, rgba(255, 251, 253, 0.97), rgba(255, 241, 247, 0.97));
  border-left: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: -24px 0 70px rgba(80, 30, 55, 0.2);
  transform: translateX(104%);
  transition: transform 0.55s cubic-bezier(0.22, 0.9, 0.3, 1);
  overflow-y: auto;
}

.settings.is-open {
  transform: none;
}

.settings__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.settings__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.settings__close {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  color: #6a3b4c;
  background: transparent;
  border: 1px solid rgba(58, 42, 49, 0.16);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease;
}

.settings__close:hover {
  background: rgba(207, 90, 131, 0.12);
  color: #a8446a;
}

.setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid rgba(58, 42, 49, 0.1);
  cursor: pointer;
}

.setting--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  cursor: default;
}

.setting__label {
  font-size: 13px;
  letter-spacing: 0.03em;
  color: #5b3c49;
}

.setting__label b {
  margin-left: 4px;
  font-weight: 600;
  color: #b34670;
  font-variant-numeric: tabular-nums;
}

.setting__color {
  width: 48px;
  height: 32px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  flex: 0 0 auto;
}

.setting__color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.setting__color::-webkit-color-swatch {
  border: 1px solid rgba(58, 42, 49, 0.18);
  border-radius: 9px;
}

.setting__color::-moz-color-swatch {
  border: 1px solid rgba(58, 42, 49, 0.18);
  border-radius: 9px;
}

.setting__range {
  width: 100%;
  height: 22px;
  accent-color: #cf5a83;
  cursor: pointer;
}

.settings__reset {
  align-self: flex-start;
  margin-top: 24px;
  padding: 11px 20px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #a8446a;
  background: transparent;
  border: 1px solid rgba(168, 68, 106, 0.4);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.settings__reset:hover {
  background: rgba(207, 90, 131, 0.1);
  border-color: rgba(168, 68, 106, 0.65);
}

@media (prefers-reduced-motion: reduce) {
  .settings,
  .settings-backdrop {
    transition: none;
  }
}

/* ---------- küçük ekranlar ---------- */

@media (max-height: 640px) {
  .flower { height: 54svh; }
  .caption__line { font-size: 22px; }
  .brand__sub { display: none; }
}

@media (max-width: 720px) {
  .field-flower[data-layer="mid"],
  .field-flower[data-layer="front"] {
    display: none;
  }
}

@media (max-width: 520px) {
  .brand {
    flex-direction: column;
    gap: 5px;
  }
  .brand__line { display: none; }
  .flower { height: 62svh; }
  .caption__actions { gap: 8px; }
  .replay--icon { width: 36px; height: 36px; }
  .caption__note { letter-spacing: 0.26em; }
}

/* ---------- hareket azaltma ---------- */

@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }

  .replay--music.is-playing::after { animation: none; }

  body.growing .stem,
  body.growing .branch,
  body.growing .leaf,
  body.growing .petal,
  body.growing .core,
  body.growing .receptacle,
  body.growing .blossom,
  body.growing .ff-head,
  body.growing .flower,
  .field-flower,
  .brand,
  .caption,
  .flower-wrap {
    animation: none;
  }

  .stem,
  .branch { stroke-dashoffset: 0; }

  .field-flower.is-falling {
    animation: none;
    visibility: hidden;
  }
}
