@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

:root {
  --background: #f9f9f7;
  --surface: #ffffff;
  --accent: #1c3f24;
  --accent-hover: #132d19;
  --wood: #e2d4c9;
  --wood-soft: #f0e9e3;
  --text: #2c3330;
  --muted: #5a635e;
  --border: #dedfd9;
  --error: #a73b36;
  --radius: 12px;
  --shadow: 0 18px 60px rgba(44, 51, 48, 0.09);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button, summary, select, input[type="date"] { cursor: pointer; }
a { color: inherit; text-decoration: none; }

.container {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  padding: 22px 0;
  color: #fff;
}

.header-inner, .footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -0.02em; }
.brand small { margin-top: -2px; font-size: 11px; opacity: 0.72; }

.header-link {
  padding: 10px 16px;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.header-link:hover {
  border-color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.08);
}

.hero {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  padding: 154px 0 120px;
  background: var(--accent);
  color: #fff;
}

.hero::after {
  position: absolute;
  inset: auto 0 0;
  height: 85px;
  background: linear-gradient(to bottom, transparent, rgba(19, 45, 25, 0.26));
  content: "";
}

.hero-content { position: relative; z-index: 2; text-align: center; }

.eyebrow, .section-kicker {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow { color: var(--wood); }

.hero h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 66px);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.08;
}

.hero-copy {
  max-width: 650px;
  margin: 28px auto 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(16px, 2vw, 19px);
}

.hero-shape {
  position: absolute;
  border-radius: 50%;
  background: var(--wood);
  opacity: 0.12;
}

.hero-shape-one { top: 98px; left: -90px; width: 290px; height: 290px; }
.hero-shape-two { right: -70px; bottom: -110px; width: 360px; height: 360px; }

.calculator-shell {
  position: relative;
  z-index: 3;
  margin-top: -72px;
  padding-bottom: 82px;
}

.panel {
  padding: clamp(24px, 5vw, 48px);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.converter-panel { margin-top: 28px; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 30px;
}

.section-kicker { color: var(--accent); }

.section-heading h2 {
  margin: 0;
  font-size: clamp(25px, 4vw, 36px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

.date-field, .field { display: grid; gap: 7px; }

.date-field span, .field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

input, select {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(28, 63, 36, 0.12);
}

.date-field input { min-width: 188px; padding: 12px 14px; }
.notice { margin: 18px 0; padding: 16px 18px; border-radius: var(--radius); }
.error-notice { background: #fbefed; color: var(--error); }

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

.rate-card {
  min-height: 220px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}

.rate-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.currency-symbol {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: var(--wood);
  color: var(--accent);
  font-size: 20px;
  font-weight: 600;
}

.currency-code, .option-code {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.currency-name {
  min-height: 43px;
  margin: 18px 0 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.rate-value {
  margin: 0;
  font-size: clamp(24px, 3vw, 31px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.rate-value span { font-size: 16px; font-weight: 400; }

.nominal-line, .unit-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.trend-up, .trend-down { font-weight: 600; }
.trend-up { color: var(--accent); }
.trend-down { color: var(--error); }

.unit-line {
  justify-content: flex-start;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.rate-card-loading span { color: var(--muted); font-size: 13px; font-weight: 600; }

.loading-line {
  width: 100%;
  height: 18px;
  margin-top: 38px;
  border-radius: 8px;
  background: var(--wood-soft);
  animation: pulse 1.4s ease-in-out infinite alternate;
}

.loading-line.short { width: 62%; height: 10px; margin-top: 14px; }
@keyframes pulse { to { opacity: 0.45; } }

.currency-picker {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.currency-picker summary {
  width: fit-content;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.currency-picker fieldset { margin: 18px 0 0; padding: 0; border: 0; }

.currency-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 310px;
  overflow-y: auto;
  gap: 8px;
  padding-right: 8px;
}

.currency-option {
  display: grid;
  grid-template-columns: auto 42px 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.currency-option:hover { background: var(--background); }
.currency-option input { accent-color: var(--accent); }
.option-code { color: var(--text); }

.converter-heading { align-items: flex-end; }

.converter-heading > p {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.converter-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr auto 1fr;
  align-items: end;
  gap: 14px;
}

.field input, .field select { width: 100%; height: 54px; padding: 0 15px; }
.amount-field input { font-size: 20px; font-weight: 600; }

.swap-button {
  display: grid;
  width: 48px;
  height: 54px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: var(--wood);
  color: var(--accent);
  font-size: 24px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.swap-button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: #d6c3b5;
}

.swap-button:disabled, select:disabled { cursor: not-allowed; opacity: 0.55; }

.result-box {
  margin-top: 28px;
  padding: 30px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #fff;
  text-align: center;
}

.result-box > p:first-child {
  margin: 0 0 5px;
  color: var(--wood);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-value {
  font-size: clamp(48px, 8vw, 82px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.15;
}

.result-value #result-code {
  margin-left: 10px;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.result-rate { margin: 8px 0 0; color: rgba(255, 255, 255, 0.72); font-size: 13px; }

footer {
  padding: 28px 0;
  background: var(--accent-hover);
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

footer p { margin: 0; }
footer a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }

.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;
}

@media (max-width: 920px) {
  .rates-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .currency-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .converter-grid { grid-template-columns: 1fr 1fr; }
  .amount-field { grid-column: 1 / -1; }
  .swap-button { display: none; }
}

@media (max-width: 640px) {
  .container { width: min(100% - 24px, 1160px); }
  .site-header { padding: 16px 0; }
  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 14px; }
  .header-link { display: none; }
  .hero { min-height: 470px; padding: 138px 0 110px; }
  .hero h1 br { display: none; }
  .calculator-shell { margin-top: -58px; padding-bottom: 56px; }
  .panel { padding: 22px 18px; }
  .section-heading, .converter-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 18px;
  }
  .date-field input { width: 100%; }
  .rates-grid, .currency-options, .converter-grid { grid-template-columns: 1fr; }
  .rate-card { min-height: 0; }
  .currency-options { max-height: 360px; }
  .converter-heading > p { text-align: left; }
  .result-box { padding: 24px 16px; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@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;
  }
}
