:root {
  --cream: #faf6f0;
  --cream-deep: #f2eadf;
  --dark: #111111;
  --charcoal: #1a1a1a;
  --gold: #c5a880;
  --gold-light: #dfcdb4;
  --white: #ffffff;
  --muted: #716b63;
  --border: rgba(17, 17, 17, 0.12);
  --serif: "Playfair Display", Georgia, serif;
  --sans: "Inter", Arial, sans-serif;
  --shadow: 0 24px 70px -42px rgba(17, 17, 17, 0.45);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--charcoal);
  background: var(--cream);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button, input, select { font: inherit; }
button, select { cursor: pointer; }

.network-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  opacity: 0.45;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 20;
  background: rgba(250, 246, 240, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(17, 17, 17, 0.06);
}

.header-inner {
  max-width: 1180px;
  height: 80px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: var(--charcoal);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.header-label, .field-label, .result-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.header-label { color: rgba(26, 26, 26, 0.55); }

main { position: relative; z-index: 1; }

.hero, .rates-section, .converter-section, .note-section, footer {
  max-width: 1180px;
  margin: 0 auto;
  padding-left: 28px;
  padding-right: 28px;
}

.hero {
  min-height: 670px;
  padding-top: 170px;
  padding-bottom: 92px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(360px, 0.88fr);
  align-content: center;
  column-gap: 72px;
}

.hero-content { align-self: center; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--gold);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.eyebrow span { width: 34px; height: 1px; background: currentColor; }

h1, h2 { margin: 0; font-family: var(--serif); font-weight: 400; text-transform: uppercase; }

h1 {
  margin-top: 22px;
  font-size: clamp(54px, 7vw, 88px);
  line-height: 0.93;
  letter-spacing: -0.035em;
}

h1 em, .converter-intro h2 em {
  color: var(--gold);
  font-weight: 400;
  text-transform: none;
}

.hero-copy {
  max-width: 610px;
  margin: 30px 0 0;
  color: rgba(26, 26, 26, 0.72);
  font-size: 17px;
  font-weight: 300;
  line-height: 1.75;
}

.date-panel {
  align-self: center;
  margin-top: 36px;
  padding: 32px;
  background: var(--white);
  border: 1px solid rgba(197, 168, 128, 0.32);
  box-shadow: var(--shadow);
  position: relative;
}

.date-panel::before {
  content: "";
  position: absolute;
  inset: 8px -9px -9px 8px;
  border: 1px solid rgba(197, 168, 128, 0.22);
  z-index: -1;
}

.date-control { display: grid; grid-template-columns: 1fr auto; margin-top: 12px; }

input, select {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(17, 17, 17, 0.18);
  border-radius: 0;
  background: var(--white);
  color: var(--charcoal);
  padding: 0 16px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

input:focus, select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.14);
}

.field-help { margin: 13px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.button {
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color 200ms ease, background 200ms ease, border-color 200ms ease, transform 200ms ease;
}

.button:hover { transform: translateY(-1px); }
.button-dark { background: var(--dark); color: var(--white); }
.button-dark:hover { background: var(--gold); }
.button-gold { background: var(--gold); color: var(--white); }
.button-gold:hover { background: var(--dark); }
.button-outline { color: var(--charcoal); border-color: rgba(17, 17, 17, 0.22); background: transparent; }
.button-outline:hover { color: var(--white); background: var(--dark); border-color: var(--dark); }

.rates-section { padding-top: 90px; padding-bottom: 110px; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.section-heading h2, .note-section h2 { margin-top: 12px; font-size: clamp(34px, 4vw, 48px); }

.status-bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 5px rgba(197, 168, 128, 0.13); }
.status-bar.error { color: #9d3c2f; }
.status-bar.error .status-dot { background: #9d3c2f; box-shadow: 0 0 0 5px rgba(157, 60, 47, 0.1); }

.rate-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

.rate-card {
  min-height: 220px;
  padding: 26px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.rate-card:hover { transform: translateY(-4px); border-color: rgba(197, 168, 128, 0.62); box-shadow: var(--shadow); }
.rate-card-top { display: flex; justify-content: space-between; gap: 12px; }
.currency-code { color: var(--gold); font-family: var(--serif); font-size: 30px; line-height: 1; }
.currency-flag { font-size: 24px; }
.currency-name { margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.rate-value { display: block; margin-top: 28px; font-family: var(--serif); font-size: clamp(25px, 2.6vw, 36px); font-weight: 600; }
.rate-nominal { margin-top: 7px; color: var(--muted); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

.skeleton { position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.48); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(197,168,128,.12), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

.empty-rates { grid-column: 1 / -1; padding: 48px 30px; border: 1px solid var(--border); text-align: center; color: var(--muted); background: rgba(255,255,255,.65); }

.converter-section {
  max-width: none;
  padding: 100px max(28px, calc((100vw - 1124px) / 2));
  background: var(--dark);
  color: var(--white);
  display: grid;
  grid-template-columns: 0.72fr 1.28fr;
  gap: 72px;
  align-items: center;
}

.eyebrow-on-dark { color: var(--gold); }
.converter-intro h2 { margin-top: 18px; font-size: clamp(40px, 5vw, 64px); line-height: 1; }
.converter-intro p { max-width: 440px; margin: 28px 0 0; color: rgba(255,255,255,.58); font-size: 14px; font-weight: 300; line-height: 1.75; }

.converter-card { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.025); padding: 34px; }
.converter-fields { display: grid; grid-template-columns: 1.2fr 1fr 48px 1fr; gap: 12px; align-items: end; }
.form-field label { display: block; margin-bottom: 9px; color: rgba(255,255,255,.58); font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.converter-card input, .converter-card select { color: var(--white); background: rgba(255,255,255,.05); border-color: rgba(255,255,255,.18); }
.converter-card option { color: var(--dark); background: var(--white); }
.amount-field input { font-family: var(--serif); font-size: 21px; }

.swap-button { width: 48px; height: 52px; padding: 0; border: 1px solid rgba(197,168,128,.4); background: transparent; color: var(--gold); display: grid; place-items: center; transition: background 180ms ease, color 180ms ease; }
.swap-button:hover { background: var(--gold); color: var(--white); }
.swap-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.conversion-result { margin-top: 28px; padding-top: 26px; border-top: 1px solid rgba(255,255,255,.12); display: grid; grid-template-columns: 1fr; }
.result-label { color: var(--gold); }
#result-value { margin-top: 10px; color: var(--white); font-family: var(--serif); font-size: clamp(36px, 5vw, 62px); font-weight: 400; line-height: 1.05; overflow-wrap: anywhere; }
#result-caption { margin-top: 12px; color: rgba(255,255,255,.52); font-size: 12px; }

.note-section { padding-top: 88px; padding-bottom: 88px; display: grid; grid-template-columns: 90px 1fr auto; gap: 34px; align-items: center; }
.note-number { color: var(--gold); font-family: var(--serif); font-size: 38px; }
.note-section h2 { font-size: 32px; }
.note-section p { max-width: 660px; margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.note-section a { color: var(--charcoal); font-size: 11px; font-weight: 600; letter-spacing: .13em; text-decoration: none; text-transform: uppercase; border-bottom: 1px solid var(--gold); padding-bottom: 6px; }

footer { min-height: 92px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 20px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }

.currency-dialog { width: min(760px, calc(100% - 32px)); max-height: 88vh; padding: 0; border: 0; border-radius: 0; background: var(--cream); color: var(--charcoal); box-shadow: 0 30px 100px rgba(0,0,0,.32); }
.currency-dialog::backdrop { background: rgba(17,17,17,.62); backdrop-filter: blur(4px); }
.dialog-panel { padding: 34px; }
.dialog-header { display: flex; justify-content: space-between; gap: 24px; align-items: start; }
.dialog-header h2 { margin-top: 12px; font-size: clamp(28px, 4vw, 42px); }
.dialog-close { width: 42px; height: 42px; border: 1px solid var(--border); background: transparent; color: var(--charcoal); font-size: 26px; font-weight: 300; }
.dialog-panel > p { color: var(--muted); font-size: 13px; line-height: 1.6; }
.search-field { display: block; margin-top: 22px; }
.search-field span { display: block; margin-bottom: 8px; font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; }
.currency-options { margin-top: 18px; max-height: 310px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding-right: 6px; }
.currency-option { position: relative; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 14px; border: 1px solid var(--border); background: rgba(255,255,255,.55); cursor: pointer; }
.currency-option:hover { border-color: var(--gold); }
.currency-option input { width: 17px; min-height: 17px; accent-color: var(--gold); }
.currency-option strong { min-width: 38px; font-family: var(--serif); color: var(--gold); }
.currency-option small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dialog-error { min-height: 20px; color: #9d3c2f !important; }
.dialog-actions { display: flex; justify-content: end; gap: 10px; padding-top: 12px; border-top: 1px solid var(--border); }
.noscript { position: fixed; inset: auto 20px 20px; z-index: 100; padding: 16px; color: white; background: #9d3c2f; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; min-height: auto; padding-top: 145px; }
  .date-panel { max-width: 620px; }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .converter-section { grid-template-columns: 1fr; gap: 48px; }
  .converter-fields { grid-template-columns: 1fr 1fr 48px 1fr; }
  .amount-field { grid-column: 1 / -1; }
  .note-section { grid-template-columns: 60px 1fr; }
  .note-section a { grid-column: 2; justify-self: start; }
}

@media (max-width: 640px) {
  .header-inner { height: 70px; padding: 0 20px; }
  .brand { font-size: 16px; }
  .header-label { display: none; }
  .hero, .rates-section, .note-section, footer { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 125px; padding-bottom: 62px; }
  h1 { font-size: 51px; }
  .hero-copy { font-size: 15px; }
  .date-panel { padding: 22px; }
  .date-control { grid-template-columns: 1fr; gap: 10px; }
  .section-heading { align-items: stretch; flex-direction: column; }
  .section-heading .button { width: 100%; }
  .rate-grid { grid-template-columns: 1fr; }
  .rate-card { min-height: 190px; }
  .converter-section { padding: 72px 20px; }
  .converter-card { padding: 22px; }
  .converter-fields { grid-template-columns: 1fr 48px 1fr; }
  .amount-field { grid-column: 1 / -1; }
  .swap-button { grid-column: 2; grid-row: 2; align-self: end; }
  .converter-fields .form-field:nth-of-type(2) { grid-column: 1; }
  .converter-fields .form-field:nth-of-type(3) { grid-column: 3; }
  .note-section { grid-template-columns: 1fr; gap: 16px; }
  .note-section a { grid-column: 1; }
  footer { padding-top: 28px; padding-bottom: 28px; flex-direction: column; align-items: start; }
  .dialog-panel { padding: 24px; }
  .currency-options { grid-template-columns: 1fr; }
  .dialog-actions .button { flex: 1; padding: 0 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .network-canvas { display: none; }
}
