/* ═══════════════════════════════════════════════════════════
   BAHRAIN GOLD PRICE — "The Gold Edition"
   Editorial luxury aesthetic · warm ivory · hallmark seal
   ═══════════════════════════════════════════════════════════ */

:root {
  /* Warm parchment palette */
  --bg:           #F8F4ED;
  --bg-warm:      #F3EDE3;
  --bg-cream:     #EDE7DA;
  --surface:      #FFFFFF;

  /* Rich, muted gold — not screaming yellow */
  --gold:         #B5892A;
  --gold-rich:    #9A7420;
  --gold-light:   #D4B05C;
  --gold-wash:    rgba(181, 137, 42, 0.08);
  --gold-wash-2:  rgba(181, 137, 42, 0.15);

  /* Silver — cool slate */
  --silver:       #6B7B8D;
  --silver-light: #8A9BAD;
  --silver-wash:  rgba(107, 123, 141, 0.08);

  /* Text — espresso tones */
  --ink:          #1E1108;
  --ink-soft:     #3D2E22;
  --ink-muted:    #7A6B5D;
  --ink-faint:    #B0A395;

  /* Borders & Rules */
  --rule:         #D9D0C3;
  --rule-light:   #E8E1D6;

  /* Typography */
  --font-display: "Cormorant Garamond", "Georgia", "Times New Roman", serif;
  --font-body:    "Outfit", "Helvetica Neue", sans-serif;
  --font-arabic:  "Noto Naskh Arabic", "Arial", sans-serif;

  /* Spacing */
  --space-page:   clamp(1rem, 4vw, 3rem);
  --max-w:        900px;

  /* Motion */
  --ease:         cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

::selection {
  background: var(--gold);
  color: #fff;
}

/* ── Film Grain Texture ────────────────────────────────── */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 256px 256px;
}

/* ── Ticker Strip ──────────────────────────────────────── */
.ticker {
  background: var(--ink);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  overflow: hidden;
}

.ticker-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.55rem var(--space-page);
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.ticker-label {
  color: var(--ink-muted);
  color: rgba(255,255,255,0.4);
}

.ticker-val {
  color: var(--gold-light);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ticker-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
}

.ticker-live {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255,255,255,0.5);
}

.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #6FCF97;
  box-shadow: 0 0 6px rgba(111, 207, 151, 0.5);
  animation: blink 2.5s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ── Header / Masthead ─────────────────────────────────── */
header {
  padding: 2.5rem var(--space-page) 0;
  max-width: var(--max-w);
  margin: 0 auto;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.edition-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.masthead-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.2rem);
  font-weight: 600;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -0.02em;
}

.masthead-ar {
  font-family: var(--font-arabic);
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink-muted);
  margin-top: 0.35rem;
}

.header-rule {
  height: 1px;
  background: var(--ink);
  margin-top: 1.2rem;
  position: relative;
}

.header-rule::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--ink);
}

/* ── Currency Toggle ───────────────────────────────────── */
.currency-toggle {
  display: flex;
  gap: 0.35rem;
}

.cur-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1rem;
  background: none;
  border: 1.5px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  min-width: 62px;
}

.cur-btn.active {
  background: var(--ink);
  border-color: var(--ink);
}

.cur-code {
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.04em;
  transition: color 0.3s;
}

.cur-btn.active .cur-code { color: var(--bg); }

.cur-name {
  font-size: 0.6rem;
  font-weight: 400;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color 0.3s;
}

.cur-btn.active .cur-name { color: rgba(255,255,255,0.5); }

.cur-btn:hover:not(.active) {
  border-color: var(--gold);
}

/* ── Hero Section — 24K with Hallmark Seal ─────────────── */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem var(--space-page);
}

.hero-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  flex-wrap: wrap;
}

.hero-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: 0.5rem;
}

.hero-karat {
  font-family: var(--font-display);
  font-size: clamp(4rem, 12vw, 7rem);
  font-weight: 700;
  line-height: 0.85;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.hero-subtitle {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--ink-muted);
  margin-top: 0.5rem;
  letter-spacing: 0.02em;
}

/* Hallmark Seal */
.hero-price-wrap {
  flex-shrink: 0;
}

.hallmark-seal {
  position: relative;
  width: clamp(160px, 28vw, 220px);
  height: clamp(160px, 28vw, 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: sealReveal 1s var(--ease) 0.3s both;
}

@keyframes sealReveal {
  from { opacity: 0; transform: scale(0.8) rotate(-10deg); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); }
}

.seal-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--gold);
}

.seal-ring-outer {
  inset: 0;
  border-width: 2px;
  animation: sealSpin 60s linear infinite;
  border-style: dashed;
  border-color: var(--gold-light);
  opacity: 0.5;
}

.seal-ring-inner {
  inset: 10px;
  border-width: 1.5px;
  border-color: var(--gold);
}

@keyframes sealSpin {
  to { transform: rotate(360deg); }
}

.seal-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.seal-currency {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-rich);
}

.seal-price {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
  margin: 0.15rem 0;
  font-variant-numeric: tabular-nums;
}

.seal-unit {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ── Karat Strip — 22K / 21K / 18K ─────────────────────── */
.karat-strip {
  background: var(--surface);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.karat-strip-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-page);
  display: flex;
  align-items: stretch;
}

.karat-card {
  flex: 1;
  padding: 1.8rem 1.2rem;
  text-align: center;
  animation: fadeUp 0.7s var(--ease) both;
}

.karat-card:nth-child(1) { animation-delay: 0.15s; }
.karat-card:nth-child(3) { animation-delay: 0.3s; }
.karat-card:nth-child(5) { animation-delay: 0.45s; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.karat-divider {
  width: 1px;
  background: var(--rule-light);
  align-self: stretch;
  margin: 1rem 0;
}

.karat-card-top {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
}

.kc-karat {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ink);
}

.kc-fine {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  background: var(--gold-wash);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
}

.kc-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.3rem;
}

.kc-sym {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.kc-val {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kc-unit {
  display: block;
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-top: 0.4rem;
}

/* ── Silver Section ────────────────────────────────────── */
.silver-section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem var(--space-page);
}

.silver-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(135deg, var(--silver-wash), rgba(107,123,141,0.03));
  border: 1px solid rgba(107,123,141,0.12);
  border-radius: 10px;
  animation: fadeUp 0.7s var(--ease) 0.5s both;
}

.silver-label {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.silver-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--silver-wash);
  border: 1px solid rgba(107,123,141,0.15);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--silver);
  letter-spacing: 0.02em;
}

.silver-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.1;
}

.silver-title-ar {
  font-family: var(--font-arabic);
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 0.1rem;
}

.silver-price-block {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.silver-sym {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--silver);
}

.silver-val {
  font-family: var(--font-body);
  font-size: 2rem;
  font-weight: 700;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.silver-unit {
  font-size: 0.7rem;
  color: var(--silver-light);
  font-weight: 500;
}

/* ── Calculator ────────────────────────────────────────── */
.calculator {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-page) 2rem;
}

.calc-inner {
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  animation: fadeUp 0.7s var(--ease) 0.55s both;
}

.calc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.calc-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.1;
}

.calc-title-ar {
  font-family: var(--font-arabic);
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-top: 0.15rem;
}

.calc-hint {
  font-size: 0.72rem;
  color: var(--ink-faint);
  align-self: center;
  text-align: right;
}

.calc-input-wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.calc-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}

.calc-field {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.2s var(--ease);
  flex: 1;
  max-width: 220px;
}

.calc-field:focus-within {
  border-color: var(--gold);
}

.calc-input {
  flex: 1;
  padding: 0.65rem 0.9rem;
  font-family: var(--font-body);
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: none;
  border: none;
  outline: none;
  width: 100%;
  min-width: 0;
}

.calc-input::placeholder {
  color: var(--ink-faint);
  font-weight: 400;
}

.calc-input::-webkit-inner-spin-button,
.calc-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.calc-unit-badge {
  display: flex;
  align-items: center;
  padding: 0 0.8rem;
  background: var(--bg-warm);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  border-left: 1px solid var(--rule);
}

.calc-results {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--rule-light);
  border-radius: 8px;
  overflow: hidden;
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--rule-light);
  transition: background 0.15s;
}

.calc-row:last-child {
  border-bottom: none;
}

.calc-row:hover {
  background: var(--gold-wash);
}

.calc-row-silver:hover {
  background: var(--silver-wash);
}

.calc-row-karat {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  width: 3.5rem;
  flex-shrink: 0;
}

.calc-row-fine {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  background: var(--gold-wash);
  padding: 0.12rem 0.4rem;
  border-radius: 3px;
  flex-shrink: 0;
}

.calc-row-silver .calc-row-fine {
  background: var(--silver-wash);
}

.calc-row-value {
  margin-left: auto;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

@media (max-width: 640px) {
  .calc-inner {
    padding: 1.2rem;
  }

  .calc-hint {
    display: none;
  }

  .calc-field {
    max-width: none;
  }

  .calc-input-wrap {
    gap: 0.6rem;
  }
}

/* ── Editorial / SEO Content ───────────────────────────── */
.editorial {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--space-page);
}

.editorial-inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  padding: 2.5rem 0;
  border-top: 1px solid var(--rule);
}

.editorial h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.8rem;
}

.editorial h3 {
  font-family: var(--font-arabic);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 1.2rem;
  margin-bottom: 0.5rem;
}

.editorial p {
  font-size: 0.82rem;
  line-height: 1.75;
  color: var(--ink-muted);
  margin-bottom: 0.7rem;
}

/* ── Footer ────────────────────────────────────────────── */
footer {
  padding: 1.5rem var(--space-page);
  text-align: center;
  border-top: 1px solid var(--rule);
  max-width: var(--max-w);
  margin: 1rem auto 0;
}

.footer-note {
  font-size: 0.68rem;
  color: var(--ink-faint);
  margin-bottom: 0.3rem;
}

.footer-brand {
  font-size: 0.68rem;
  color: var(--ink-faint);
}

.footer-brand a {
  color: var(--gold);
  text-decoration: none;
  font-weight: 500;
}

.footer-brand a:hover {
  text-decoration: underline;
}

/* ── Error Toast ───────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.7rem 1.2rem;
  background: var(--ink);
  color: #fca5a5;
  border-radius: 8px;
  font-size: 0.8rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  animation: fadeUp 0.4s var(--ease);
}

.toast-btn {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.7rem;
  background: rgba(252,165,165,0.15);
  border: 1px solid rgba(252,165,165,0.3);
  border-radius: 5px;
  color: #fca5a5;
  cursor: pointer;
}

.toast-btn:hover { background: rgba(252,165,165,0.25); }

.toast[hidden] { display: none !important; }

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 640px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-controls {
    width: 100%;
  }

  .currency-toggle {
    width: 100%;
  }

  .cur-btn {
    flex: 1;
  }

  .hero {
    padding: 2rem var(--space-page);
  }

  .hero-inner {
    flex-direction: column;
    text-align: center;
  }

  .hero-content {
    order: 2;
  }

  .hero-price-wrap {
    order: 1;
  }

  .hallmark-seal {
    width: 170px;
    height: 170px;
  }

  .hero-karat {
    font-size: 3.5rem;
  }

  .karat-strip-inner {
    flex-direction: column;
  }

  .karat-divider {
    width: 100%;
    height: 1px;
    margin: 0;
  }

  .karat-card {
    padding: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .karat-card-top {
    margin-bottom: 0;
    gap: 0.4rem;
  }

  .kc-unit { display: none; }

  .kc-price {
    gap: 0.25rem;
  }

  .silver-inner {
    padding: 1.2rem 1.5rem;
  }

  .editorial-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ── Reduced Motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
