/* ============================================================
   Agregador — stylesheet
   Restrained, typographic, considered.
   ============================================================ */

:root {
  /* Surfaces */
  --paper:      #f6f2ec;   /* warm off-white, not pure */
  --paper-2:    #efeae2;   /* slightly deeper for hover/track */
  --card:       #ffffff;
  --ink:        #1a1714;   /* near-black with a touch of brown */
  --ink-2:      #3d3731;   /* secondary text */
  --muted:      #7a6f64;   /* tertiary */
  --faint:      #b5ac9f;   /* meta/disabled */
  --rule:       #e4ddd1;   /* hairline borders */
  --rule-2:     #d8cfc0;   /* slightly stronger */

  /* Accent — muted clay-red. Used sparingly. */
  --accent:     #b5391c;
  --accent-ink: #8a2a11;

  /* Semantic */
  --positive:   #3f6b3a;

  /* Typography */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Rhythm */
  --radius: 4px;
  --radius-lg: 8px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
}

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

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

input {
  font: inherit;
  color: inherit;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 32px;
}

.mono { font-family: var(--mono); font-feature-settings: "tnum"; }

/* ============================================================
   Header
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 15px;
  color: var(--ink);
}

.brand-mark {
  display: inline-block;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
  transform: rotate(45deg);
}

.site-nav {
  display: flex;
  gap: 28px;
}

.site-nav a {
  font-size: 14px;
  color: var(--ink-2);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color .15s, border-color .15s;
}

.site-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ============================================================
   Intro
   ============================================================ */
.intro {
  padding: 72px 32px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 64px;
  align-items: end;
}

.kicker {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 24px;
}

.intro-lead h1 {
  font-size: clamp(32px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 600;
  max-width: 16ch;
  margin-bottom: 20px;
}

.lede {
  font-size: 16px;
  color: var(--ink-2);
  max-width: 52ch;
  line-height: 1.6;
}

.intro-meta {
  display: flex;
  gap: 40px;
  padding-bottom: 4px;
}

.intro-meta > div {
  border-left: 1px solid var(--rule-2);
  padding-left: 14px;
}

.intro-meta dt {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 4px;
}

.intro-meta dd {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--ink);
  font-feature-settings: "tnum";
}

/* ============================================================
   Exchange block
   ============================================================ */
.exchange {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  padding-bottom: 96px;
  align-items: start;
}

/* Card */
.exchange-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 8px;
}

/* Field */
.field {
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
}

.field:last-of-type { border-bottom: none; }

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.field-label label {
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.quick-amounts {
  display: flex;
  gap: 2px;
}

.quick-amounts button {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 3px;
  transition: color .12s, background .12s;
}

.quick-amounts button:hover {
  color: var(--ink);
  background: var(--paper-2);
}

.best-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.best-note span { color: var(--ink); font-weight: 500; }

.field-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

#from-amount,
.amount-out {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -0.02em;
  font-feature-settings: "tnum";
  background: transparent;
  border: none;
  outline: none;
  padding: 0;
}

#from-amount::-webkit-outer-spin-button,
#from-amount::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
#from-amount[type=number] { -moz-appearance: textfield; }

.amount-out {
  min-height: 36px;
  display: flex;
  align-items: center;
}

/* Coin select */
.coin-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 8px 12px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  transition: border-color .12s, background .12s;
}

.coin-select:hover {
  border-color: var(--rule-2);
  background: var(--paper-2);
}

.coin-symbol {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.01em;
}

.chev {
  color: var(--muted);
  flex-shrink: 0;
}

.field-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

/* Divider with swap button */
.swap-divider {
  height: 1px;
  background: var(--rule);
  margin: 0 20px;
  position: relative;
}

.swap-direction {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--rule-2);
  color: var(--ink-2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, border-color .15s, background .15s;
}

.swap-direction:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--card);
}

/* Address */
.address {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  padding: 0;
}

.address::placeholder {
  color: var(--faint);
}

/* Trade button */
.trade-btn {
  display: block;
  width: calc(100% - 16px);
  margin: 8px;
  padding: 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: background .15s;
}

.trade-btn:hover {
  background: var(--accent);
}

.trade-btn:active {
  background: var(--accent-ink);
}

/* ============================================================
   Quotes list (aside)
   ============================================================ */
.quotes {
  padding-top: 4px;
}

.quotes-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}

.quotes-head h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.quotes-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

.quotes-list {
  list-style: none;
  counter-reset: q;
}

.quote-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background .12s;
  margin: 0 -12px;
  padding-left: 12px;
  padding-right: 12px;
  border-radius: var(--radius);
}

.quote-row:hover {
  background: var(--paper-2);
}

.quote-num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  font-feature-settings: "tnum";
}

.quote-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.quote-provider {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.quote-name {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.005em;
}

.quote-tag {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.quote-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

.quote-out {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.quote-amount {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  font-feature-settings: "tnum";
  letter-spacing: -0.005em;
}

.quote-delta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

.quote-row.is-best .quote-num {
  color: var(--accent);
}

.quote-row.is-best .quote-delta {
  color: var(--positive);
}

/* ============================================================
   Info (three columns)
   ============================================================ */
.info {
  padding: 72px 32px;
  border-top: 1px solid var(--rule);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 56px;
}

.info-grid h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 10px;
  position: relative;
  padding-top: 16px;
}

.info-grid h3::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 18px;
  height: 1px;
  background: var(--accent);
}

.info-grid p {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.65;
  max-width: 38ch;
}

/* ============================================================
   FAQ
   ============================================================ */
.faq {
  padding: 72px 32px 96px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 80px;
  align-items: start;
}

.faq h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 600;
  line-height: 1.1;
}

.faq-list {
  display: flex;
  flex-direction: column;
}

.faq-list details {
  border-top: 1px solid var(--rule);
  padding: 20px 0;
}

.faq-list details:last-child {
  border-bottom: 1px solid var(--rule);
}

.faq-list summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.faq-list summary::-webkit-details-marker { display: none; }

.faq-list summary::after {
  content: '';
  width: 10px;
  height: 10px;
  border-right: 1px solid var(--ink-2);
  border-bottom: 1px solid var(--ink-2);
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .2s;
  flex-shrink: 0;
  margin-left: 20px;
}

.faq-list details[open] summary::after {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.faq-body {
  padding-top: 14px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.65;
  max-width: 62ch;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px 0;
}

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

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.footer-nav {
  display: flex;
  gap: 24px;
}

.footer-nav a {
  font-size: 13px;
  color: var(--ink-2);
  transition: color .12s;
}

.footer-nav a:hover { color: var(--accent); }

.footer-note {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  font-feature-settings: "tnum";
}

/* ============================================================
   Sheet (coin picker)
   ============================================================ */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.sheet.is-open { display: flex; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 23, 20, 0.32);
}

.sheet-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 72vh;
  background: var(--card);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 48px -20px rgba(26, 23, 20, 0.25);
}

.sheet-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-head h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.sheet-close {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  border-radius: 3px;
  transition: color .12s, background .12s;
}

.sheet-close:hover { color: var(--ink); background: var(--paper-2); }

.sheet-search {
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule);
}

.sheet-search input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
}

.sheet-search input::placeholder { color: var(--faint); }

.sheet-list {
  overflow-y: auto;
  padding: 6px 0;
}

.sheet-list::-webkit-scrollbar { width: 4px; }
.sheet-list::-webkit-scrollbar-thumb { background: var(--rule-2); border-radius: 2px; }

.coin-row {
  width: 100%;
  padding: 10px 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  transition: background .1s;
}

.coin-row:hover { background: var(--paper-2); }

.coin-row[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.coin-row-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.coin-row-ticker {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.005em;
  min-width: 44px;
}

.coin-row-name {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coin-row-price {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  font-feature-settings: "tnum";
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 920px) {
  .wrap { padding: 0 24px; }

  .intro {
    grid-template-columns: 1fr;
    gap: 36px;
    padding: 48px 24px;
  }

  .intro-meta {
    gap: 32px;
    flex-wrap: wrap;
  }

  .exchange {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 64px;
  }

  .info { padding: 56px 24px; }
  .info-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .faq {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 56px 24px 72px;
  }

  .site-nav { gap: 18px; }
  .site-nav a { font-size: 13px; }
}

@media (max-width: 520px) {
  #from-amount,
  .amount-out { font-size: 22px; }
  .intro-lead h1 { font-size: 30px; }
  .site-nav { display: none; }
  .quick-amounts { display: none; }
}
