:root {
  --ink: #14282a;
  --ink-deep: #0e2021;
  --accent: #397f76;
  --accent-bright: #78d7c6;
  --paper: #f2eee6;
  --paper-light: #f8f5ef;
  --white: #ffffff;
  --line: rgba(20, 40, 42, 0.18);
  --line-light: rgba(255, 255, 255, 0.2);
  --muted: #6f7c7c;
  --max-width: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 40px;
  width: min(100% - 64px, var(--max-width));
  min-height: 64px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}

.brand {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.header-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  margin-left: auto;
  padding: 0 20px;
  color: var(--white);
  background: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  transition: transform 180ms ease, background-color 180ms ease;
}

.site-link:hover {
  background: #2f6e66;
  transform: translateY(-1px);
}

.hero,
.converter-section {
  width: min(100% - 64px, var(--max-width));
  margin: 0 auto;
}

.hero {
  padding: 52px 0 25px;
}

.eyebrow {
  margin-bottom: 22px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.14em;
}

.eyebrow.light {
  color: var(--accent-bright);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.75fr);
  gap: 52px;
  align-items: end;
}

.hero-grid > *,
.hero-copy,
.date-field {
  min-width: 0;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  margin-bottom: 0;
  font-weight: 900;
  letter-spacing: -0.065em;
}

h1 {
  max-width: 830px;
  font-size: clamp(54px, 7.3vw, 94px);
  line-height: 0.86;
}

h2 {
  font-size: clamp(42px, 4.6vw, 62px);
  line-height: 0.93;
}

h1 em,
h2 em {
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.hero-copy > p {
  max-width: 360px;
  margin-bottom: 24px;
  font-size: 16px;
  line-height: 1.45;
}

.date-field {
  position: relative;
  display: grid;
  gap: 9px;
}

.date-label,
.converter-field > label,
.converter-field > span,
.result-block > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.date-trigger,
.converter-field input,
.search-field input {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  outline: 0;
}

.date-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  min-height: 46px;
  font-size: 22px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.date-trigger:hover,
.date-trigger:focus-visible,
.date-trigger[aria-expanded="true"],
.converter-field input:focus,
.search-field input:focus {
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 var(--accent);
}

.calendar-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--white);
  background: var(--accent);
  font-size: 18px;
}

.calendar-popover {
  position: absolute;
  z-index: 40;
  top: calc(100% + 10px);
  right: 0;
  width: min(330px, calc(100vw - 36px));
  padding: 14px;
  color: var(--ink);
  background: var(--paper-light);
  border: 1px solid var(--ink);
  box-shadow: 10px 12px 0 rgba(20, 40, 42, 0.12);
}

.calendar-popover[hidden] {
  display: none;
}

.calendar-head {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.calendar-head strong {
  text-align: center;
  font-size: 16px;
  text-transform: capitalize;
}

.calendar-nav {
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.calendar-nav:hover:not(:disabled),
.calendar-nav:focus-visible {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
  outline: 0;
}

.calendar-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.calendar-weekdays,
.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-weekdays {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 700;
}

.calendar-day:hover:not(:disabled),
.calendar-day:focus-visible {
  background: rgba(57, 127, 118, 0.12);
  outline: 1px solid var(--accent);
}

.calendar-day.is-today {
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.calendar-day.is-selected {
  color: var(--white);
  background: var(--accent);
  box-shadow: none;
}

.calendar-day:disabled {
  color: rgba(20, 40, 42, 0.25);
  cursor: not-allowed;
}

.calendar-blank {
  aspect-ratio: 1;
}

.calendar-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.calendar-foot button {
  min-height: 34px;
  padding: 0 14px;
  color: var(--white);
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 22px;
  margin-top: 34px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  background: var(--accent);
  border-radius: 50%;
}

.status-row.is-error .status-dot {
  background: #b55248;
}

.rates-section {
  padding: 72px max(32px, calc((100vw - var(--max-width)) / 2));
  color: var(--white);
  background: var(--ink);
}

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

.rates-section h2 em {
  color: var(--accent-bright);
}

.outline-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 20px;
  color: var(--white);
  background: transparent;
  border: 1px solid var(--line-light);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.outline-button:hover,
.outline-button[aria-expanded="true"] {
  color: var(--ink);
  background: var(--white);
}

.settings-panel {
  margin: -16px 0 28px;
  padding: 20px;
  color: var(--ink);
  background: var(--paper-light);
}

.settings-panel[hidden] {
  display: none;
}

.settings-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.settings-head strong {
  font-size: 20px;
}

.settings-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.close-button,
.remove-rate {
  width: 32px;
  height: 32px;
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
}

.search-field {
  display: block;
  max-width: 460px;
  margin: 16px 0;
}

.search-field input {
  min-height: 46px;
  font-size: 16px;
}

.currency-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-height: 205px;
  overflow: auto;
}

.currency-option {
  display: flex;
  gap: 9px;
  align-items: center;
  min-height: 36px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}

.currency-option:has(input:checked) {
  color: var(--white);
  background: var(--accent);
  border-color: var(--accent);
}

.currency-option input {
  accent-color: var(--accent);
}

.currency-option.is-hidden {
  display: none;
}

.rates-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line-light);
  border-left: 1px solid var(--line-light);
}

.rate-card {
  min-height: 212px;
  padding: 19px;
  border-right: 1px solid var(--line-light);
  border-bottom: 1px solid var(--line-light);
}

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

.currency-code {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--accent-bright);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.remove-rate {
  color: rgba(255, 255, 255, 0.52);
  font-size: 21px;
}

.remove-rate:hover {
  color: var(--white);
}

.currency-name {
  min-height: 38px;
  margin: 18px 0 20px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 13px;
}

.rate-value {
  font-size: clamp(29px, 2.7vw, 40px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  white-space: nowrap;
}

.rate-unit {
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
}

.rates-note {
  min-height: 20px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.5);
  font-size: 12px;
}

.converter-section {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(480px, 1.15fr);
  gap: 64px;
  padding-top: 74px;
  padding-bottom: 74px;
}

.converter-intro p {
  max-width: 430px;
  margin: 22px 0 0;
  color: var(--muted);
}

.converter-card {
  padding: 26px;
  background: var(--paper-light);
  border: 1px solid var(--line);
}

.converter-field {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.converter-field input {
  min-height: 50px;
  font-size: 18px;
  font-weight: 700;
}

.amount-field input {
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.currency-selects {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr);
  gap: 14px;
  align-items: end;
  margin-top: 20px;
}

.currency-picker {
  position: relative;
}

.native-currency-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.currency-trigger {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 4px 0 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ink);
}

.currency-trigger:hover,
.currency-trigger:focus-visible,
.currency-trigger[aria-expanded="true"] {
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 var(--accent);
  outline: 0;
}

.trigger-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 30px;
  padding: 0 8px;
  color: var(--white);
  background: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.trigger-name {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trigger-arrow {
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  transition: transform 180ms ease;
}

.currency-trigger[aria-expanded="true"] .trigger-arrow {
  transform: rotate(180deg);
}

.currency-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 10px);
  left: 0;
  width: max(100%, 280px);
  padding: 9px;
  color: var(--ink);
  background: var(--paper-light);
  border: 1px solid var(--ink);
  box-shadow: 10px 12px 0 rgba(20, 40, 42, 0.12);
}

.currency-menu[hidden] {
  display: none;
}

.picker-search {
  display: block;
  padding: 0 8px 10px;
  border-bottom: 1px solid var(--line);
}

.picker-search input {
  width: 100%;
  min-height: 40px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14px;
  font-weight: 700;
}

.picker-search input::placeholder {
  color: var(--muted);
}

.picker-options {
  max-height: 210px;
  margin-top: 6px;
  overflow-y: auto;
  scrollbar-color: var(--accent) transparent;
  scrollbar-width: thin;
}

.picker-option {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 4px 7px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
}

.picker-option:hover,
.picker-option:focus-visible {
  background: rgba(57, 127, 118, 0.1);
  outline: 0;
}

.picker-option[aria-selected="true"] {
  color: var(--white);
  background: var(--accent);
}

.option-code {
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.option-name {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-check {
  color: var(--accent);
  font-weight: 900;
}

.picker-option[aria-selected="true"] .option-check {
  color: var(--accent-bright);
}

.swap-button {
  width: 40px;
  height: 40px;
  margin: 0 2px 6px;
  color: var(--white);
  background: var(--accent);
  border: 0;
  border-radius: 50%;
  font-size: 21px;
  transition: transform 180ms ease;
}

.swap-button:hover {
  transform: rotate(180deg);
}

.result-block {
  display: grid;
  gap: 5px;
  margin-top: 24px;
  padding: 21px;
  color: var(--white);
  background: var(--ink);
}

.result-block > span {
  color: var(--accent-bright);
}

.result-block strong {
  margin: 7px 0;
  font-size: clamp(29px, 3.4vw, 46px);
  line-height: 1.05;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}

.result-block small {
  color: rgba(255, 255, 255, 0.58);
}

.source-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  padding: 32px max(32px, calc((100vw - var(--max-width)) / 2));
  color: var(--white);
  background: var(--accent);
}

.source-strip div {
  display: grid;
  gap: 5px;
}

.source-strip span {
  color: rgba(255, 255, 255, 0.65);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.source-strip strong {
  font-size: clamp(18px, 2.3vw, 28px);
}

.source-strip a {
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

footer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 50px;
  align-items: end;
  padding: 24px max(32px, calc((100vw - var(--max-width)) / 2));
  color: rgba(255, 255, 255, 0.46);
  background: var(--ink-deep);
  font-size: 10px;
}

footer p {
  margin: 5px 0 0;
}

.footer-brand {
  color: var(--white);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 900px) {
  .hero-grid,
  .converter-section {
    grid-template-columns: 1fr;
  }

  .hero-grid {
    gap: 32px;
  }

  .hero-copy {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: end;
  }

  .hero-copy > p {
    margin-bottom: 0;
  }

  .rates-grid,
  .currency-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .converter-section {
    gap: 38px;
  }
}

@media (max-width: 620px) {
  .site-header,
  .hero,
  .converter-section {
    width: min(100% - 36px, var(--max-width));
  }

  .site-header {
    min-height: 58px;
  }

  .header-note {
    display: none;
  }

  .site-link {
    min-height: 38px;
    padding: 0 14px;
  }

  .site-link span {
    display: none;
  }

  .hero {
    padding-top: 40px;
  }

  h1 {
    font-size: clamp(46px, 15.2vw, 64px);
  }

  .hero-copy {
    grid-template-columns: 1fr;
  }

  .status-row {
    margin-top: 28px;
  }

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

  .section-heading {
    display: grid;
    margin-bottom: 28px;
  }

  .outline-button {
    justify-self: start;
  }

  .rates-grid,
  .currency-options {
    grid-template-columns: 1fr;
  }

  .rate-card {
    min-height: 178px;
  }

  .currency-name {
    min-height: auto;
    margin-bottom: 16px;
  }

  .converter-section {
    padding-top: 54px;
    padding-bottom: 54px;
  }

  .converter-card {
    padding: 19px;
  }

  .currency-selects {
    grid-template-columns: 1fr 40px;
  }

  .currency-selects .currency-picker:last-child {
    grid-column: 1 / -1;
  }

  .currency-menu {
    width: 100%;
  }

  .swap-button {
    grid-column: 2;
    grid-row: 1;
  }

  .source-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  footer {
    grid-template-columns: 1fr auto;
  }

  footer > p:nth-child(2) {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
