/* ==========================================================================
   Andri Tilsen, portfoolio
   Disainisüsteem: tume, tehniline, rahulik. Üks aktsentvärv + üks olekuvärv.
   ========================================================================== */

/* ---------- Fondid (self-hosted, muutuvfondid) ---------- */
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "IBM Plex Sans";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../fonts/ibm-plex-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-latin.woff2") format("woff2");
}

/* ---------- Tokenid ---------- */
:root {
  /* tilsen.ee palett (tume teema) */
  --bg: #0b0b0c;          /* lehe taust */
  --surface: #151517;     /* kaardid, paneelid */
  --soft: #111113;        /* numbririba, koodiplokid */
  --fg: #e8e9ec;          /* põhitekst */
  --mute: #9a9ca3;        /* teisene tekst */
  --line: #26272b;        /* äärised ja eraldusjooned */
  --accent: #9db9e6;      /* lingid ja aktsent */
  --accent-soft: #1a2232; /* aktsendi taust (sildid) */

  /* vanad nimed, seotud uute väärtustega tähenduse järgi */
  --raised: var(--soft);
  --border: var(--line);
  --border-strong: #3a3b41;
  --text: var(--fg);
  --text-muted: var(--mute);
  --text-dim: #85878e;    /* metaandmed; kontrast ≥ 5:1 ka --surface peal */
  --accent-ink: #0e1716;  /* tekst aktsentvärvi nupul */
  --accent-line: rgba(157, 185, 230, 0.35);
  --accent-hover: #b6cbee;
  --status: #e3b341;
  --status-soft: rgba(227, 179, 65, 0.12);
  --danger: #f0857a;

  --font-sans: "IBM Plex Sans", system-ui, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, "Cascadia Mono", monospace;

  --fs-meta: 0.8125rem;  /* 13 */
  --fs-small: 0.9375rem; /* 15 */
  --fs-body: 1.0625rem;  /* 17 */
  --fs-h4: 1.3125rem;    /* 21 */
  --fs-h3: 1.625rem;     /* 26 */
  --fs-h2: clamp(1.75rem, 3.2vw, 2.0625rem); /* 33 */
  --fs-h1: clamp(2.25rem, 6vw, 3.25rem);

  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 24px;
  --s-6: 32px; --s-7: 48px; --s-8: 64px; --s-9: 96px;

  --radius: 6px;
  --radius-sm: 4px;
  --container: 1080px;
  --prose: 70ch;
  --gutter: 16px;
  --header-h: 60px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 180ms;
}
@media (min-width: 768px) { :root { --gutter: 24px; } }

/* ---------- Baas ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 var(--s-4); font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-h1); letter-spacing: -0.025em; line-height: 1.08; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.02em; }
h3 { font-size: var(--fs-h4); }
p { margin: 0 0 var(--s-4); }
ul, ol { margin: 0 0 var(--s-4); padding-left: 1.25em; }
li + li { margin-top: 0.25em; }
strong { font-weight: 600; color: var(--text); }
code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.9em; }
:not(pre) > code {
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.08em 0.35em;
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
a { color: var(--accent); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease); }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
::selection { background: rgba(157, 185, 230, 0.28); color: var(--text); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-7) 0; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--s-4); top: -100px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: var(--s-2) var(--s-4); border-radius: var(--radius); font-weight: 600; text-decoration: none; }
.skip-link:focus { top: var(--s-3); }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 11, 12, 0.86);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease);
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: var(--s-4); }
.brand { display: inline-flex; align-items: center; gap: var(--s-3); color: var(--text); text-decoration: none; font-weight: 600; }
.brand-mark {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 0.8rem; font-weight: 500; color: var(--accent);
  background: var(--surface);
}
.brand:hover .brand-mark { border-color: var(--accent-line); }

.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--s-1); }
.site-nav li + li { margin-top: 0; }
.site-nav a {
  display: block; padding: var(--s-2) var(--s-3); border-radius: var(--radius);
  color: var(--text-muted); text-decoration: none; font-size: var(--fs-small); font-weight: 500;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a[aria-current="true"], .site-nav a[aria-current="page"] { color: var(--text); }
.site-nav a[aria-current="true"]::after { content: ""; display: block; height: 2px; margin-top: 3px; background: var(--accent); border-radius: 2px; }
.site-nav .nav-cta { color: var(--accent); border: 1px solid var(--accent-line); }
.site-nav .nav-cta:hover { background: var(--accent-soft); color: var(--accent); }
.site-nav .nav-cta[aria-current="true"]::after { display: none; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-grid; place-items: center; width: 44px; height: 44px; margin-right: -10px;
    background: transparent; border: 0; color: var(--text); cursor: pointer; border-radius: var(--radius);
  }
  .nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after {
    display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
    transition: transform var(--dur) var(--ease), background-color var(--dur) var(--ease);
  }
  .nav-toggle-bar::before, .nav-toggle-bar::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-bar::before { top: -6px; }
  .nav-toggle-bar::after { top: 6px; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

  .site-nav {
    position: absolute; left: 0; right: 0; top: var(--header-h);
    background: var(--bg); border-bottom: 1px solid var(--border);
    padding: var(--s-2) var(--gutter) var(--s-4);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { padding: var(--s-3) var(--s-2); font-size: var(--fs-body); }
  .site-nav a[aria-current="true"]::after { display: none; }
  .site-nav a[aria-current="true"] { color: var(--accent); }
  .site-nav .nav-cta { margin-top: var(--s-2); text-align: center; }
  .js .site-nav:not(.is-open) { display: none; }
  .no-js .site-nav { position: static; display: block; border: 0; padding: 0 0 var(--s-3); }
}

/* ---------- Ühised ---------- */
.section { padding-block: var(--s-8); }
@media (min-width: 768px) { .section { padding-block: var(--s-9); } }
.section-alt { background: linear-gradient(180deg, rgba(21, 21, 23, 0.55), rgba(21, 21, 23, 0.55)); border-block: 1px solid var(--border); }
.eyebrow {
  font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--accent);
  letter-spacing: 0.02em; margin-bottom: var(--s-3);
}
.section-lead { color: var(--text-muted); max-width: 62ch; margin-bottom: var(--s-7); }
.h-small { font-size: var(--fs-meta); font-family: var(--font-mono); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-dim); margin: var(--s-6) 0 var(--s-3); }

.ticks { list-style: none; padding: 0; }
.ticks li { position: relative; padding-left: 1.5em; color: var(--text-muted); }
.ticks li::before { content: "›"; position: absolute; left: 0.2em; top: 0; color: var(--accent); font-family: var(--font-mono); font-weight: 600; }
.ticks li + li { margin-top: 0.4em; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: 44px; padding: 0 var(--s-5); border-radius: var(--radius);
  font-weight: 600; font-size: var(--fs-small); text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { border-color: var(--text-dim); background: var(--surface); }
.btn:active { transform: translateY(1px); }

.status {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; line-height: 1;
  padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  color: var(--text-muted); background: var(--surface); white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.status-done { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.status-partial { color: var(--status); border-color: rgba(227, 179, 65, 0.4); background: var(--status-soft); }
.meta-item { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--text-dim); }

.stack { list-style: none; padding: 0; margin: 0 0 var(--s-4); display: flex; flex-wrap: wrap; gap: 6px; }
.stack li { margin: 0; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px 7px; background: var(--bg); }

.link-arrow { font-weight: 600; font-size: var(--fs-small); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.link-arrow::after { content: "→"; transition: transform var(--dur) var(--ease); }
.link-arrow:hover::after { transform: translateX(3px); }

/* ---------- Hero ---------- */
.hero { padding-block: var(--s-8) var(--s-8); position: relative; }
.hero::before {
  /* peen ruudustik taristu "plaanina" */
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(38, 39, 43, 0.6) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(38, 39, 43, 0.6) 1px, transparent 1px);
  background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
}
@media (min-width: 960px) { .hero { padding-block: var(--s-9) var(--s-9); } }
.hero-grid { display: grid; gap: var(--s-7); align-items: center; }
@media (min-width: 960px) { .hero-grid { grid-template-columns: 1fr 1.05fr; gap: var(--s-8); } }

.prompt { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-dim); margin-bottom: var(--s-3); }
.prompt-user { color: var(--accent); }
.prompt-path { color: var(--status); }
.prompt::after { content: "▍"; color: var(--accent); margin-left: 4px; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero h1 { margin-bottom: var(--s-3); }
.hero-role { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--text-muted); margin-bottom: var(--s-5); }
.hero-lead { font-size: 1.125rem; color: var(--text-muted); max-width: 52ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s-3); margin: var(--s-6) 0 var(--s-6); }
.hero-facts { display: flex; flex-wrap: wrap; gap: var(--s-5) var(--s-6); margin: 0; padding-top: var(--s-5); border-top: 1px solid var(--border); }
.hero-facts div { min-width: 0; }
.hero-facts dt { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.hero-facts dd { margin: 2px 0 0; font-size: var(--fs-small); font-weight: 500; }

.hero-visual { margin: 0; min-width: 0; }
.hero-visual figcaption { margin-top: var(--s-3); font-size: var(--fs-meta); color: var(--text-dim); line-height: 1.5; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.8); }
.panel-bar { display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--raised); }
.panel-title { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); }
.panel-title::before { content: "● "; color: var(--accent); }

.topology { width: 100%; padding: 14px; font-family: var(--font-mono); }
.topology .node rect { fill: var(--bg); stroke: var(--border-strong); stroke-width: 1; }
.topology .node-muted rect { stroke-dasharray: 4 4; }
.topology .node-title { fill: var(--text); font-size: 12px; font-weight: 600; font-family: var(--font-sans); }
.topology .node-dev { fill: var(--accent); font-size: 10.5px; }
.topology .vlan { fill: var(--text-muted); font-size: 10.5px; white-space: pre; }
.topology .vlan-id { fill: var(--text-dim); }
.topology .vlan-dmz { fill: var(--status); }
.topology .led { fill: var(--accent); }
.topology .link { fill: none; stroke-width: 1.5; }
.topology .link-vpn { stroke: var(--accent); stroke-dasharray: 6 5; animation: flow 1.6s linear infinite; }
.topology .link-radio { stroke: var(--status); stroke-dasharray: 2 4; }
.topology .link-ra { stroke: var(--text-dim); stroke-dasharray: 4 4; }
.topology .link-label { fill: var(--text-dim); font-size: 10px; }
@keyframes flow { to { stroke-dashoffset: -22; } }

/* ---------- About ---------- */
.about-grid { display: grid; gap: var(--s-7); }
@media (min-width: 900px) { .about-grid { grid-template-columns: 1.4fr 0.8fr; gap: var(--s-8); align-items: start; } }
.about-copy p { color: var(--text-muted); max-width: var(--prose); }
.about-photo { margin: 0; }
.about-photo img { border-radius: 8px; border: 1px solid var(--border); aspect-ratio: 3 / 4; object-fit: cover; width: 100%; max-width: 420px; }
.about-photo figcaption { margin-top: var(--s-2); font-size: var(--fs-meta); color: var(--text-dim); }

.principles { list-style: none; padding: 0; margin: var(--s-8) 0 0; display: grid; gap: var(--s-4); counter-reset: p; }
@media (min-width: 768px) { .principles { grid-template-columns: repeat(3, 1fr); } }
.principles li { margin: 0; padding: var(--s-5); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); counter-increment: p; }
.principles li::before { content: "0" counter(p); display: block; font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--accent); margin-bottom: var(--s-2); }
.principles h3 { font-size: 1.0625rem; margin-bottom: var(--s-2); }
.principles p { color: var(--text-muted); font-size: var(--fs-small); margin: 0; }

/* ---------- Skills ---------- */
.src {
  display: inline-block; font-family: var(--font-mono); font-size: 0.6875rem; line-height: 1;
  padding: 3px 6px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  vertical-align: 2px; white-space: nowrap; color: var(--text-dim);
}
.src-proj { color: var(--accent); border-color: var(--accent-line); }
.src-prak { color: var(--status); border-color: rgba(227, 179, 65, 0.4); }
.src-kool { color: var(--text-muted); }

.skills-grid { display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .skills-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .skills-grid { grid-template-columns: repeat(3, 1fr); } }
.skill-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-5); transition: border-color var(--dur) var(--ease); }
.skill-card:hover { border-color: var(--border-strong); }
.skill-card h3 { font-size: 1.0625rem; display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4); }
.skill-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); font-family: var(--font-mono); font-size: 0.8rem; flex: none; }
.skill-list { list-style: none; padding: 0; margin: 0; }
.skill-list li { font-size: var(--fs-small); color: var(--text-muted); padding: 7px 0; border-top: 1px dashed var(--border); margin: 0; line-height: 1.5; }
.skill-list li:first-child { border-top: 0; padding-top: 0; }
.tag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list li { margin: 0; font-size: 0.8125rem; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 4px 8px; }
.tag-list-muted li { background: var(--bg); }

/* ---------- Projects ---------- */
.project-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-bottom: var(--s-3); }
.project-feature {
  display: grid; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--surface); margin-bottom: var(--s-5);
  transition: border-color var(--dur) var(--ease);
}
.project-feature:hover { border-color: var(--border-strong); }
@media (min-width: 900px) { .project-feature { grid-template-columns: 1.15fr 1fr; } }
.project-feature-media { display: block; background: #000; border-bottom: 1px solid var(--border); }
@media (min-width: 900px) { .project-feature-media { border-bottom: 0; border-right: 1px solid var(--border); display: grid; place-items: center; } }
.project-feature-media img { width: 100%; opacity: 0.92; transition: opacity var(--dur) var(--ease); }
.project-feature:hover .project-feature-media img { opacity: 1; }
.project-feature-body { padding: var(--s-6) var(--s-5); }
@media (min-width: 900px) { .project-feature-body { padding: var(--s-7) var(--s-6); } }
.project-feature h3 { font-size: var(--fs-h3); }
.project-feature h3 a, .project-card h3 a { color: var(--text); text-decoration: none; }
.project-feature h3 a:hover, .project-card h3 a:hover { color: var(--accent); }
.project-feature p { color: var(--text-muted); }

.project-grid { display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .project-grid { grid-template-columns: repeat(3, 1fr); } }
.project-card {
  position: relative; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-5);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.project-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.project-card h3 { font-size: 1.125rem; margin-bottom: var(--s-2); }
.project-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* terve kaart klikitav */
.project-card h3 a:focus-visible { outline: none; }
.project-card:has(h3 a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.project-card p { color: var(--text-muted); font-size: var(--fs-small); flex: 1; }
.project-card .stack { margin-bottom: 0; }

.more-work { margin-top: var(--s-7); }
.more-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.more-list li { display: grid; gap: var(--s-1) var(--s-5); padding: var(--s-4) 0; border-bottom: 1px solid var(--border); margin: 0; }
@media (min-width: 720px) { .more-list li { grid-template-columns: 220px 1fr; } }
.more-name { font-weight: 600; font-size: var(--fs-small); }
.more-desc { color: var(--text-muted); font-size: var(--fs-small); }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; gap: var(--s-3) var(--s-6); padding: var(--s-6) 0; border-top: 1px solid var(--border); }
.tl-item:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 860px) { .tl-item { grid-template-columns: 220px 1fr; } }
.tl-when { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 4px 6px; align-content: flex-start; align-items: center; }
@media (min-width: 860px) { .tl-when { flex-direction: column; align-items: flex-start; } }
.tl-type { display: inline-block; font-size: 0.6875rem; padding: 3px 7px; border-radius: var(--radius-sm); border: 1px solid var(--border); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.tl-type-prak { color: var(--status); border-color: rgba(227, 179, 65, 0.4); }
.tl-type-kool { color: var(--text-muted); }
.tl-dur { color: var(--text-muted); }
.tl-body h3 { font-size: 1.1875rem; }
.tl-role { display: block; font-weight: 400; color: var(--text-muted); font-size: var(--fs-small); margin-top: 4px; }
@media (min-width: 640px) { .tl-role { display: inline; margin-top: 0; } }
.tl-body > p { color: var(--text-muted); max-width: var(--prose); }
.tl-gallery { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-5); max-width: 640px; }
.tl-gallery figure { margin: 0; }
.tl-gallery img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border-radius: var(--radius); }
.tl-gallery figcaption { font-size: var(--fs-meta); color: var(--text-dim); margin-top: 6px; }

/* ---------- Zoom / lightbox ---------- */
.zoom { display: block; width: 100%; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: none; cursor: zoom-in; overflow: hidden; transition: border-color var(--dur) var(--ease); }
.zoom:hover { border-color: var(--accent-line); }
.zoom img { border-radius: 0; }
.lightbox { padding: 0; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg); max-width: min(96vw, 1400px); max-height: 92vh; overflow: auto; }
.lightbox::backdrop { background: rgba(5, 5, 6, 0.85); }
.lightbox img { max-width: 100%; max-height: 88vh; width: auto; margin: auto; }
.lightbox-close { position: sticky; top: 8px; float: right; margin: 8px; width: 40px; height: 40px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; z-index: 2; }
.lightbox-close:hover { border-color: var(--accent); }

/* ---------- Contact ---------- */
.contact-inner { max-width: 760px; }
.contact-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.contact-list li { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: var(--s-1) var(--s-4); padding: var(--s-4) 0; border-bottom: 1px solid var(--border); margin: 0; }
@media (min-width: 640px) { .contact-list li { grid-template-columns: 120px 1fr auto; } }
.contact-label { font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; grid-column: 1 / -1; }
@media (min-width: 640px) { .contact-label { grid-column: auto; } }
.contact-value { font-size: 1.1875rem; font-weight: 500; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.contact-value:hover { color: var(--accent); }
.copy-btn { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted); background: transparent; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; min-height: 36px; cursor: pointer; transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.copy-btn:hover { color: var(--accent); border-color: var(--accent-line); }
.no-js .copy-btn { display: none; }
.copy-status { min-height: 1.5em; margin-top: var(--s-3); font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding-block: var(--s-6); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-5); }
.site-footer p { margin: 0; font-size: var(--fs-meta); color: var(--text-dim); }
.footer-note { font-family: var(--font-mono); }

/* ==========================================================================
   Projektilehed (case study)
   ========================================================================== */
.case-header { padding-block: var(--s-7) var(--s-6); border-bottom: 1px solid var(--border); }
@media (min-width: 768px) { .case-header { padding-block: var(--s-8) var(--s-7); } }
.breadcrumb { font-family: var(--font-mono); font-size: var(--fs-meta); margin-bottom: var(--s-5); color: var(--text-dim); }
.breadcrumb a { color: var(--text-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }
.case-header h1 { font-size: clamp(2rem, 5vw, 2.75rem); max-width: 22ch; }
.case-summary { font-size: 1.125rem; color: var(--text-muted); max-width: 64ch; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s-4) var(--s-5); margin: var(--s-6) 0 0; padding: var(--s-5) 0 0; border-top: 1px solid var(--border); }
.facts div { min-width: 0; }
.facts dt { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 4px; }
.facts dd { margin: 0; font-size: var(--fs-small); color: var(--text); }

.case-layout { display: grid; gap: var(--s-7); padding-block: var(--s-7) var(--s-8); }
@media (min-width: 1020px) { .case-layout { grid-template-columns: 200px minmax(0, 1fr); gap: var(--s-8); } }
.toc { font-size: var(--fs-small); }
.toc-inner { position: sticky; top: calc(var(--header-h) + 24px); }
.toc p { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: var(--s-3); }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 1px solid var(--border); }
.toc li { margin: 0; }
.toc a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 1px solid transparent; color: var(--text-muted); text-decoration: none; line-height: 1.4; }
.toc a:hover { color: var(--text); }
.toc a[aria-current="true"] { color: var(--accent); border-left-color: var(--accent); }
@media (max-width: 1019px) {
  .toc { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4); background: var(--surface); }
  .toc ol { columns: 2; column-gap: var(--s-5); border-left: 0; }
  .toc a { padding-left: 0; border-left: 0; }
}
@media (max-width: 520px) { .toc ol { columns: 1; } }

.prose { min-width: 0; max-width: 760px; }
.prose > section { margin-bottom: var(--s-8); }
.prose > section:last-child { margin-bottom: 0; }
.prose h2 { font-size: var(--fs-h3); padding-top: var(--s-2); }
.prose h2 .num { font-family: var(--font-mono); font-size: var(--fs-small); color: var(--accent); font-weight: 500; margin-right: var(--s-3); vertical-align: 3px; }
.prose h3 { font-size: 1.1875rem; margin-top: var(--s-6); }
.prose p, .prose li { color: var(--text-muted); }
.prose p strong, .prose li strong { color: var(--text); }

.callout { border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface); border-radius: var(--radius); padding: var(--s-4) var(--s-5); margin: var(--s-5) 0; font-size: var(--fs-small); }
.callout p:last-child { margin-bottom: 0; }
.callout-title { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: var(--s-2) !important; }
.callout-warn { border-left-color: var(--status); }
.callout-warn .callout-title { color: var(--status); }

.figure { margin: var(--s-6) 0; }
.figure figcaption { font-size: var(--fs-meta); color: var(--text-dim); margin-top: var(--s-2); line-height: 1.5; }
.figure-pair { display: grid; gap: var(--s-4); margin: var(--s-6) 0; }
@media (min-width: 640px) { .figure-pair { grid-template-columns: 1fr 1fr; } }
.figure-pair .figure { margin: 0; }

.table-wrap { overflow-x: auto; margin: var(--s-5) 0; border: 1px solid var(--border); border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
.table-wrap:focus-visible { outline-offset: 0; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
caption { caption-side: bottom; text-align: left; padding: var(--s-2) var(--s-3); font-size: var(--fs-meta); color: var(--text-dim); border-top: 1px solid var(--border); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
thead th { font-family: var(--font-mono); font-size: 0.75rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); background: var(--surface); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); }
td { color: var(--text-muted); }
td.mono, th.mono { font-family: var(--font-mono); font-size: 0.8125rem; white-space: nowrap; color: var(--text); }
.allow { color: var(--accent); font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; }
.deny { color: var(--danger); font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 500; }

.code { position: relative; margin: var(--s-5) 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--soft); overflow: hidden; }
.code-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); padding: 6px 6px 6px 14px; border-bottom: 1px solid var(--border); background: var(--surface); }
.code-title { font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code pre { margin: 0; padding: var(--s-4); overflow-x: auto; font-size: 0.8125rem; line-height: 1.7; color: var(--fg); tab-size: 2; }
.code .c { color: var(--text-dim); }
.code .k { color: var(--accent); }
.code .s { color: var(--status); }
.code .copy-btn { padding: 4px 8px; min-height: 28px; }

.learned { display: grid; gap: var(--s-3); margin: var(--s-5) 0; list-style: none; padding: 0; }
.learned li { margin: 0; padding: var(--s-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: var(--fs-small); }

.steps { counter-reset: st; list-style: none; padding: 0; }
.steps > li { counter-increment: st; position: relative; padding-left: 2.5em; margin-top: var(--s-3); }
.steps > li::before { content: counter(st); position: absolute; left: 0; top: 0.1em; width: 1.7em; height: 1.7em; border-radius: 999px; border: 1px solid var(--accent-line); color: var(--accent); font-family: var(--font-mono); font-size: 0.8em; display: grid; place-items: center; }

.case-nav { display: grid; gap: var(--s-4); padding-block: var(--s-6) var(--s-8); border-top: 1px solid var(--border); }
@media (min-width: 640px) { .case-nav { grid-template-columns: 1fr 1fr; } }
.case-nav a { display: block; padding: var(--s-4) var(--s-5); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; background: var(--surface); transition: border-color var(--dur) var(--ease); }
.case-nav a:hover { border-color: var(--accent-line); }
.case-nav span { display: block; font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-dim); margin-bottom: 4px; }
.case-nav strong { color: var(--text); font-weight: 600; }
.case-nav .next { text-align: right; }
@media (max-width: 639px) { .case-nav .next { text-align: left; } }

/* ---------- 404 ---------- */
.notfound { min-height: 70vh; display: grid; align-content: center; padding-block: var(--s-8); }
.notfound pre { font-family: var(--font-mono); color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--s-4); overflow-x: auto; font-size: 0.875rem; }

/* ---------- Reveal (ainult kui JS töötab) ---------- */
.js .reveal { opacity: 0; transform: translateY(8px); transition: opacity 400ms var(--ease), transform 400ms var(--ease); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Liikumise vähendamine ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .prompt::after { animation: none; }
}

/* ---------- Print ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --raised: #fff; --text: #000; --text-muted: #222; --text-dim: #444; --border: #ccc; --accent: #2d4f86; }
  .site-header, .nav-toggle, .hero-actions, .copy-btn, .toc, .case-nav, .lightbox, .hero::before { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
  .section, .case-layout { padding-block: 16px; }
}

/* Tekstinupp (nt "Vaata ekraanipilti") */
.text-btn { display: inline; padding: 0; margin-left: 4px; background: none; border: 0; color: var(--accent); font: inherit; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; cursor: zoom-in; }
.text-btn:hover { text-decoration-color: currentColor; }

[hidden] { display: none !important; }

/* Lipulaeva meedia: hele skeem tumedal "paneelil", mitte musta letterbox'iga */
.project-feature-media { background: var(--bg); padding: var(--s-5); }
.project-feature-media img { border-radius: var(--radius); border: 1px solid var(--border); }
.tl-dates { white-space: nowrap; }
.facts .status { white-space: normal; max-width: 100%; line-height: 1.3; }
@media (max-width: 480px) { .facts { grid-template-columns: 1fr 1fr; } }

/* ===== Ülevaatuse parandused (Design + SEO agent) ===== */
/* oskuste allika-sildid joondatud paremale, ei murdu juhuslikult */
.skill-list li { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); }
.srcs { flex: none; display: inline-flex; gap: 4px; }

/* facts: staatus täislaiuses kitsal ekraanil */
.facts dd { min-width: 0; }
@media (max-width: 480px) { .facts > div:first-child { grid-column: 1 / -1; } }

/* hero topoloogia: mobiilis keritav, et tekst jääks loetavaks */
@media (max-width: 600px) {
  .panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .topology { min-width: 520px; }
}

/* üksik viimane projektikaart täislaiusena */
@media (min-width: 1020px) {
  .project-grid > :last-child:nth-child(3n+1) { grid-column: 1 / -1; }
}
@media (min-width: 720px) and (max-width: 1019px) {
  .project-grid > :last-child:nth-child(2n+1) { grid-column: 1 / -1; }
}

.timeline { margin-top: var(--s-6); }

/* aktiivse menüülingi joon ei muuda kõrgust */
.site-nav a { position: relative; }
.site-nav a[aria-current="true"]::after { position: absolute; left: 12px; right: 12px; bottom: 2px; margin: 0; }

/* kursor vilgub paar korda ja jääb seisma */
.prompt::after { animation: blink 1.1s steps(1) 6 forwards; }

.copy-btn { color: var(--text); font-size: 0.8125rem; }
.section-alt { background: var(--surface); }
.section-alt .skill-card { background: var(--bg); }

/* lipulaeva poliitikamaatriks */
.project-feature-media.policy { margin: 0; display: flex; flex-direction: column; justify-content: center; gap: var(--s-3); padding: var(--s-5); background: var(--bg); }
.policy .table-wrap { margin: 0; }
.policy-matrix { font-family: var(--font-mono); font-size: 0.75rem; }
.policy-matrix caption { font-family: var(--font-sans); }
.policy-matrix th, .policy-matrix td { padding: 9px 8px; text-align: center; white-space: nowrap; border-bottom: 1px solid var(--border); }
.policy-matrix tbody th { text-align: left; color: var(--text); font-weight: 500; background: var(--surface); }
.policy-matrix td + td, .policy-matrix th + td, .policy-matrix thead th + th { border-left: 1px solid var(--border); }
.policy figcaption { font-size: var(--fs-meta); color: var(--text-dim); }
.p-ok { color: var(--accent); font-weight: 600; }
.p-lim { color: var(--status); }
.p-no { color: var(--danger); }
.p-self { color: var(--text-dim); }
td.p-ok { background: var(--accent-soft); }
td.p-lim { background: var(--status-soft); }
td.p-no { background: rgba(240, 133, 122, 0.06); }

/* fookus ka brauserites, mis ei toeta :has() */
@supports not selector(:has(*)) {
  .project-card h3 a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
}

/* lipulaeva kaart ei tohi tabeli tõttu laieneda üle ekraani */
.project-feature { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .project-feature { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.project-feature-media.policy { min-width: 0; }
.policy figcaption { overflow-wrap: anywhere; }

/* ===== Numbririba hero all ===== */
.stats {
  list-style: none; margin: var(--s-7) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); overflow: hidden;
}
@media (min-width: 860px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stats li { margin: 0; padding: var(--s-5); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stats li + li { margin-top: 0; }
/* jaotusjooned: mobiilis 2x2 ruudustik, laial ekraanil üks rida */
.stats li:nth-child(even) { border-left: 1px solid var(--border); }
.stats li:nth-child(n+3) { border-top: 1px solid var(--border); }
@media (min-width: 860px) {
  .stats li + li { border-left: 1px solid var(--border); }
  .stats li:nth-child(n+3) { border-top: 0; }
}
.stat-num { font-family: var(--font-mono); font-size: clamp(1.75rem, 4vw, 2.25rem); font-weight: 500; line-height: 1; color: var(--accent); letter-spacing: -0.02em; }
.stat-label { font-size: var(--fs-small); color: var(--text-muted); line-height: 1.4; }

/* Põhimõtete kaardid: väiksem pealkiri, h4 */
.principles-title { margin-top: var(--s-8); }
.principles { margin-top: 0; }
.principles h4 { font-size: 1.0625rem; margin: 0 0 var(--s-2); font-weight: 600; line-height: 1.3; }

/* Praktika/hariduse roll alati eraldi real (kriipsu asemel) */
.tl-role, .tl-body h3 .tl-role { display: block; margin-top: 4px; }

/* ===== Mobiili parandused: tabelid ja keritavad alad ===== */
@media (max-width: 600px) {
  /* tabel kerib külgsuunas, tekst ei pressita liiga kitsaks */
  .prose .table-wrap table { min-width: 560px; }
  .policy-matrix { min-width: 0; }
  /* varjuga vihje, et sisu jätkub paremal */
  .table-wrap, .panel {
    background:
      linear-gradient(to right, var(--bg) 30%, rgba(11, 11, 12, 0)) left / 32px 100% no-repeat local,
      linear-gradient(to left, var(--bg) 30%, rgba(11, 11, 12, 0)) right / 32px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(157, 185, 230, 0.28), rgba(157, 185, 230, 0)) left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(157, 185, 230, 0.28), rgba(157, 185, 230, 0)) right / 12px 100% no-repeat scroll;
  }
  .panel .panel-bar { position: sticky; left: 0; }
}
.scroll-hint { display: none; }
@media (max-width: 600px) { .scroll-hint { display: inline; } }

/* üks praktikapilt: suurem ja ühes veerus */
.tl-gallery:has(> figure:only-child) { grid-template-columns: minmax(0, 1fr); max-width: 360px; }
@media (max-width: 600px) {
  .panel {
    background:
      linear-gradient(to right, var(--surface) 30%, rgba(21, 21, 23, 0)) left / 32px 100% no-repeat local,
      linear-gradient(to left, var(--surface) 30%, rgba(21, 21, 23, 0)) right / 32px 100% no-repeat local,
      radial-gradient(farthest-side at 0 50%, rgba(157, 185, 230, 0.28), rgba(157, 185, 230, 0)) left / 12px 100% no-repeat scroll,
      radial-gradient(farthest-side at 100% 50%, rgba(157, 185, 230, 0.28), rgba(157, 185, 230, 0)) right / 12px 100% no-repeat scroll,
      var(--surface);
  }
}

/* Minust: allkiri on sama laiusega kui pilt ja otse selle all */
.about-photo { max-width: 420px; }
.about-photo img { max-width: 100%; }
.about-photo figcaption { margin-top: var(--s-2); }

/* ===== tilsen.ee palett: täpsustused ===== */
/* Põhinupp: taust #9db9e6, tekst #0e1716, raadius 8px */
.btn { border-radius: 8px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
/* numbririba ja koodiplokid heledamal "soft" taustal */
.stats { background: var(--soft); }
.code-head { background: var(--surface); }
/* aktsendi taust siltidel ja ikoonidel */
.status-done, .skill-icon, td.p-ok { background: var(--accent-soft); }
