/* ---------- Värvid ---------- */
:root {
  color-scheme: light dark;
  --bg: #fafaf7;
  --fg: #1c1c1a;
  --muted: #55554f;   /* 7,18:1 taustal, 7,50:1 kaardil */
  --line: #e4e4de;
  --accent: #2f6f5e;  /* 5,65:1 taustal */
  --card: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121413;
    --fg: #ecece6;
    --muted: #b3b3ab; /* 8,77:1 taustal, 8,22:1 kaardil */
    --line: #2a2d2b;
    --accent: #6fcfb0; /* 9,89:1 taustal */
    --card: #181b1a;
  }
}
/* Suurendatud kontrast: jooned peavad olema nähtavad (>= 3:1) */
@media (prefers-contrast: more) {
  :root { --line: #8a8a82; --muted: #3f3f3a; }
}
@media (prefers-contrast: more) and (prefers-color-scheme: dark) {
  :root { --line: #6f736f; --muted: #d0d0c8; }
}

/* ---------- Alus ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  /* 17 px vaikimisi, aga skaleerub brauseri tekstisuuruse seadega */
  font: 1.0625rem/1.65 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ---------- Päis ja menüü ---------- */
header.site { border-bottom: 1px solid var(--line); }
header.site .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 4px 16px; flex-wrap: wrap;
  padding-top: 6px; padding-bottom: 6px;
}
.brand {
  display: inline-block; padding: 12px 0;
  font-weight: 700; color: var(--fg); letter-spacing: -0.01em;
}
nav { display: flex; flex-wrap: wrap; }
/* Puuteala vähemalt 44 px kõrge (Apple: vaikesuurus 44x44) */
nav a {
  display: inline-block; padding: 12px 10px; min-height: 44px;
  color: var(--muted); font-size: 0.9375rem; line-height: 1.5;
}
nav a:hover { color: var(--fg); }
nav a[aria-current="page"] {
  color: var(--fg); font-weight: 600;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.35em;
}

/* ---------- Avaleht ---------- */
.hero { padding: 72px 0 40px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.15; margin: 0 0 16px; letter-spacing: -0.02em; }
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 34em; margin: 0 0 24px; }
.btn {
  display: inline-block; padding: 12px 20px; min-height: 44px; border-radius: 8px;
  border: 1px solid var(--accent); color: var(--accent); font-weight: 600; font-size: 0.9375rem; line-height: 1.5;
  transition: background-color .15s, color .15s, opacity .15s;
}
.btn:hover { background: var(--accent); color: var(--bg); text-decoration: none; }
.btn.solid { background: var(--accent); color: var(--bg); }
.btn:active { opacity: .8; transform: translateY(1px); }

section { padding: 28px 0; }
h2 { font-size: 1.3rem; margin: 0 0 16px; letter-spacing: -0.01em; }
.muted { color: var(--muted); }

/* ---------- Kaardid ---------- */
.cards { display: grid; gap: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 18px 20px; display: block; color: var(--fg);
  transition: border-color .15s, opacity .15s;
}
a.card:hover { border-color: var(--accent); text-decoration: none; }
a.card:active { opacity: .8; }
.card h3 { margin: 0 0 4px; font-size: 1.08rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.9375rem; }
.tag {
  display: inline-block; font-size: 0.75rem; padding: 2px 9px; margin: 10px 6px 0 0;
  border: 1px solid var(--line); border-radius: 99px; color: var(--muted);
}

/* ---------- Postituste nimekiri ---------- */
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { border-bottom: 1px solid var(--line); }
.post-list a { display: block; padding: 14px 0; color: var(--fg); }
.post-list a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.2em; }
.post-list time { display: block; font-size: 0.8125rem; color: var(--muted); }
.post-list .title { font-weight: 600; font-size: 1.05rem; }

/* ---------- Artikkel ---------- */
/* Lingid tekstis alla joonitud: ei toetu ainult värvile */
p a, article a { text-decoration: underline; text-underline-offset: 0.2em; }
.post-list a, nav a, footer.site a, .brand, .btn, a.card { text-decoration: none; }
.post-list a:hover, a.card:hover, .btn:hover { text-decoration: none; }
.post-list a:hover .title { text-decoration: underline; text-underline-offset: 0.2em; }

article h1 { font-size: 2rem; line-height: 1.2; margin: 48px 0 6px; letter-spacing: -0.02em; }
article time { color: var(--muted); font-size: 0.875rem; }
article p, article li { max-width: 40em; }
article pre {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; overflow-x: auto; font-size: 0.875rem; line-height: 1.5;
}
article code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.92em; }
article img { max-width: 100%; height: auto; border-radius: 10px; }

/* ---------- Jalus ---------- */
footer.site { margin-top: 56px; border-top: 1px solid var(--line); padding: 12px 0 48px; color: var(--muted); font-size: 0.875rem; }
footer.site .links { display: flex; flex-wrap: wrap; margin: 0 -10px; }
footer.site a { display: inline-block; padding: 12px 10px; min-height: 44px; color: var(--muted); }
footer.site a:hover { color: var(--fg); text-decoration: underline; }
footer.site p { margin: 8px 0 0; }

/* ---------- Lisatud v4: Minust-leht ja ehituspäevik ---------- */
.hero.has-photo { display: grid; gap: 24px 32px; align-items: center; }
@media (min-width: 720px) { .hero.has-photo { grid-template-columns: 1fr 200px; } }
.portrait { margin: 0; }
.portrait img { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 16px; }

section p { max-width: 36em; margin: 0 0 14px; }

.log { list-style: none; margin: 0; padding: 0; }
.log li { padding: 16px 0; border-top: 1px solid var(--line); }
.log li:last-child { border-bottom: 1px solid var(--line); }
.log h3 { margin: 0 0 4px; font-size: 1.05rem; }
.log p { margin: 0; max-width: 36em; }

.back { display: inline-flex; align-items: center; min-height: 44px; margin-top: 24px; }
.page-head { padding: 40px 0 8px; }
.page-head h1 { font-size: clamp(2rem, 6vw, 2.5rem); line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.02em; }
.page-head .lead { margin: 0; }
.meta { color: var(--muted); font-size: 0.9375rem; margin: 0 0 8px; }
