/* The public pages only, with no framework: a page that must open fast and be indexed does not pay
   for a library. base.css is shared with the app. */

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 var(--s-5); }
.wrap.narrow { max-width: 560px; }
.wrap.medium { max-width: 800px; }
.small { font-size: var(--fs-sm); }
.prose { max-width: var(--measure); }

.num { text-align: right; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: var(--s-6);
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
  letter-spacing: -0.015em;
}
.brand:hover { text-decoration: none; }

.nav { display: flex; gap: var(--s-5); flex: 1; }
.nav a { color: var(--text-muted); font-size: var(--fs-base); }
.nav a:hover { color: var(--accent); text-decoration: none; }

.topbar-actions { display: flex; align-items: center; gap: var(--s-3); }
.topbar-actions > a:not(.btn) { color: var(--text-muted); font-size: var(--fs-base); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--line-strong); }
.theme-toggle svg { display: block; }

/* "Follow the system" is the absent attribute, so three selectors and no media query; a light
   system and an explicit light look the same but are different choices. */
.theme-toggle .icon-light,
.theme-toggle .icon-dark { display: none; }
:root[data-theme="light"] .theme-toggle .icon-system { display: none; }
:root[data-theme="light"] .theme-toggle .icon-light { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-system { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-dark { display: block; }

/* <details>, not script: the converter must be reachable without JS. */
.nav-toggle { display: none; position: relative; }
.nav-toggle > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  color: var(--text-muted);
  cursor: pointer;
}
.nav-toggle > summary::-webkit-details-marker { display: none; }
.nav-toggle[open] > summary { color: var(--text); border-color: var(--line-strong); }
.nav-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--s-2));
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  padding: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-md);
  z-index: 30;
}
.nav-panel a { padding: var(--s-2) var(--s-2); border-radius: var(--r-control); color: var(--text); }
.nav-panel a:hover { background: var(--surface-hover); text-decoration: none; }
.nav-panel hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-2) 0; }

.footer {
  border-top: 1px solid var(--line);
  margin-top: var(--s-20);
  padding: var(--s-8) 0;
  background: var(--surface);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: var(--s-8);
  font-size: var(--fs-sm);
}
.footer h4 { margin: 0 0 var(--s-3); font-size: var(--fs-micro); text-transform: uppercase; letter-spacing: .07em; color: var(--text-subtle); font-weight: 600; }
.footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.footer a { color: var(--text-muted); }
.footer a:hover { color: var(--accent); }
.footer-note { color: var(--text-subtle); max-width: 40ch; margin: var(--s-3) 0 0; }

main { padding: var(--s-8) 0 var(--s-4); display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 9px var(--s-4);
  border-radius: var(--r-control);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--fs-base);
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-subtle); text-decoration: none; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--text-on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--text-on-accent); }

.btn-lg { padding: 12px var(--s-6); font-size: var(--fs-md); }
.btn-sm { padding: 5px var(--s-3); font-size: var(--fs-sm); }
.btn[disabled], .btn:disabled { opacity: .55; cursor: not-allowed; }

.cta-row { display: flex; gap: var(--s-3); flex-wrap: wrap; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: var(--s-5);
  margin-bottom: var(--s-4);
}
.card > :last-child { margin-bottom: 0; }

.section-title {
  font-size: var(--fs-micro);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-subtle);
  margin: 0 0 var(--s-4);
}

.field { display: flex; flex-direction: column; gap: var(--s-1); margin-bottom: var(--s-4); flex: 1; min-width: 0; }
.field > label { font-size: var(--fs-sm); font-weight: 500; color: var(--text-muted); }
.field small { font-size: var(--fs-xs); color: var(--text-subtle); }
.field.checkbox { flex-direction: row; align-items: center; gap: var(--s-2); }
.field.checkbox label { color: var(--text); font-weight: 400; }

.row { display: flex; gap: var(--s-4); flex-wrap: wrap; }
.row > * { flex: 1; min-width: 150px; }

input, select, textarea {
  font: inherit;
  font-size: var(--fs-base);
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  min-width: 0;
  transition: border-color .14s ease, box-shadow .14s ease;
}
input::placeholder, textarea::placeholder { color: var(--text-subtle); }
input:hover, select:hover, textarea:hover { border-color: var(--text-subtle); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input[type="checkbox"] { width: auto; accent-color: var(--accent); }
select { appearance: none; padding-right: var(--s-8); background-image: linear-gradient(45deg, transparent 50%, var(--text-subtle) 50%), linear-gradient(135deg, var(--text-subtle) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

.validation-message { color: var(--danger); font-size: var(--fs-sm); }
input[aria-invalid="true"], .invalid { border-color: var(--danger); }

.inline-form { display: flex; align-items: flex-end; gap: var(--s-3); margin: var(--s-4) 0 var(--s-5); flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; flex: 0 1 auto; }
.inline-form input { width: auto; }

.day-nav { display: flex; justify-content: space-between; gap: var(--s-3); margin: calc(-1 * var(--s-3)) 0 var(--s-5); font-size: var(--fs-sm); }
.day-nav a { color: var(--text-muted); text-decoration: none; }
.day-nav a:hover { color: var(--accent); }

/* Hidden from screen readers too, but not with display:none, which some bots skip. */

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.choice {
  display: block;
  position: relative;
  padding: var(--s-4);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-card);
  background: var(--surface);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease;
}
.choice:hover { border-color: var(--text-subtle); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-title { display: block; font-weight: 600; margin-bottom: var(--s-1); }
.choice-note { display: block; font-size: var(--fs-sm); color: var(--text-muted); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Toggled by the choice above without JS; the server still validates. */
.reg-form .reg-registered { display: none; }
.reg-form:has(#issuer-legal:checked) .reg-registered { display: block; }

.notice {
  border-radius: var(--r-control);
  padding: var(--s-3) var(--s-4);
  margin: var(--s-3) 0;
  font-size: var(--fs-base);
  border: 1px solid var(--line);
  background: var(--surface-sunken);
}
.notice-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.notice-warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.notice-ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.notice > :last-child { margin-bottom: 0; }

.table-scroll { margin: 0 calc(-1 * var(--s-5)); padding: 0 var(--s-5); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th {
  text-align: left;
  font-weight: 600;
  font-size: var(--fs-micro);
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-subtle);
  padding: var(--s-2) var(--s-3);
  border-bottom: 1px solid var(--line-strong);
  white-space: nowrap;
  background: var(--surface);
}
td { padding: var(--s-2) var(--s-3); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }

.rates { font-variant-numeric: tabular-nums; }

/* Sticky only where the table fits: inside overflow:auto, sticky binds to that box, and top:60px
   would cover the first rows. */
.rates thead th { position: sticky; top: 0; z-index: 1; }

@media (min-width: 1000px) {
  .table-scroll-rates { overflow-x: visible; }
  .table-scroll-rates .rates thead th { top: 60px; }
}
.rates tbody tr:hover { background: var(--surface-hover); }
.rates td:first-child { font-family: var(--font-mono); font-weight: 500; }

.hero { padding: var(--s-14) 0 var(--s-10); }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 420px); gap: var(--s-14); align-items: center; }
.hero h1 { font-size: var(--fs-3xl); max-width: 15ch; margin-bottom: var(--s-4); }
.hero .lead { font-size: var(--fs-md); color: var(--text-muted); max-width: 46ch; margin-bottom: var(--s-6); }
.hero-note { margin-top: var(--s-4); color: var(--text-subtle); font-size: var(--fs-sm); }

.eyebrow {
  display: inline-flex; align-items: center; gap: var(--s-2);
  font-size: var(--fs-micro); font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin-bottom: var(--s-4);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); }

.doc-preview { position: relative; container-type: inline-size; }
.doc {
  aspect-ratio: 1 / 1.414;
  background: var(--neutral-0);
  color: var(--neutral-900);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  box-shadow: var(--shadow-md);
  padding: 7% 7% 0;
  font-size: clamp(5.5px, 2.05cqw, 9.5px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4.5%;
}
.doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8%; }
/* Height in em like the rest of the mock-up, so it scales with the paper. */
.doc-logo {
  display: block;
  height: 2.4em; width: auto;
  margin-bottom: .6em;
}
.doc-title { font-weight: 600; font-size: 1.9em; letter-spacing: -0.01em; line-height: 1.15; }
.doc-num { font-family: var(--font-mono); font-size: 1.25em; color: var(--accent-700); }
.doc-meta { text-align: right; color: var(--neutral-600); line-height: 1.5; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 6%; }
.doc-party { border-top: 1px solid var(--neutral-300); padding-top: 3%; }
.doc-label { display: block; font-size: .85em; text-transform: uppercase; letter-spacing: .09em; color: var(--neutral-500); margin-bottom: .5em; }
.doc-name { font-weight: 600; }
.doc-party span { display: block; color: var(--neutral-600); line-height: 1.5; }
.doc-lines { width: 100%; border-collapse: collapse; font-size: 1em; }
.doc-lines th { font-size: .85em; padding: .5em .3em; border-bottom: 1px solid var(--neutral-800); color: var(--neutral-600); background: none; letter-spacing: .05em; }
.doc-lines td { padding: .55em .3em; border-bottom: 1px solid var(--neutral-200); color: var(--neutral-800); }
.doc-totals { margin-left: auto; width: 58%; display: flex; flex-direction: column; gap: .35em; }
.doc-totals div { display: flex; justify-content: space-between; color: var(--neutral-600); font-variant-numeric: tabular-nums; }
.doc-totals .grand { border-top: 2px solid var(--accent-700); margin-top: .3em; padding-top: .45em; color: var(--accent-700); font-weight: 600; font-size: 1.2em; }
.doc-words { border-top: 1px solid var(--neutral-200); padding-top: 3%; color: var(--neutral-600); font-style: italic; }
.doc-foot { margin-top: auto; padding-bottom: 6%; display: flex; flex-direction: column; gap: .6em; color: var(--neutral-600); }
.doc-foot .doc-clause { border-left: 2px solid var(--accent-200); padding-left: .8em; }
.doc-sign { display: flex; justify-content: space-between; align-items: flex-end; gap: 8%; color: var(--neutral-500); }
.doc-sign i { display: block; width: 34%; border-top: 1px solid var(--neutral-300); padding-top: .4em; text-align: center; font-style: normal; }
/* As the PDF footer: present, not advertising. */
.doc-made { text-align: right; font-size: .85em; color: var(--neutral-500); }

.doc-callout {
  position: absolute;
  display: none;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: var(--s-1) var(--s-3);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}
.doc-callout::after { content: ""; position: absolute; height: 1px; background: var(--line-strong); }
.doc-callout-a { top: 26%; right: calc(100% - var(--s-5)); }
.doc-callout-a::after { left: 100%; width: var(--s-10); }
.doc-callout-b { top: 70%; right: calc(100% - var(--s-8)); }
.doc-callout-b::after { left: 100%; width: var(--s-6); }

@media (min-width: 1100px) { .doc-callout { display: inline-flex; } }

.band-head { max-width: var(--measure); margin: 0 auto var(--s-8); text-align: center; }
.band-head h2 { font-size: var(--fs-xl); }
.band-head p { color: var(--text-muted); margin: 0; }

.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-4); }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s-5); }
.feature h3 { margin-bottom: var(--s-2); }
.feature p { margin: 0; color: var(--text-muted); font-size: var(--fs-sm); }
.feature-mark { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-control); background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s-3); }

section.slab { padding: var(--s-14) 0; }
section.slab-alt { background: var(--surface); border-block: 1px solid var(--line); }

.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s-4); max-width: 780px; margin: 0 auto; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }
.plan-featured { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.plan-name { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.plan-name h3 { margin: 0; }
.plan-price { font-size: var(--fs-lg); font-weight: 600; }
.plan-price small { font-size: var(--fs-sm); font-weight: 400; color: var(--text-muted); }
.plan ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-sm); color: var(--text-muted); flex: 1; }
.plan li { display: flex; gap: var(--s-2); align-items: flex-start; }
.plan li::before { content: "—"; color: var(--text-subtle); flex: none; }
.plan .btn { width: 100%; }
.band-foot { text-align: center; max-width: 60ch; margin: var(--s-5) auto 0; }
.tag { display: inline-block; font-size: var(--fs-micro); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; padding: 2px var(--s-2); border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); }

/* Currency names are long ("BAM - konvertibilna marka"), so the dropdowns get more room. */
.converter-form {
  display: grid;
  grid-template-columns: minmax(100px, .7fr) minmax(200px, 1.2fr) minmax(200px, 1.2fr) minmax(150px, 1fr);
  gap: var(--s-4);
  align-items: end;
}
.converter-form .field { margin-bottom: 0; }
.converter-form .btn { grid-column: 1 / -1; justify-self: start; }

.result-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s-8) var(--s-6); margin-bottom: var(--s-4); text-align: center; }
.result-main { display: flex; align-items: baseline; justify-content: center; gap: var(--s-4); flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.result-from { font-size: var(--fs-lg); color: var(--text-muted); }
.result-eq { color: var(--text-subtle); }
.result-to { font-size: var(--fs-2xl); font-weight: 600; color: var(--accent); letter-spacing: -0.02em; }
.result-meta { margin: var(--s-4) 0 0; font-size: var(--fs-sm); color: var(--text-muted); }

/* One measure-limited column: terms nobody can read are terms nobody has read. */

.legal { max-width: 68ch; margin: var(--s-10) auto var(--s-14); }
.legal h1 { font-size: var(--fs-xl); margin-bottom: var(--s-2); }
.legal h2 { font-size: var(--fs-md); margin: var(--s-8) 0 var(--s-3); }
.legal p, .legal li { color: var(--text-muted); line-height: 1.7; }
.legal ul { padding-left: var(--s-5); display: flex; flex-direction: column; gap: var(--s-2); margin: var(--s-3) 0; }
.legal strong { color: var(--text); }

.auth { max-width: 440px; margin: var(--s-10) auto var(--s-14); }
.auth h1 { font-size: var(--fs-xl); text-align: center; }
.auth > p { text-align: center; color: var(--text-muted); margin-bottom: var(--s-6); }
.auth .card { padding: var(--s-6); }
.auth .btn { width: 100%; }
.auth-alt { text-align: center; color: var(--text-muted); font-size: var(--fs-sm); margin-top: var(--s-4); }
.auth-wide { max-width: 620px; }

/* White with a border, as Google's button guidelines ask. */
.btn-google {
  width: 100%;
  justify-content: center;
  gap: var(--s-3);
  background: var(--neutral-0);
  color: var(--neutral-800);
  border: 1px solid var(--line-strong);
  font-weight: 500;
}

.btn-google:hover { background: var(--neutral-50); }

/* Google's dark variant (#131314 ground, #E3E3E3 text, #8E918F edge, the G in full colour), not
   our accent. The system preference unless an explicit light overrides it, and the explicit dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn-google {
    background: #131314;
    color: #E3E3E3;
    border-color: #8E918F;
  }

  :root:not([data-theme="light"]) .btn-google:hover { background: #1E1F20; }
}

:root[data-theme="dark"] .btn-google {
  background: #131314;
  color: #E3E3E3;
  border-color: #8E918F;
}

:root[data-theme="dark"] .btn-google:hover { background: #1E1F20; }

.google-mark { flex: none; }

/* "or" between Google and the form. */
.auth-or {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-5) 0;
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.form-divider { border: 0; border-top: 1px solid var(--line); margin: var(--s-5) 0; }

.blank { text-align: center; padding: var(--s-20) 0; }
.blank h1 { font-size: var(--fs-2xl); }
.blank p { color: var(--text-muted); }
.blank .prose { margin-inline: auto; }
.blank .cta-row { justify-content: center; }

@media (max-width: 1000px) {
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-8); }
  .hero h1 { max-width: none; }
  .doc-preview { max-width: 420px; }
}

@media (max-width: 860px) {
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-note { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .converter-form { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .converter-form .btn { justify-self: stretch; }
}

@media (max-width: 700px) {
  .features { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  .nav, .topbar-actions > a:not(.btn) { display: none; }
  .nav-toggle { display: block; }
  .topbar-inner { gap: var(--s-3); justify-content: space-between; }
  .hero { padding: var(--s-8) 0; }
  main { padding-top: var(--s-6); }
  section.slab { padding: var(--s-10) 0; }
  .rates thead th { position: static; }
}
