:root {
  --bg: #f4f5f7;
  --bg-elevated: #ffffff;
  --bg-dark: #1c2330;
  --text: #1a1f29;
  --text-muted: #5b6474;
  --text-on-dark: #c9d1de;
  --border: #dde1e7;
  --accent: #1e4fd8;
  --accent-hover: #1a44ba;
  --accent-soft: #e3eafc;
  --accent-text: #1a44ba;
  --heart: #c62828;
  --soon: #8a5300;
  --soon-soft: #fff1dc;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .08);
  --font: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --radius: 6px;
  --radius-lg: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181e;
    --bg-elevated: #1e2229;
    --bg-dark: #0f1217;
    --text: #e6e9ef;
    --text-muted: #a3acbb;
    --text-on-dark: #aab3c2;
    --border: #2c323c;
    --accent: #5b8aff;
    --accent-hover: #759dff;
    --accent-soft: #1f2a45;
    --accent-text: #8fb0ff;
    --heart: #ef5350;
    --soon: #e0a030;
    --soon-soft: #3a2f16;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}

/* One page, two languages: the inactive one is hidden. */
html[lang="en"] [lang="lv"], html[lang="lv"] [lang="en"] { display: none !important; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.15rem; }
p { margin: 0; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--text-muted); }
section { padding: 72px 0; }
.section-head { max-width: 680px; margin-bottom: 36px; }
.section-head p { margin-top: 10px; color: var(--text-muted); font-size: 1.08rem; }
/* Pixel art stays sharp at any size. */
.pixel { image-rendering: pixelated; }

/* Header */
header {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg-dark) 94%, transparent);
  backdrop-filter: blur(8px);
  color: #fff;
}
.bar { display: flex; align-items: center; gap: 24px; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 600; font-size: 1.1rem; }
.brand img { width: 32px; height: 32px; }
nav.links { display: flex; gap: 20px; margin-left: auto; }
nav.links a { color: var(--text-on-dark); text-decoration: none; font-size: .95rem; }
nav.links a:hover { color: #fff; }
.lang { display: flex; border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--radius); overflow: hidden; }
.lang button { background: none; border: 0; color: var(--text-on-dark); font: inherit; font-size: .85rem; font-weight: 600; padding: 4px 10px; cursor: pointer; }
.lang button[aria-pressed="true"] { background: rgba(255, 255, 255, .16); color: #fff; }
nav.links a[aria-current="page"] { color: #fff; font-weight: 600; }
/* Phones: the menu moves to its own scrollable row under the logo. */
@media (max-width: 720px) {
  .bar { flex-wrap: wrap; height: auto; gap: 0 16px; padding-top: 10px; }
  .lang { margin-left: auto; }
  nav.links { order: 3; width: 100%; margin: 0; padding: 10px 0 12px; overflow-x: auto; gap: 22px; white-space: nowrap; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px; border-radius: var(--radius);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: background-color .15s, border-color .15s;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.secondary { background: var(--bg-elevated); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { border-color: var(--text-muted); }
.btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .3); }
.btn.ghost:hover { border-color: #fff; }
.btn.big { padding: 15px 28px; font-size: 1.08rem; }
.btn:focus-visible, .lang button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Hero */
.hero { padding: 56px 0 72px; background: var(--bg-dark); color: #fff; }
.hero .wrap { display: grid; gap: 40px; align-items: center; }
@media (min-width: 900px) { .hero .wrap { grid-template-columns: 1.2fr 1fr; } }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; }
.hero .lead { margin-top: 18px; max-width: 620px; font-size: clamp(1.05rem, 2vw, 1.22rem); color: var(--text-on-dark); }
.cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero-logo { width: 100%; max-width: 440px; margin: 0 auto; }

/* Projects */
.projects { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.project { display: flex; flex-direction: column; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow); }
.project .top { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.project .top img { width: 72px; height: 72px; flex: none; }
.tag { display: inline-block; margin-top: 4px; padding: 1px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: .82rem; font-weight: 600; }
.tag.soon { background: var(--soon-soft); color: var(--soon); }
.project p { color: var(--text-muted); }
.project .btn { margin-top: auto; align-self: flex-start; }
.project p + .btn, .project p + .later { margin-top: 20px; }
.later { color: var(--text-muted); font-size: .95rem; font-style: italic; }

/* About */
.alt-bg { background: var(--bg-elevated); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.about { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) { .about { grid-template-columns: 160px 1fr; } }
.about img { width: 160px; height: 160px; }
.about p { margin-top: 12px; color: var(--text-muted); font-size: 1.08rem; max-width: 720px; }

/* Support */
.donate { text-align: center; }
.donate .heart { width: 52px; height: 52px; margin: 0 auto 18px; color: var(--heart); }
.donate p { max-width: 620px; margin: 14px auto 0; color: var(--text-muted); font-size: 1.08rem; }
.donate .btn { margin-top: 28px; }

footer { padding: 36px 0 48px; color: var(--text-muted); font-size: .92rem; border-top: 1px solid var(--border); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }
footer a { color: inherit; }
footer .links { display: flex; flex-wrap: wrap; gap: 8px 20px; }

/* Inner pages (About, Contact, Privacy) */
.page-hero { padding: 48px 0 40px; background: var(--bg-dark); color: #fff; }
.page-hero p { margin-top: 12px; max-width: 680px; color: var(--text-on-dark); font-size: 1.12rem; }
.page-hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); letter-spacing: -.02em; }
.prose { max-width: 720px; padding: 48px 16px 72px; }
.prose h2 { font-size: 1.45rem; margin-top: 40px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose ul { margin-top: 12px; color: var(--text-muted); font-size: 1.06rem; }
.prose ul { padding-left: 1.3em; }
.prose li + li { margin-top: 6px; }
.prose strong { color: var(--text); }
.updated { font-size: .95rem; }
.contact-card { margin-top: 20px; padding: 22px 24px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.contact-card p:first-child { margin-top: 0; }
.contact-card .email { display: inline-block; margin-top: 6px; font-size: 1.2rem; font-weight: 600; word-break: break-all; }

/* Articles list on the home page */
.articles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.article { display: block; padding: 20px 22px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); color: inherit; text-decoration: none; transition: border-color .15s; }
.article:hover { border-color: var(--accent); }
.article .from { font-size: .82rem; font-weight: 600; color: var(--accent-text); text-transform: uppercase; letter-spacing: .04em; }
.article h3 { margin-top: 6px; }
.article p { margin-top: 8px; color: var(--text-muted); }
.more-link { margin-top: 18px; }
