/* ============================================================
   AS PERFUME — Design System
   ============================================================ */

:root {
  --bg: #fde8ee;
  --ink: #40122a;
  --ash: #8b5a70;
  --mist: #6f3f55;
  --rose: #c93a6f;
  --rose-dark: #ad2d5c;
  --pink: #e8719a;
  --gold: #8a5a24;
  --paper: #fff6f9;
  --line: rgba(64,18,42,.16);
  --ease: cubic-bezier(.22,1,.36,1);
  --r: 24px;
  --max: 1280px;
  --font: 'IBM Plex Sans Arabic','Segoe UI',Tahoma,Arial,sans-serif;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 300;
  font-size: 18px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }
::selection { background: var(--rose); color: #fff; }

/* RTL-aware Latin labels */
.latin { font-family: var(--font); direction: ltr; unicode-bidi: isolate; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 clamp(20px,5vw,56px); }

/* ---------- Header ---------- */
header {
  position: fixed; top: 0; inset-inline: 0; z-index: 30;
  transition: background .6s var(--ease);
}
header.scrolled { background: rgba(253,232,238,.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }

.bar { display: flex; align-items: center; justify-content: space-between; height: 78px; gap: 20px; }

.logo {
  display: flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 500; font-size: 19px; letter-spacing: .14em;
}
.logo svg { width: 20px; height: 20px; fill: var(--rose); }

nav { display: flex; gap: clamp(14px,3vw,34px); }
nav a {
  font-size: 14px; font-weight: 400; color: var(--ash);
  text-decoration: none; transition: color .4s var(--ease);
}
nav a:hover { color: var(--ink); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none;
  font-size: 15px; font-weight: 500; padding: 14px 28px; border-radius: 999px;
  background: var(--rose); color: #fff;
  transition: transform .5s var(--ease), background .4s var(--ease), opacity .3s;
}
.btn:hover { transform: translateY(-2px); background: var(--rose-dark); }
.btn:active { transform: translateY(0); }
.btn[disabled] { opacity: .6; cursor: default; }

.ghost {
  display: inline-block; color: var(--mist); text-decoration: none;
  font-size: 15px; font-weight: 400; padding: 10px 4px; background: none; border: 0;
}
.ghost:hover { color: var(--ink); border-color: var(--rose); }

/* ---------- Type ---------- */
h1, h2, h3 { font-weight: 400; margin: 0; }
.display { font-size: clamp(46px, 7.2vw, 104px); line-height: 1.2; }
.h2 { font-size: clamp(34px, 5vw, 66px); line-height: 1.25; }
.h2 + p { margin-top: 26px; }
.lego { font-weight: 300; color: var(--mist); max-width: 500px; margin: 26px 0 38px; }
em { font-style: normal; color: var(--rose); }

/* ---------- Reveal animation ---------- */
[data-reveal] { opacity: 0; transform: translateY(30px); filter: blur(10px); transition: opacity 1.3s var(--ease), transform 1.3s var(--ease), filter 1.3s var(--ease); transition-delay: calc(var(--d, 0) * 1ms); }
[data-reveal].in { opacity: 1; transform: none; filter: none; }

/* ---------- Hero ---------- */
.hero {
  min-height: 100svh;
  display: grid; align-items: center;
  padding: 110px 0 40px;
  overflow-x: clip;
}
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(10px,3vw,40px); align-items: center; width: 100%; }
.hero-actions { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }

.field { position: relative; width: 100%; height: min(74vh, 660px); min-height: 360px; cursor: pointer; touch-action: manipulation; }
.field canvas { position: absolute; pointer-events: none; }
.hero .wrap > div:first-child { position: relative; z-index: 2; }

.hint {
  position: absolute; inset-inline: 0; bottom: 2%; text-align: center;
  font-size: 13px; font-weight: 500; color: var(--gold); pointer-events: none;
  transition: opacity .8s var(--ease);
}
.hint.gone { opacity: 0; }

/* ---------- Sections ---------- */
section { padding: clamp(70px, 11vw, 150px) 0; }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px,6vw,90px); align-items: center; }

.split p { color: var(--mist); margin: 0 0 20px; max-width: 520px; }

.rituals { list-style: none; margin: 36px 0 0; padding: 0; display: grid; gap: 26px; max-width: 520px; }
.rituals li { display: grid; grid-template-columns: 54px 1fr; align-items: baseline; }
.rituals b {
  font-weight: 400; font-size: 14px; color: var(--gold); text-align: right;
}
.rituals h3 { font-size: 24px; margin-bottom: 2px; }
.rituals span { color: var(--ash); font-size: 16px; display: block; }

/* ---------- Products ---------- */
.head { display: flex; justify-content: space-between; align-items: end; gap: 30px; flex-wrap: wrap; margin-bottom: 46px; }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: none; color: var(--ash);
  border-radius: 999px; padding: 8px 20px; font-size: 14px; font-weight: 400; cursor: pointer;
  transition: all .45s var(--ease);
}
.chip:hover { color: var(--ink); border-color: rgba(64,18,42,.45); }
.chip.on { color: #fff; background: var(--rose); border-color: var(--rose); }

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(34px,4vw,56px) clamp(18px,3vw,36px); }
.category-section .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.category-section { break-inside: avoid; margin-bottom: 48px; }
.category-section .section-header { margin-bottom: 24px; }
.category-section .section-header .label { display: block; font-size: 13px; color: var(--mist); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .1em; }
.category-section .section-header h2 { margin-bottom: 0; }

/* ---------- 3D perfume bottle (hero) ---------- */

.product .pimg {
  position: relative; aspect-ratio: 4/5; border-radius: var(--r);
  overflow: hidden; background: #f8cfdc;
  transition: transform .9s var(--ease); will-change: transform;
}
.product .pimg::before {
  content: "AS"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 42px; font-weight: 200; letter-spacing: .2em; color: rgba(201,58,111,.3);
}
.product .pimg:hover img { transform: scale(1.06); }
/* ---------- 3D perfume bottle (hero) ---------- */
.field { display: flex; align-items: center; justify-content: center; }
.bottle {
  position: relative; width: min(520px, 80vw); height: min(460px, 68vh);
  transform-style: preserve-3d; perspective: 800px;
  animation: float 6s ease-in-out infinite;
}
.bottle-shade {
  position: absolute; inset: 0; border-radius: 20px;
  background: radial-gradient(ellipse at 50% 80%, rgba(64,18,42,.06), transparent 70%);
}
.bottle-label {
  position: absolute; inset: 0; border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 28px; font-weight: 600; letter-spacing: .06em;
  color: var(--ink); text-align: center; padding: 0 24px;
}
.bottle-reflection {
  position: absolute; inset: 0; border-radius: 20px;
  background: linear-gradient(180deg,
    rgba(201,58,111,.12),
    rgba(201,58,111,.04) 40%,
    rgba(201,58,111,.15) 50%,
    rgba(201,58,111,.04) 60%,
    rgba(201,58,111,.10));
  pointer-events: none;
}
/* bottle body & neck (3D stacked layers) */
.bottle::before {
  content: ""; position: absolute; top: 60%; left: 20%; right: 20%; height: 30%;
  background: linear-gradient(180deg,
    var(--paper),
    rgba(255,246,249,.7) 30%,
    var(--paper) 70%);
  border-radius: 8px;
  box-shadow: inset 0 -20px 40px rgba(64,18,42,.06);
  transform: translateZ(0);
}
.bottle::after {
  content: ""; position: absolute; top: 64%; left: 28%; right: 28%; height: 14%;
  background: linear-gradient(180deg, var(--rose), rgba(201,58,111,.3));
  border-radius: 4px;
  transform: translateZ(0);
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(2deg) rotateY(1deg); }
  50% { transform: translateY(-14px) rotateX(6deg) rotateY(-2deg); }
}
@media (max-width: 900px) {
  .bottle { width: min(380px, 80vw); height: min(400px, 68vh); }
}

.pcat { display: block; margin-top: 20px; font-size: 12px; font-weight: 500; color: var(--rose); }
.product h3 { font-size: 27px; line-height: 1.3; margin: 4px 0 6px; }
.product .desc { color: var(--ash); font-size: 15px; line-height: 1.7; min-height: 50px; margin: 0; }
.prow {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px;
}
.price { font-size: 20px; font-weight: 500; color: var(--gold); }
.add {
  border: 1px solid rgba(64,18,42,.3); background: none; color: var(--ink);
  border-radius: 999px; padding: 9px 20px; font-size: 14px; font-weight: 400; cursor: pointer;
  transition: all .45s var(--ease);
}
.add:hover { background: var(--rose); color: #fff; border-color: var(--rose); }
.empty {
  grid-column: 1 / -1; text-align: center; color: var(--ash); padding: 50px 0;
}

/* ---------- Contact ---------- */
.big {
  font-size: clamp(46px, 13vw, 190px); line-height: 1; font-weight: 400;
  letter-spacing: -.04em; direction: ltr; text-align: center; margin: 0 0 50px; color: var(--ink);
}

/* ---------- Cart / Modal ---------- */
#cart {
  position: fixed; bottom: 20px; left: 20px; z-index: 40;
  box-shadow: 0 10px 36px rgba(201,58,111,.4);
}
#cart.bump { animation: bump .7s var(--ease); }
@keyframes bump {
  0% { transform: scale(1); }
  35% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.modal {
  position: fixed; inset: 0; z-index: 60; display: flex;
  align-items: center; justify-content: center; padding: 16px;
  background: rgba(64,18,42,.42); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity .5s var(--ease), visibility .5s;
}
.modal.open { opacity: 1; visibility: visible; }
.dialog {
  background: var(--paper); border: 1px solid rgba(201,58,111,.14); border-radius: var(--r);
  padding: 28px; max-width: 520px; width: 100%; max-height: 92vh; overflow: auto;
  transform: translateY(24px) scale(.97); transition: transform .7s var(--ease);
}
.modal.open .dialog { transform: none; }
.dialog h2 { font-size: 30px; margin-bottom: 14px; }

.x {
  float: left; background: none; border: 0; color: var(--ash); font-size: 30px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.x:hover { color: var(--ink); }

.cartline { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.qty {
  border: 1px solid rgba(64,18,42,.25); background: none; color: var(--ink); border-radius: 50%;
  width: 30px; height: 30px; cursor: pointer; font-size: 16px; line-height: 1;
}
.qty:hover { background: var(--rose); color: #fff; border-color: var(--rose); }
#cartTotal { font-weight: 500; font-size: 22px; margin: 18px 0 16px; color: var(--rose); }

.dialog label { display: block; font-size: 13px; color: var(--ash); margin-top: 8px; }
.dialog input,
.dialog textarea,
.dialog select {
  width: 100%; padding: 13px 14px; margin: 6px 0 12px;
  border: 1px solid rgba(64,18,42,.2); border-radius: 14px;
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; font-weight: 300; outline: none;
  transition: border-color .3s;
}
.dialog input:focus,
.dialog textarea:focus,
.dialog select:focus { border-color: var(--rose); }

.err { color: #b4233f; font-size: 14px; min-height: 20px; margin: 0 0 8px; }
.note { font-size: 13px; color: var(--ash); margin: 14px 0 0; }
.done { text-align: center; padding: 10px 0; }
.done .tick {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto 14px;
  display: grid; place-items: center; background: var(--rose); color: #fff; font-size: 30px;
}
.done p { color: var(--mist); line-height: 1.9; }

/* ---------- Motion helpers ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal], [data-split] .w { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
  .product img, .product .pimg, .btn, .modal, .dialog { transition: none !important; }
  #cart.bump { animation: none; }
  .hint { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero .wrap, .split { grid-template-columns: 1fr; }
  .hero { padding-top: 100px; align-items: start; }
  .field { height: min(52vh, 430px); min-height: 300px; }
  .split .field { order: -1; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product h3 { font-size: 21px; }
  .desc { font-size: 14px; min-height: 0; }
  .category-section .grid { grid-template-columns: 1fr; }
  .category-section { break-inside: avoid; margin-bottom: 32px; }
  .section-header { margin-bottom: 16px; }
  .section-header .label { font-size: 12px; }
  .section-header h2 { font-size: 28px; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .hero { padding-top: 80px; }
  .hero .wrap { gap: 16px; }
  .btn { padding: 12px 20px; font-size: 14px; }
  .field { height: min(48vh, 380px); min-height: 260px; }
  .split { gap: 20px; }
  .rituals { gap: 16px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .nav a:nth-child(3) { display: none; }
  .bar { height: 68px; }
  .prow { flex-direction: column; align-items: flex-start; }
  .add { width: 100%; }
  .dialog { padding: 22px; }
  .section-card { padding: 16px; }
  .content { padding: 8px; }
  .admin-header .nav-links a { font-size: 13px; margin-left: 10px; }
  .inventory-card { padding: 12px; }
  .order-actions { gap: 8px; }
}

/* Bottle animation */
@keyframes float {
  0%, 100% { transform: translateY(0) rotateX(2deg) rotateY(1deg); }
  50% { transform: translateY(-14px) rotateX(6deg) rotateY(-2deg); }
}

@media (max-width: 520px) {
  body { font-size: 17px; }
  nav a:nth-child(3) { display: none; }
  .bar { height: 68px; }
  .grid { gap: 30px 14px; }
  .prow { flex-direction: column; align-items: flex-start; }
  .add { width: 100%; }
  .dialog { padding: 22px; }
}
