/* AmateurRad.io — mobile-first, light/dark via prefers-color-scheme */

:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --text: #101828;
  --muted: #5b6472;
  --border: #d9e0ea;
  --accent: #d9480f;
  --accent-contrast: #ffffff;
  --accent-soft: #fff0e6;
  --link: #1d4ed8;
  --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 4px 16px rgba(16, 24, 40, 0.06);
  --radius: 12px;
  --nav-height: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #121b2e;
    --surface-2: #1a2540;
    --text: #e6ebf4;
    --muted: #94a0b5;
    --border: #263352;
    --accent: #fb923c;
    --accent-contrast: #201205;
    --accent-soft: #2a1c10;
    --link: #7ea6ff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

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

.container {
  width: min(1100px, 100% - 2.5rem);
  margin-inline: auto;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.3rem, 3vw, 1.75rem);
}

p {
  margin: 0 0 1rem;
}

/* ---------- Navigation ---------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand:hover {
  text-decoration: none;
}

.brand svg {
  width: 26px;
  height: 26px;
  flex: none;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  cursor: pointer;
  color: var(--text);
}

.nav-toggle svg {
  display: block;
  width: 22px;
  height: 22px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
}

.nav-links a:hover {
  color: var(--text);
  background: var(--surface-2);
  text-decoration: none;
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: inline-block;
  }

  .nav-links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.25rem 1rem;
    box-shadow: var(--shadow);
    display: none;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    padding: 0.7rem 0.8rem;
  }
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(2.5rem, 8vw, 5rem) 0 clamp(2rem, 6vw, 3.5rem);
  text-align: center;
}

.hero .lead {
  max-width: 42rem;
  margin: 0.75rem auto 1.75rem;
  font-size: clamp(1.05rem, 2.5vw, 1.25rem);
  color: var(--muted);
}

/* ---------- Buttons & cards ---------- */

.btn {
  display: inline-block;
  padding: 0.8rem 1.6rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}

.btn-primary:hover {
  text-decoration: none;
  filter: brightness(1.08);
}

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  text-decoration: none;
  background: var(--surface-2);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding-bottom: 3rem;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  text-decoration: none;
}

.card h3 {
  margin-bottom: 0.4rem;
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

.card .count {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
}

/* ---------- Pages ---------- */

.page {
  padding: 2.25rem 0 3.5rem;
}

.page > .container > p.intro {
  max-width: 46rem;
  color: var(--muted);
}

.well {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
}

@media (max-width: 720px) {
  .well {
    padding: 1.1rem 1.15rem;
  }
}

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 1rem 1rem 1rem 3.5rem;
  background: var(--surface-2);
  border-radius: var(--radius);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 1rem;
  top: 1rem;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Data table controls ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0;
}

.controls input[type="search"],
.controls select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.85rem;
}

.controls input[type="search"] {
  flex: 1 1 220px;
}

.controls input:focus,
.controls select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 0;
  border-color: transparent;
}

.result-count {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.75rem;
}

/* ---------- Data tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  min-width: 640px;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table thead th {
  background: var(--surface-2);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  white-space: nowrap;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr {
  cursor: default;
}

.data-table tbody tr.clickable {
  cursor: pointer;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.data-table th.sortable:hover {
  color: var(--text);
}

.data-table th .arrow {
  display: inline-block;
  width: 1em;
  color: var(--accent);
}

.data-table td.num {
  white-space: nowrap;
}

.data-table .url-cell a {
  word-break: break-all;
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  .table-wrap {
    border: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .data-table {
    min-width: 0;
  }

  .data-table thead {
    display: none;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table tr {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: 0.9rem;
    padding: 0.4rem 1rem;
  }

  .data-table td {
    border-bottom: 1px solid var(--border);
    padding: 0.55rem 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    overflow-wrap: anywhere;
  }

  .data-table td:last-child {
    border-bottom: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    flex: none;
  }

  .data-table .url-cell {
    justify-content: flex-end;
  }
}

/* ---------- Detail panel ---------- */

.detail-panel {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.detail-panel.open {
  display: block;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.detail-head h2 {
  margin: 0;
}

.detail-close {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.detail-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.9rem 1.5rem;
}

.detail-grid dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.detail-grid dd {
  margin: 0.1rem 0 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 0 2rem;
  margin-top: auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer nav {
  margin-top: 0.4rem;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
}

.site-footer a {
  color: var(--muted);
}

.site-footer a:hover,
.site-footer a[aria-current="page"] {
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

/* ---------- 404 ---------- */

.notfound {
  text-align: center;
  padding: 5rem 0;
}

.notfound .code {
  font-size: clamp(3rem, 12vw, 5rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}
