/* =========================================================
   نغمة فنجان — Design Tokens & Base
   الألوان مستخرجة من الشعار: زيتوني (النص)، ذهبي (الإطار)، كراميل (الفنجان)، كريمي (الخلفية)
   ========================================================= */
:root {
  /* Brand */
  --olive-900: #2F361C;
  --olive-800: #3E4726;
  --olive-700: #4D5830;
  --olive-600: #5E6B3A;   /* primary action */
  --olive-500: #7F8A52;   /* logo text */
  --olive-300: #B9C097;
  --olive-100: #EAEDDD;
  --olive-50:  #F4F5EC;

  --gold-600: #A08A45;
  --gold-500: #C1AC6B;    /* logo ring */
  --gold-200: #EADFC0;

  --caramel-600: #A8703F;
  --caramel-500: #C9915E; /* logo cup */
  --caramel-100: #F6E9DA;

  /* Neutrals (warm) */
  --cream: #FBF7F1;       /* logo background */
  --paper: #FFFFFF;
  --sand-50: #F7F2EA;
  --sand-100: #F1EAE0;
  --sand-200: #E7DED1;
  --line: #E6DED2;
  --line-strong: #D6CBBB;

  --ink: #24221C;
  --ink-2: #4E4A42;
  --ink-3: #7C766B;
  --ink-4: #A9A296;

  /* Semantic */
  --sale: #A5472B;
  --sale-bg: #F7E7E0;
  --success: #3F6B3A;
  --success-bg: #E6EFE2;
  --warn: #9A6A14;
  --warn-bg: #FBF0D9;
  --danger: #A33A2A;

  /* Type */
  --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-latin: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: clamp(24px, 2.6vw, 32px);
  --fs-3xl: clamp(30px, 4vw, 44px);
  --fs-display: clamp(38px, 6vw, 72px);

  /* Spacing (4pt) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px;
  --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;

  --section-gap: clamp(56px, 8vw, 104px);
  --container: 1320px;
  --gutter: clamp(16px, 3.2vw, 32px);

  /* Shape */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  --shadow-1: 0 1px 2px rgba(36, 34, 28, .06);
  --shadow-2: 0 2px 6px rgba(36, 34, 28, .06), 0 1px 2px rgba(36, 34, 28, .04);
  --shadow-pop: 0 18px 40px -12px rgba(36, 34, 28, .22), 0 2px 6px rgba(36, 34, 28, .06);

  --ease: cubic-bezier(.2, .7, .2, 1);
  --t-fast: 150ms;
  --t: 240ms;

  --header-h: 72px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.75;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; letter-spacing: 0; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--olive-600); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--olive-100); color: var(--olive-900); }

.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.latin { font-family: var(--font-latin); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--ink-3); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: calc(var(--section-gap) / 2); }
.section + .section { padding-top: calc(var(--section-gap) / 2); }

/* Icons */
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 24px; height: 24px; }
[dir="rtl"] .flip { transform: scaleX(-1); }

/* Buttons */
.btn {
  --h: 46px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: var(--h); padding-inline: 22px;
  border-radius: var(--r-sm);
  font-size: var(--fs-base); font-weight: 500; line-height: 1;
  white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  border: 1px solid transparent;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--olive-600); color: #fff; }
.btn-primary:hover { background: var(--olive-700); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-outline { border-color: var(--line-strong); background: var(--paper); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink); }
.btn-ghost { color: var(--ink-2); padding-inline: 12px; }
.btn-ghost:hover { background: var(--sand-100); color: var(--ink); }
.btn-light { background: var(--cream); color: var(--ink); }
.btn-light:hover { background: #fff; }
.btn-sm { --h: 36px; padding-inline: 14px; font-size: var(--fs-sm); }
.btn-lg { --h: 54px; padding-inline: 28px; font-size: var(--fs-md); }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }

.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border-radius: var(--r-sm); color: var(--ink-2);
  transition: background var(--t-fast), color var(--t-fast);
  position: relative;
}
.icon-btn:hover { background: var(--sand-100); color: var(--ink); }

.link { color: var(--olive-700); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.link:hover { color: var(--olive-900); }
.link .i { transition: transform var(--t) var(--ease); }
.link:hover .i { transform: translateX(-3px); }

/* Form controls */
.field { display: grid; gap: 6px; }
.field label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field .err { font-size: var(--fs-xs); color: var(--danger); display: none; }
.field.has-error .err { display: block; }
.field.has-error .input { border-color: var(--danger); background: #FFF9F7; }
.input {
  width: 100%; height: 48px; padding-inline: 14px;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  font-size: var(--fs-base);
}
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.6; }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%237C766B' stroke-width='1.6' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 14px center; padding-left: 40px; }
.input:hover { border-color: var(--ink-4); }
.input:focus { outline: none; border-color: var(--olive-600); box-shadow: 0 0 0 3px var(--olive-100); }
.input::placeholder { color: var(--ink-4); }

.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); padding-block: 6px; }
.checkbox input { appearance: none; width: 18px; height: 18px; border: 1.5px solid var(--line-strong); border-radius: 4px; display: grid; place-items: center; margin: 0; flex: none; background: #fff; transition: all var(--t-fast); }
.checkbox input:checked { background: var(--olive-600); border-color: var(--olive-600); }
.checkbox input:checked::after { content: ''; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.checkbox .count { margin-inline-start: auto; color: var(--ink-4); font-size: var(--fs-xs); }

/* Badges */
.badge { display: inline-flex; align-items: center; height: 22px; padding-inline: 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; line-height: 1; white-space: nowrap; }
.badge-sale { background: var(--sale); color: #fff; }
.badge-new { background: var(--paper); color: var(--olive-700); box-shadow: inset 0 0 0 1px var(--olive-300); }
.badge-soft { background: var(--sand-100); color: var(--ink-2); }

.stock { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); font-weight: 500; }
.stock::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.stock-in { color: var(--success); }
.stock-low { color: var(--warn); }
.stock-out { color: var(--ink-3); }

/* Price */
.price { display: inline-flex; align-items: baseline; gap: 4px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.price .cur { font-size: .72em; font-weight: 500; color: var(--ink-3); }
.price-old { color: var(--ink-4); text-decoration: line-through; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.price-sale { color: var(--sale); }

/* Media */
.media { position: relative; background: var(--sand-100); overflow: hidden; border-radius: var(--r-md); }
.media img { width: 100%; height: 100%; object-fit: cover; transition: opacity .5s var(--ease), transform .8s var(--ease); }
.media img.is-loading { opacity: 0; }
.media.is-fallback { display: grid; place-items: center; }
.media.is-fallback img { width: 36%; height: auto; object-fit: contain; opacity: .5; }

/* Skeleton-free reveal */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
  .reveal.is-in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Utilities */
.stack > * + * { margin-top: var(--s-4); }
.hide-mobile { }
@media (max-width: 767px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) { .hide-desktop { display: none !important; } }
