/* ---------------------------------------------------------------------------
   igor-mitkovski portfolio
   Single accent hue (oklch hue 145, green) drives the whole palette.
--------------------------------------------------------------------------- */

/* Theme: every token is light-dark(light, dark). Which side applies is
   driven by color-scheme — OS preference by default, or the explicit
   data-theme attribute set by the nav toggle (persisted in localStorage). */

:root {
  color-scheme: light dark;

  --bg: light-dark(oklch(0.985 0.004 145), oklch(0.19 0.012 145));
  --bg-translucent: light-dark(oklch(0.985 0.004 145 / 0.92), oklch(0.19 0.012 145 / 0.92));
  --card: light-dark(oklch(0.995 0.002 145), oklch(0.22 0.014 145));
  --card-tint: light-dark(oklch(0.96 0.02 145), oklch(0.29 0.035 145));
  --chip-bg: light-dark(oklch(0.955 0.012 145), oklch(0.28 0.02 145));
  --quote-bg: light-dark(oklch(0.96 0.008 145), oklch(0.25 0.015 145));

  --ink: light-dark(oklch(0.23 0.012 145), oklch(0.93 0.008 145));
  --ink-soft: light-dark(oklch(0.4 0.015 145), oklch(0.82 0.012 145));
  --ink-body: light-dark(oklch(0.44 0.015 145), oklch(0.8 0.012 145));
  --ink-mid: light-dark(oklch(0.48 0.015 145), oklch(0.76 0.015 145));
  --ink-muted: light-dark(oklch(0.55 0.02 145), oklch(0.68 0.02 145));
  --ink-faint: oklch(0.6 0.02 145);
  --ink-lede: light-dark(oklch(0.42 0.015 145), oklch(0.82 0.012 145));
  --ink-org: light-dark(oklch(0.5 0.02 145), oklch(0.7 0.02 145));
  --ink-quote: light-dark(oklch(0.38 0.015 145), oklch(0.85 0.015 145));

  --accent: light-dark(oklch(0.48 0.14 145), oklch(0.74 0.14 145));
  --accent-hover: light-dark(oklch(0.38 0.14 145), oklch(0.82 0.14 145));
  --accent-bright: light-dark(oklch(0.55 0.16 145), oklch(0.7 0.15 145));
  --accent-soft: light-dark(oklch(0.42 0.1 145), oklch(0.74 0.1 145));
  --accent-tag: light-dark(oklch(0.4 0.09 145), oklch(0.76 0.09 145));
  --accent-glow: oklch(0.72 0.12 145);
  --accent-mint: oklch(0.75 0.12 145);
  --hl-meta: light-dark(oklch(0.48 0.1 145), oklch(0.75 0.1 145));
  --method-ink: light-dark(white, oklch(0.16 0.02 145));

  --border: light-dark(oklch(0.9 0.01 145), oklch(0.3 0.015 145));
  --border-soft: light-dark(oklch(0.92 0.01 145), oklch(0.28 0.012 145));
  --border-card: light-dark(oklch(0.89 0.012 145), oklch(0.3 0.015 145));
  --border-node: light-dark(oklch(0.8 0.02 145), oklch(0.45 0.03 145));
  --border-edge: light-dark(oklch(0.87 0.02 145), oklch(0.38 0.02 145));
  --border-btn: light-dark(oklch(0.82 0.03 145), oklch(0.42 0.03 145));
  --border-tag: light-dark(oklch(0.85 0.04 145), oklch(0.45 0.05 145));
  --border-dashed: light-dark(oklch(0.88 0.015 145), oklch(0.34 0.02 145));
  --border-dot-ring: light-dark(oklch(0.8 0.04 145), oklch(0.45 0.04 145));
  --dot-gray: light-dark(oklch(0.75 0.03 145), oklch(0.52 0.03 145));

  --dark: light-dark(oklch(0.25 0.015 145), oklch(0.155 0.012 145));
  --dark-ink: oklch(0.95 0.01 145);
  --dark-ink-soft: oklch(0.78 0.02 145);
  --dark-border: light-dark(oklch(0.45 0.04 145), oklch(0.42 0.04 145));
  --code-ink: oklch(0.9 0.02 145);
  --code-ink-dim: oklch(0.88 0.03 145);
  --code-key: oklch(0.75 0.12 145);
  --code-string: oklch(0.82 0.08 90);
  --code-number: oklch(0.78 0.1 200);

  --btn-dark: light-dark(oklch(0.35 0.09 145), oklch(0.7 0.14 145));
  --btn-dark-ink: light-dark(oklch(0.98 0.01 145), oklch(0.17 0.02 145));
  --btn-mail: oklch(0.62 0.15 145);
  --btn-mail-ink: oklch(0.16 0.02 145);

  --mono: 'IBM Plex Mono', monospace;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Archivo', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

@keyframes flowdot {
  0% { transform: translateX(0); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateX(var(--dist, 48px)); opacity: 0; }
}
@keyframes flowdoty {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translateY(var(--dist, 22px)); opacity: 0; }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
@media (prefers-reduced-motion: reduce) {
  .edge-dot, .cursor { animation: none; }
  html { scroll-behavior: auto; }
}

.container { max-width: 1060px; margin: 0 auto; padding: 0 32px; }

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

.site-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
  background: var(--bg-translucent);
  backdrop-filter: blur(8px);
}
.brand { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.brand span { color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 18px; }
.nav-links { display: flex; gap: 22px; font-size: 14px; font-weight: 500; }
.nav-links a { color: inherit; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex-shrink: 0; padding: 0;
  border: 1px solid var(--border-btn); border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

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

.hero { padding: 72px 0; display: grid; grid-template-columns: 1fr; gap: 48px; }
.hero-top { display: grid; grid-template-columns: 1fr auto; gap: 56px; align-items: center; }
.hero-copy { max-width: 640px; }
.kicker {
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  margin: 0 0 16px; letter-spacing: 0.04em;
}
.hero-name {
  font-size: 68px; font-weight: 800; line-height: 1;
  margin: 0 0 12px; letter-spacing: -0.025em;
}
.hero-name .accent { color: var(--accent); }
.hero-role {
  font-family: var(--mono); font-size: 14px; color: var(--ink-muted);
  margin: 0 0 22px; letter-spacing: 0.06em;
}
.hero-tagline {
  font-size: 24px; font-weight: 700; line-height: 1.3;
  margin: 0 0 14px; letter-spacing: -0.01em;
}
.lede { font-size: 17px; line-height: 1.6; color: var(--ink-lede); margin: 0; }

.photo-frame {
  border: 1px solid var(--border-card); border-radius: 8px;
  background: var(--card); overflow: hidden; width: 264px;
}
.photo-frame img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; }
.cta-row { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }

.btn {
  display: inline-block; padding: 12px 22px;
  font-weight: 600; font-size: 15px; border-radius: 4px;
}
.btn-primary { background: var(--btn-dark); color: var(--btn-dark-ink); }
.btn-ghost { border: 1px solid var(--border-btn); color: inherit; }

/* ------------------------- data-flow diagram ----------------------------- */

.diagram {
  border: 1px solid var(--border-card); border-radius: 8px;
  background: var(--card); overflow: hidden;
}
.diagram-titlebar {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 12px; color: var(--ink-muted);
}
.traffic { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.traffic-red { background: oklch(0.75 0.12 25); }
.traffic-yellow { background: oklch(0.83 0.12 90); }
.traffic-green { background: oklch(0.72 0.12 145); }
.diagram-titlebar .title { margin-left: 8px; }

.diagram-flow {
  display: flex; align-items: center; justify-content: center; gap: 0;
  padding: 36px 24px; flex-wrap: wrap; row-gap: 28px;
}
.node {
  border: 1.5px solid var(--border-node); border-radius: 6px;
  padding: 14px 18px; font-family: var(--mono); font-size: 13px; text-align: center;
}
.node .name { font-weight: 600; }
.node .meta { font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.node-hl { border-color: var(--accent); background: var(--card-tint); }
.node-hl .meta { color: var(--hl-meta); }
.node-stack { display: flex; flex-direction: column; gap: 10px; }
.node-svc {
  border: 1.5px solid var(--border-node); border-radius: 6px;
  padding: 10px 16px; font-family: var(--mono); font-size: 13px;
  font-weight: 600; text-align: center;
}
.node-db {
  border: 1.5px solid var(--border-node); border-radius: 6px;
  padding: 8px 14px; font-family: var(--mono); font-size: 12px; text-align: center;
}
.node-db span { color: var(--ink-muted); }

.edge { position: relative; width: 56px; height: 2px; background: var(--border-edge); }
.edge-dot {
  position: absolute; top: -3px; left: 0; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent-bright);
  --dist: 48px;
  animation: flowdot 2.2s linear infinite;
}
.edge-dot.d2 { animation-delay: 0.55s; }
.edge-dot.d3 { animation-delay: 1.1s; }

/* ----------------------------- sections --------------------------------- */

.section { padding: 56px 0; border-top: 1px solid var(--border); scroll-margin-top: 64px; }
.section-kicker { font-family: var(--mono); font-size: 13px; color: var(--accent); margin: 0 0 10px; }
.section h2 { font-size: 34px; font-weight: 700; margin: 0 0 8px; letter-spacing: -0.01em; }
.section h2.solo { margin-bottom: 40px; }
.section-intro { font-size: 16px; color: var(--ink-mid); margin: 0 0 40px; max-width: 640px; }

/* --------------------------- case studies ------------------------------- */

.cases-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.cases-bar .section-intro { margin-bottom: 24px; }
.cases-nav { display: flex; gap: 8px; margin-bottom: 24px; }
.cases-nav button {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border-btn); background: var(--card);
  color: inherit; font-family: var(--mono); font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.cases-nav button:hover { border-color: var(--accent); color: var(--accent); }

.cases {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(100%, 900px);
  gap: 20px; overflow-x: auto; padding-bottom: 14px;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  scrollbar-width: thin; scrollbar-color: var(--border-node) transparent;
}
.cases::-webkit-scrollbar { height: 8px; }
.cases::-webkit-scrollbar-thumb { background: var(--border-node); border-radius: 999px; }
.cases::-webkit-scrollbar-track { background: transparent; }
.cases-hint {
  display: none; font-family: var(--mono); font-size: 12px;
  color: var(--ink-muted); margin: 10px 0 0;
}
.case {
  scroll-snap-align: start; scroll-snap-stop: always;
  border: 1px solid var(--border-card); border-radius: 8px; background: var(--card);
  padding: 32px;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: start;
}
.case h3 { font-size: 21px; font-weight: 700; margin: 0 0 12px; }
.case p { font-size: 15px; line-height: 1.65; color: var(--ink-soft); margin: 0 0 14px; }
.case p:last-of-type { margin-bottom: 0; }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.tag {
  font-family: var(--mono); font-size: 12px; padding: 4px 10px;
  border: 1px solid var(--border-tag); border-radius: 999px; color: var(--accent-tag);
}

.case-diagram {
  margin: 0; background: var(--dark); border-radius: 6px; padding: 18px 14px;
}
.case-diagram svg { display: block; width: 100%; height: auto; font-family: var(--mono); }
.cd-node { fill: oklch(0.3 0.02 145); stroke: oklch(0.52 0.07 145); stroke-width: 1.2; }
.cd-node-hl { fill: oklch(0.37 0.08 145); stroke: var(--accent-bright); stroke-width: 1.5; }
.cd-label { fill: var(--code-ink); font-size: 12.5px; font-weight: 500; text-anchor: middle; }
.cd-label.cd-small { font-size: 11px; }
.cd-sub { fill: oklch(0.7 0.06 145); font-size: 9.5px; text-anchor: middle; }
.cd-edge { fill: none; stroke: oklch(0.52 0.06 145); stroke-width: 1.2; }
.cd-edge-label { fill: var(--accent-glow); font-size: 9.5px; text-anchor: middle; }
.cd-edge-label.cd-start { text-anchor: start; }
.cd-edge-label.cd-end { text-anchor: end; }

/* ------------------------------ api card -------------------------------- */

.api-card {
  border: 1px solid var(--border-card); border-radius: 8px;
  overflow: hidden; background: var(--card);
}
.api-header {
  display: flex; align-items: center; gap: 14px; padding: 16px 24px;
  border-bottom: 1px solid var(--border-soft); flex-wrap: wrap;
}
.method {
  font-family: var(--mono); font-size: 13px; font-weight: 600;
  background: var(--accent-bright); color: var(--method-ink); padding: 4px 12px; border-radius: 4px;
}
.endpoint { font-family: var(--mono); font-size: 15px; }
.api-header .summary { margin-left: auto; font-size: 13px; color: var(--ink-muted); }

.api-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.api-panel { padding: 24px; }
.api-panel:nth-child(even) { border-left: 1px solid var(--border-soft); }
.api-panel:nth-child(n+3) { border-top: 1px solid var(--border-soft); }
.panel-label {
  font-family: var(--mono); font-size: 12px; color: var(--ink-muted);
  margin: 0 0 12px; letter-spacing: 0.05em;
}
.code {
  margin: 0; background: var(--dark); color: var(--code-ink);
  border-radius: 6px; padding: 18px;
  font-family: var(--mono); font-size: 13px; line-height: 1.7; overflow-x: auto;
}
.code .k { color: var(--code-key); }
.code .s { color: var(--code-string); }
.code .n { color: var(--code-number); }
.code .h { color: oklch(0.66 0.04 145); }

.params { margin-top: 18px; display: grid; gap: 8px; font-size: 13.5px; }
.param { display: flex; gap: 12px; }
.param code { font-family: var(--mono); color: var(--accent-soft); min-width: 90px; flex-shrink: 0; }
.param span { color: var(--ink-mid); }

.api-notes {
  border-top: 1px solid var(--border-soft);
  padding: 26px 24px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 28px;
}
.api-note .note-label {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  margin: 0 0 5px; letter-spacing: 0.06em;
}
.api-note p:not(.note-label) {
  margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-mid);
}

/* -------------------------------- stack --------------------------------- */

.stack-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 24px; }
.stack-card {
  border: 1px solid var(--border-card); border-radius: 8px;
  padding: 24px; background: var(--card);
}
.card-label {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  margin: 0 0 14px; letter-spacing: 0.05em;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 13px; padding: 5px 11px;
  background: var(--chip-bg); border-radius: 4px;
}

/* ----------------------------- experience -------------------------------- */

.timeline { display: grid; gap: 0; }
.job { display: grid; grid-template-columns: 170px 20px 1fr; gap: 20px; padding: 0 0 36px; }
.job-period {
  font-family: var(--mono); font-size: 13px; color: var(--ink-muted);
  text-align: right; padding-top: 2px;
}
.job-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.job-dot {
  width: 10px; height: 10px; border-radius: 50%; background: var(--dot-gray);
  border: 2px solid var(--bg); box-shadow: 0 0 0 1.5px var(--border-dot-ring);
  margin-top: 4px;
}
.job-dot.current { background: var(--accent-bright); }
.job-line { width: 1.5px; flex: 1; background: var(--border); }
.job h3 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
.job h3 .org { font-weight: 500; color: var(--ink-org); }
.job-desc { font-size: 14.5px; line-height: 1.6; color: var(--ink-body); margin: 0; }

.facts {
  display: flex; gap: 40px; flex-wrap: wrap; margin-top: 8px;
  padding-top: 28px; border-top: 1px dashed var(--border-dashed);
}
.fact-label {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  margin: 0 0 6px; letter-spacing: 0.05em;
}
.fact-body { font-size: 14.5px; margin: 0; color: var(--ink-soft); }

/* ------------------------------ teaching --------------------------------- */

.teaching { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
.teaching h2 { margin-bottom: 16px; }
.teaching-copy { font-size: 16px; line-height: 1.65; color: var(--ink-body); margin: 0; }
.lessons { display: grid; gap: 10px; }
.lesson {
  display: flex; align-items: center; gap: 12px;
  border: 1px solid var(--border-card); border-radius: 6px;
  padding: 13px 18px; background: var(--card);
}
.lesson-num { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.lesson-name { font-size: 15px; font-weight: 500; }

/* -------------------------------- about ---------------------------------- */

.about-copy { max-width: 680px; }
.about-copy h2 { margin-bottom: 16px; }
.about-copy p { font-size: 16px; line-height: 1.7; color: var(--ink-body); margin: 0 0 14px; }
.about-copy blockquote {
  margin: 24px 0 0; padding: 16px 22px;
  border-left: 3px solid var(--accent-bright); background: var(--quote-bg);
  font-size: 16px; font-style: italic; color: var(--ink-quote);
  border-radius: 0 6px 6px 0;
}

/* ------------------------------- contact ---------------------------------- */

.contact { padding: 72px 0 40px; }
.contact-card {
  background: var(--dark); border-radius: 10px; padding: 48px; color: var(--dark-ink);
}
.prompt { font-family: var(--mono); font-size: 13px; color: var(--accent-glow); margin: 0 0 12px; }
.cursor { animation: pulse 1.4s ease-in-out infinite; }
.contact-card h2 { font-size: 34px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.01em; }
.contact-card > p:not(.prompt) {
  font-size: 16px; line-height: 1.6; color: var(--dark-ink-soft);
  margin: 0 0 28px; max-width: 560px;
}
.contact-links { display: flex; gap: 14px; flex-wrap: wrap; }
.contact-links a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; font-weight: 600; font-size: 15px; border-radius: 5px;
}
.btn-mail { background: var(--btn-mail); color: var(--btn-mail-ink); }
.btn-dark-outline { border: 1px solid var(--dark-border); color: var(--code-ink); }

.footer-note {
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
  text-align: center; padding: 28px 0 8px; margin: 0;
}

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

@media (max-width: 860px) {
  .hero { padding: 48px 0; }
  .hero-top { grid-template-columns: 1fr; gap: 36px; }
  .photo-frame { width: 220px; order: -1; }
  .hero-name { font-size: 46px; }
  .hero-tagline { font-size: 20px; }
  .case, .api-panels, .teaching { grid-template-columns: 1fr; }
  .api-panel:nth-child(even) { border-left: none; }
  .api-panel + .api-panel { border-top: 1px solid var(--border-soft); }
  .api-notes { grid-template-columns: 1fr 1fr; }
  .api-header .summary { margin-left: 0; width: 100%; }
  .job { grid-template-columns: 90px 20px 1fr; gap: 12px; }
  .job-period { font-size: 12px; }
  .contact-card { padding: 32px 24px; }
}

@media (max-width: 720px) {
  .site-nav { flex-wrap: wrap; padding: 14px 0; gap: 8px 16px; }
  .nav-right { flex: 1; justify-content: space-between; min-width: 0; }
  .nav-links { gap: 14px; flex-wrap: wrap; }
  .cases-nav { display: none; }
  .cases-hint { display: block; }
  .cases { grid-auto-columns: 92%; }
  /* stack the request-lifecycle diagram vertically; dots flow downward */
  .diagram-flow { flex-direction: column; gap: 14px; padding: 28px 16px; }
  .node-stack { width: 100%; align-items: center; }
  .edge { width: 2px; height: 30px; }
  .edge-dot { left: -3px; top: 0; --dist: 22px; animation-name: flowdoty; }
}

@media (max-width: 560px) {
  .container { padding: 0 20px; }
  .hero-name { font-size: 40px; }
  .job { grid-template-columns: 74px 20px 1fr; }
  .case { padding: 24px 20px; }
  .api-notes { grid-template-columns: 1fr; }
  .contact-card { padding: 28px 20px; }
  .facts { gap: 24px; }
}
