:root {
  --forest: #233a2d;
  --forest-soft: #748c70;
  --terracotta: #b85c38;
  --terracotta-dark: #984929;
  --ink: #2c2a29;
  --ink-soft: #4a4846;
  --paper: #f5f2eb;
  --paper-deep: #ece9e1;
  --white: #ffffff;
  --line: #d3cec4;
  --error: #9b3427;
  --serif: "Cormorant Garamond", "Playfair Display", Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --content: 1160px;
  color: var(--ink);
  font-family: var(--sans);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
button, select, input[type="date"] { cursor: pointer; touch-action: manipulation; }
a { color: inherit; }

:focus-visible {
  outline: 3px solid rgba(184, 92, 56, 0.38);
  outline-offset: 3px;
}

.skip-link { position: fixed; z-index: 20; top: 10px; left: 10px; padding: 10px 14px; color: var(--white); background: var(--forest); transform: translateY(-160%); transition: transform 160ms ease; }
.skip-link:focus { transform: translateY(0); }

.site-header {
  width: min(calc(100% - 64px), var(--content));
  min-height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(44, 42, 41, 0.08);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__name { color: var(--forest); font: 600 26px/1 var(--serif); }
.brand__slash { color: #a3a19e; font-size: 21px; }
.brand__role, .header-link { color: #77736e; font-size: 13px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.header-link { color: var(--forest); text-decoration-thickness: 1px; text-underline-offset: 5px; }

.hero {
  width: min(calc(100% - 64px), var(--content));
  margin: 0 auto;
  padding: 88px 0 76px;
}

.eyebrow { display: flex; align-items: center; gap: 16px; color: var(--forest-soft); font-size: 12px; font-weight: 600; letter-spacing: .18em; }
.eyebrow span { width: 40px; height: 1px; background: var(--forest-soft); }
.hero__heading { margin-top: 46px; display: grid; grid-template-columns: 1.3fr .7fr; align-items: end; gap: 80px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; color: var(--forest); font: 500 clamp(64px, 8vw, 104px)/.82 var(--serif); letter-spacing: -.035em; }
.hero__heading p { max-width: 420px; margin-bottom: 8px; color: var(--ink-soft); font-size: 17px; line-height: 1.7; }

.workspace { background: var(--paper-deep); padding: 72px max(32px, calc((100% - var(--content)) / 2)) 96px; }
.workspace__intro { display: flex; align-items: end; justify-content: space-between; gap: 32px; }
.section-number { margin-bottom: 8px; color: var(--terracotta); font-size: 12px; font-weight: 600; letter-spacing: .16em; }
h2 { margin-bottom: 0; color: var(--forest); font: 500 clamp(42px, 5vw, 58px)/1 var(--serif); letter-spacing: -.02em; }

.date-field, .field { display: grid; gap: 8px; }
label { color: #6c6864; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
input, select {
  min-height: 52px;
  padding: 0 16px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}
input:hover, select:hover { border-color: #a9a298; background: var(--white); }
input:focus, select:focus { border-color: var(--forest); background: var(--white); }

.status { min-height: 28px; margin: 30px 0 22px; display: flex; align-items: center; gap: 10px; color: #696560; font-size: 13px; }
.status__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--forest-soft); box-shadow: 0 0 0 5px rgba(116,140,112,.12); }
.status[data-kind="loading"] .status__dot { animation: pulse 1.3s ease-in-out infinite; }
.status[data-kind="error"] { color: var(--error); }
.status[data-kind="error"] .status__dot { background: var(--error); box-shadow: 0 0 0 5px rgba(155,52,39,.1); }

.currency-picker { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 28px; }
.currency-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.currency-chip { min-height: 42px; display: inline-flex; align-items: center; gap: 9px; padding: 0 12px; color: var(--forest); background: rgba(255,255,255,.6); border: 1px solid var(--line); border-radius: 999px; font-weight: 600; }
.currency-chip button { width: 26px; height: 26px; padding: 0; display: grid; place-items: center; color: #77716b; background: none; border: 0; border-radius: 50%; }
.currency-chip button:hover { color: var(--terracotta); background: rgba(184,92,56,.08); }
.currency-chip svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.currency-add { display: flex; gap: 8px; }
.currency-add .search-select { width: 240px; }
.currency-add input { min-height: 44px; }

.button { min-height: 52px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--white); background: var(--terracotta); border: 1px solid var(--terracotta); border-radius: 6px; font-weight: 600; transition: transform 180ms ease, background-color 180ms ease; }
.button:hover { background: var(--terracotta-dark); transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button--small { min-height: 44px; padding: 0 15px; font-size: 14px; }
.button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }

.rates-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.rate-card { min-height: 206px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; background: rgba(255,255,255,.68); border: 1px solid rgba(44,42,41,.08); }
.rate-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.rate-card__code { color: var(--forest); font: 600 28px/1 var(--serif); }
.rate-card__flag { color: var(--forest-soft); font-size: 12px; font-weight: 600; letter-spacing: .08em; }
.rate-card__name { min-height: 42px; margin: 14px 0 22px; color: #6d6965; font-size: 13px; }
.rate-card__value { margin-bottom: 4px; color: var(--ink); font: 500 32px/1 var(--serif); }
.rate-card__nominal { margin-bottom: 0; color: #827d77; font-size: 12px; }

.converter { margin-top: 72px; padding: 48px; color: var(--white); background: var(--forest); border-radius: 2px; }
.converter__heading { display: grid; grid-template-columns: 76px 1fr; gap: 16px; }
.converter .section-number { color: #c27b5d; padding-top: 9px; }
.converter h2 { color: var(--white); }
.converter__heading p:last-child { margin: 10px 0 0; color: #c6d0c7; }
.converter__form { margin-top: 42px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 52px minmax(0, 1fr); gap: 12px; align-items: end; }
.converter__form .field { min-width: 0; }
.converter__form input { width: 100%; }
.converter label { color: #b9c6bb; }
.converter input { color: var(--white); background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.24); }
.converter input:hover, .converter input:focus { background: rgba(255,255,255,.13); border-color: rgba(255,255,255,.55); }
.swap-button { width: 52px; min-height: 52px; padding: 0; display: grid; place-items: center; color: var(--white); background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.24); border-radius: 50%; transition: transform 220ms ease, background-color 180ms ease; }
.swap-button:hover { transform: rotate(180deg); background: rgba(255,255,255,.14); }
.swap-button:active { background: rgba(255,255,255,.2); }
.swap-button svg { width: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.result { margin-top: 38px; padding-top: 30px; border-top: 1px solid rgba(255,255,255,.18); }
#result-source { margin-bottom: 4px; color: #b9c6bb; font-size: 14px; }
#result-value { margin-bottom: 5px; color: var(--white); font: 500 clamp(50px, 7vw, 76px)/1 var(--serif); letter-spacing: -.025em; overflow-wrap: anywhere; }
#result-rate { margin-bottom: 0; color: #b9c6bb; font-size: 13px; }
.result__note { max-width: 590px; margin: 22px 0 0; padding-top: 20px; color: #d7dfd8; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; }

.search-select { position: relative; min-width: 0; }
.search-select input { width: 100%; padding-right: 44px; cursor: text; }
.search-select__toggle { position: absolute; z-index: 2; top: 0; right: 0; width: 44px; height: 100%; padding: 0; display: grid; place-items: center; color: #77716b; background: transparent; border: 0; }
.search-select__toggle svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 180ms ease; }
.search-select[data-open="true"] .search-select__toggle svg { transform: rotate(180deg); }
.search-select__menu { position: absolute; z-index: 12; top: calc(100% + 6px); left: 0; width: max(100%, 270px); max-height: 280px; overflow-y: auto; padding: 6px; color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 18px 40px rgba(35,58,45,.16); }
.search-select__option { width: 100%; min-height: 44px; padding: 9px 10px; display: flex; align-items: baseline; gap: 10px; color: var(--ink); background: transparent; border: 0; border-radius: 2px; text-align: left; }
.search-select__option:hover, .search-select__option[data-active="true"] { background: var(--paper); }
.search-select__option[aria-selected="true"] { color: var(--forest); background: #edf0eb; }
.search-select__code { min-width: 38px; color: var(--forest); font-weight: 600; }
.search-select__name { color: #6d6965; font-size: 13px; }
.search-select__empty { margin: 0; padding: 14px 10px; color: #77716b; font-size: 13px; }
.search-select--dark .search-select__toggle { color: #c7d2c8; }
.search-select input:disabled + .search-select__toggle { cursor: not-allowed; opacity: .5; }

.chart-section, .faq-section { padding: 88px max(32px, calc((100% - var(--content)) / 2)); background: var(--paper); }
.section-heading { display: grid; grid-template-columns: 1fr minmax(280px, 430px); align-items: end; gap: 64px; }
.section-heading > p { margin: 0 0 7px; color: var(--ink-soft); line-height: 1.7; }
.chart-panel { margin-top: 42px; padding: 34px; background: var(--white); border: 1px solid rgba(44,42,41,.09); }
.chart-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.chart-currency-field { width: 300px; }
.period-control { display: flex; flex-wrap: wrap; gap: 6px; }
.period-control button { min-height: 44px; padding: 0 15px; color: var(--ink-soft); background: var(--paper); border: 1px solid transparent; border-radius: 3px; font-size: 13px; transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease; }
.period-control button:hover { border-color: var(--line); }
.period-control button[aria-pressed="true"] { color: var(--white); background: var(--forest); border-color: var(--forest); }
.chart-status { min-height: 24px; margin: 24px 0 4px; color: #77716b; font-size: 13px; }
.chart-wrap { position: relative; min-height: 340px; }
#rate-chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid-line { stroke: #e8e3dc; stroke-width: 1; }
.chart-axis-label { fill: #7d7872; font: 12px var(--sans); }
.chart-area { fill: url(#chart-gradient); }
.chart-line { fill: none; stroke: var(--terracotta); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-point { fill: var(--white); stroke: var(--terracotta); stroke-width: 2.5; cursor: pointer; vector-effect: non-scaling-stroke; }
.chart-point:focus { outline: none; stroke: var(--forest); stroke-width: 5; }
.chart-tooltip { position: absolute; z-index: 4; min-width: 145px; padding: 10px 12px; color: var(--white); background: var(--forest); border-radius: 3px; box-shadow: 0 8px 22px rgba(35,58,45,.2); font-size: 12px; pointer-events: none; transform: translate(-50%, calc(-100% - 13px)); }
.chart-tooltip strong { display: block; margin-bottom: 2px; font: 600 19px var(--serif); }
.chart-summary { margin: 4px 0 0; color: var(--forest); font-weight: 500; }
.chart-note { margin: 8px 0 0; color: #827d77; font-size: 12px; }

.faq-section { padding-top: 18px; padding-bottom: 100px; }
.faq-list { margin-top: 42px; border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { min-height: 78px; padding: 20px 0; display: flex; align-items: center; justify-content: space-between; gap: 24px; color: var(--forest); font: 500 clamp(24px, 2.5vw, 31px)/1.2 var(--serif); cursor: pointer; list-style: none; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary span { position: relative; flex: 0 0 32px; width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 50%; }
.faq-list summary span::before, .faq-list summary span::after { content: ""; position: absolute; top: 15px; left: 9px; width: 12px; height: 1px; background: var(--forest); transition: transform 180ms ease; }
.faq-list summary span::after { transform: rotate(90deg); }
.faq-list details[open] summary span::after { transform: rotate(0deg); }
.faq-list details > p { max-width: 760px; margin: -4px 0 26px; color: var(--ink-soft); line-height: 1.75; }

footer { min-height: 112px; padding: 32px max(32px, calc((100% - var(--content)) / 2)); display: flex; align-items: center; justify-content: space-between; gap: 24px; color: #8a8885; background: var(--forest); border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; }
footer p { margin: 0; }
footer a { color: #bac7bb; text-underline-offset: 4px; }
.empty-state { grid-column: 1/-1; padding: 36px; color: #6d6965; text-align: center; border: 1px dashed #c5bfb5; }
.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; }

@keyframes pulse { 50% { opacity: .35; transform: scale(.82); } }

@media (max-width: 900px) {
  .hero__heading { grid-template-columns: 1fr; gap: 34px; }
  .hero__heading p { max-width: 600px; }
  .rates-grid { grid-template-columns: repeat(2, 1fr); }
  .currency-picker { align-items: flex-start; flex-direction: column; }
  .converter__form { grid-template-columns: 1fr 1fr 52px; }
  .field--amount { grid-column: 1/-1; }
  .section-heading { grid-template-columns: 1fr; gap: 22px; }
  .chart-toolbar { align-items: stretch; flex-direction: column; }
  .chart-currency-field { width: min(100%, 380px); }
}

@media (max-width: 620px) {
  .site-header, .hero { width: min(calc(100% - 36px), var(--content)); }
  .site-header { min-height: 72px; }
  .brand__role, .brand__slash, .header-link { display: none; }
  .hero { padding: 62px 0 56px; }
  .hero__heading { margin-top: 34px; }
  h1 { font-size: clamp(56px, 19vw, 78px); }
  .workspace { padding: 52px 18px 68px; }
  .workspace__intro { align-items: stretch; flex-direction: column; }
  .date-field input { width: 100%; }
  .currency-add { width: 100%; }
  .currency-add .search-select { width: auto; flex: 1; min-width: 0; }
  .rates-grid { grid-template-columns: 1fr; }
  .rate-card { min-height: 174px; }
  .converter { margin-top: 52px; padding: 30px 20px; }
  .converter__heading { grid-template-columns: 1fr; }
  .converter .section-number { padding-top: 0; }
  .converter__form { grid-template-columns: 1fr 48px; }
  .field--amount { grid-column: 1/-1; }
  .converter__form .field:nth-of-type(2) { grid-column: 1; }
  .swap-button { grid-column: 2; grid-row: 2; width: 48px; min-height: 48px; }
  .converter__form .field:nth-of-type(3) { grid-column: 1/-1; }
  #result-value { font-size: 48px; }
  .chart-section, .faq-section { padding-left: 18px; padding-right: 18px; }
  .chart-section { padding-top: 64px; }
  .chart-panel { margin-top: 32px; padding: 20px 14px; }
  .period-control { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .period-control button { padding: 0 10px; }
  .chart-wrap { min-height: 250px; overflow-x: auto; }
  #rate-chart { min-width: 660px; }
  .faq-section { padding-top: 8px; padding-bottom: 72px; }
  .faq-list { margin-top: 30px; }
  .faq-list summary { min-height: 70px; font-size: 23px; }
  footer { align-items: flex-start; flex-direction: column; }
}

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