:root {
  --bg: #0f1114;
  --bg-raised: #171a1f;
  --bg-panel: #1e2228;
  --border: #2e343d;
  --border-strong: #3a424e;
  --text: #c8cdd4;
  --text-muted: #7a828e;
  --text-bright: #eef0f3;
  --link: #5ea8e8;
  --link-hover: #8ec4f5;
  --accent: #3d8fd4;
  --accent-muted: #2a6496;
  --ok: #3a9e62;
  --warn: #b8922a;
  --alarm: #c44e4e;
  --font: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Consolas", "Courier New", monospace;
  --radius: 3px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font-size: 15px;
}

a {
  color: var(--link);
}

a:hover {
  color: var(--link-hover);
}

/* ---- site nav ---- */

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

.site-nav-inner {
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 42px;
}

.site-nav .brand {
  color: var(--text-bright);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

.site-nav .brand span {
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 6px;
}

.site-nav-links {
  display: flex;
  gap: 18px;
  list-style: none;
}

.site-nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
}

.site-nav-links a:hover {
  color: var(--text-bright);
}

/* ---- hero ---- */

.hero {
  position: relative;
  width: 100%;
  height: 320px;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 28px;
  border-bottom: 1px solid var(--border);
}

.hero img,
.hero > a img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15, 17, 20, 0.95) 0%,
    rgba(15, 17, 20, 0.55) 45%,
    rgba(15, 17, 20, 0.25) 100%
  );
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  gap: 24px;
}

.hero-left {
  max-width: 58%;
}

.hero-left h1 {
  font-size: 1.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.hero-left p {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 52ch;
}

.hero-right {
  max-width: 300px;
  background: rgba(23, 26, 31, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 0.82rem;
}

.hero-right h2 {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.hero-right ul {
  list-style: none;
  color: var(--text);
}

.hero-right li {
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}

.hero-right li:last-child {
  border-bottom: none;
}

.hero-right li::before {
  content: "› ";
  color: var(--accent);
}

/* ---- layout ---- */

.container {
  max-width: 1060px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  flex: 1;
  width: 100%;
}

.page-toolbar {
  margin-bottom: 20px;
}

/* ---- search ---- */

.search-wrapper {
  margin: 0 0 28px;
  max-width: 420px;
}

.search-wrapper label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.search-wrapper input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-raised);
  color: var(--text-bright);
  outline: none;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.15s;
}

.search-wrapper input:focus {
  border-color: var(--accent-muted);
}

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

/* ---- index cards ---- */

.cards-wrapper {
  margin-top: 8px;
}

.cards-wrapper .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.cards-wrapper .card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.15s;
}

.cards-wrapper .card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--border);
}

.cards-wrapper .card > a:last-child,
.cards-wrapper .card a:not(:has(img)) {
  display: block;
  padding: 10px 12px;
  color: var(--link);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.cards-wrapper .card:hover {
  border-color: var(--border-strong);
}

.cards-wrapper .card:hover > a:last-child {
  color: var(--link-hover);
}

.cards-wrapper .card.highlight {
  border-color: var(--accent-muted);
  background: var(--bg-panel);
}

.cards-wrapper .card:has(a[href=""]),
.cards-wrapper .card:has(a[href="#"]:not(:only-child)) {
  opacity: 0.45;
}

/* ---- content pages ---- */

.content-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 24px;
}

.content-card > h3,
.content-card > h2 {
  color: var(--text-bright);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.content-card p {
  margin-bottom: 10px;
}

.content-card ul,
.content-card ol {
  margin: 8px 0 12px 22px;
}

.content-card li {
  margin-bottom: 4px;
}

.content-card b,
.content-card strong {
  color: var(--text-bright);
  font-weight: 600;
}

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

table,
.points-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table th,
table td,
.points-table th,
.points-table td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
}

table th,
.points-table th {
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

table tr:nth-child(even),
.points-table tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

table tr:hover,
.points-table tr:hover {
  background: rgba(255, 255, 255, 0.04);
}

/* ---- buttons ---- */

.back-button {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}

.back-button:hover {
  color: var(--text-bright);
  border-color: var(--border-strong);
}

.footer-buttons a {
  text-decoration: none;
}

.footer-buttons button {
  background: var(--bg-panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  margin: 4px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.footer-buttons button:hover {
  background: var(--bg-raised);
  border-color: var(--border-strong);
  color: var(--text-bright);
}

/* ---- forms (calculator etc.) ---- */

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.form-field label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-input {
  padding: 7px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-bright);
  width: 130px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent-muted);
}

.result-highlight {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ok);
  font-family: var(--font-mono);
  margin-bottom: 16px;
}

.result-text {
  font-size: 0.95rem;
  font-family: var(--font-mono);
  color: var(--text);
}

.section-divider {
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 16px;
}

.section-divider h3 {
  border: none;
  padding-bottom: 0;
  margin-bottom: 12px;
}

/* ---- footer ---- */

footer {
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  padding: 20px 24px;
  text-align: center;
  margin-top: auto;
}

.footer-content {
  max-width: 1060px;
  margin: 0 auto;
}

.footer-content > p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ---- responsive ---- */

@media (max-width: 720px) {
  .hero {
    height: auto;
    min-height: 240px;
    padding: 16px;
    align-items: flex-end;
  }

  .hero-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-left,
  .hero-right {
    max-width: 100%;
  }

  .hero-left h1 {
    font-size: 1.45rem;
  }

  .site-nav-links {
    display: none;
  }

  .content-card {
    padding: 18px 16px;
  }
}
