/* misho.dev – "observability dark" theme. Plain CSS, no framework. */

/* ---------- Tokens ---------- */
:root {
  --bg: #0f1115;
  --panel: #161a21;
  --panel-head: #1b2029;
  --border: #262c36;
  --border-strong: #353d4a;
  --text: #e6e8eb;
  --muted: #9aa3ae;
  --accent: #f26b3a;          /* Prometheus orange, lightened for contrast on dark */
  --accent-strong: #e6522c;
  --on-accent: #0f1115;
  --ok: #4ec9a0;
  --tag-bg: #1e242e;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Menlo", monospace;
  --radius: 10px;
  --gap: clamp(16px, 2.5vw, 24px);
  --max: 1120px;

  color-scheme: dark;
}

/* Light theme: follow the system unless the visitor picked dark explicitly */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f7f5;
    --panel: #fff;
    --panel-head: #f1f1ee;
    --border: #e2e2dd;
    --border-strong: #cfcfc8;
    --text: #16181d;
    --muted: #5b636e;
    --accent: #c2410c;
    --accent-strong: #c2410c;
    --on-accent: #fff;
    --ok: #0f7a5a;
    --tag-bg: #f1f1ee;

    color-scheme: light;
  }
}

:root[data-theme="light"] {
  --bg: #f7f7f5;
  --panel: #fff;
  --panel-head: #f1f1ee;
  --border: #e2e2dd;
  --border-strong: #cfcfc8;
  --text: #16181d;
  --muted: #5b636e;
  --accent: #c2410c;
  --accent-strong: #c2410c;
  --on-accent: #fff;
  --ok: #0f7a5a;
  --tag-bg: #f1f1ee;

  color-scheme: light;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  /* stylelint-disable-next-line property-no-vendor-prefix -- still needed by iOS Safari */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

code,
.prompt,
.panel-title,
.when,
time,
.logo,
.nav-links a,
.tags li,
.links a {
  font-family: var(--font-mono);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 6px;
}

.skip-link:focus {
  top: 12px;
}

.muted {
  color: var(--muted);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 16px;
  min-height: 60px;
}

.logo {
  padding-block: 18px;
  line-height: 24px;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  margin-right: auto;
}

.nav-links {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
  color: var(--text);
  background: var(--tag-bg);
}

.nav-toggle,
.theme-toggle {
  /* hidden until js/site.js is ready – see below */
  display: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle:hover,
.theme-toggle:hover {
  border-color: var(--border-strong);
}

/*
 * The menu and theme buttons only work with js/site.js, which adds
 * .nav-ready / .theme-ready to <html> once their handlers are installed.
 * Without it the buttons stay hidden and the nav links stay visible.
 */
.theme-ready .theme-toggle {
  display: inline-grid;
}

@media (width <= 760px) {
  /* No JS: links wrap onto their own row under the logo */
  .site-header nav {
    order: 3;
    flex-basis: 100%;
  }

  .nav-links {
    flex-wrap: wrap;
    padding-bottom: 8px;
  }

  /* JS ready: collapse the links behind the menu button */
  .nav-ready .site-header nav {
    order: 0;
    flex-basis: auto;
  }

  .nav-ready .nav-toggle {
    display: inline-grid;
  }

  .nav-ready .nav-links {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    flex-flow: column nowrap;
    padding: 8px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
  }

  .nav-ready .nav-links.open {
    display: flex;
  }

  .nav-ready .nav-links a {
    padding: 10px 8px;
    font-size: 16px;
  }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.btn-ghost {
  border-color: transparent;
  color: var(--muted);
}

/* ---------- Panels (Grafana-style) ---------- */
.panel {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.panel-title {
  margin: -16px -18px 14px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--panel-head);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.panel p:last-child {
  margin-bottom: 0;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(24px, 5vw, 56px);
  align-items: center;
  padding-block: clamp(40px, 8vw, 96px) 32px;
}

.prompt {
  color: var(--muted);
  margin-bottom: 8px;
}

.prompt-sign {
  color: var(--accent);
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.role {
  margin: 10px 0 20px;
  color: var(--muted);
  font-size: 1.1rem;
}

.lead {
  max-width: 36em;
  font-size: 1.1rem;
}

.metric {
  overflow-x: auto;
  font-size: 13px;
  color: var(--muted);
}

.ok {
  color: var(--ok);
  font-weight: 500;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-photo {
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.hero-photo .panel-title {
  margin: 0;
}

.hero-photo img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

@media (width <= 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-photo {
    max-width: 480px;
  }
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--gap);
}

.stat-value {
  margin: 0;
  color: var(--ok);
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 500;
  line-height: 1.1;
}

@media (width <= 760px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(48px, 8vw, 88px) 0;
}

.section-title {
  margin-bottom: 28px;
  font-family: var(--font-mono);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  font-weight: 500;
}

.hash {
  color: var(--accent);
}

h3 {
  font-size: 1.05rem;
  font-weight: 600;
}

.prose {
  max-width: 62ch;
}

.large {
  font-size: 1.25rem;
}

.quote {
  margin: 24px 0;
  padding: 4px 0 4px 18px;
  border-left: 3px solid var(--accent);
}

.quote p {
  margin-bottom: 6px;
  font-size: 1.05rem;
  font-style: italic;
}

.quote cite {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.note {
  margin-top: 20px;
  color: var(--muted);
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
}

.photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.photos img:first-child {
  grid-column: span 2;
  aspect-ratio: 16 / 9;
}

.values,
.cards,
.skills,
.edu,
.videos {
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.values {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 40px;
  font-size: 15px;
}

.cards,
.edu,
.videos {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.skills {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (width <= 960px) {
  .values {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cards,
  .edu,
  .videos {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (width <= 640px) {
  .about-grid,
  .values,
  .cards,
  .skills,
  .edu,
  .videos {
    grid-template-columns: 1fr;
  }
}

/* Talks log */
.log {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.log li {
  display: grid;
  grid-template-columns: 7.5em 9.5em 1fr;
  gap: 16px;
  align-items: baseline;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}

.log li:first-child {
  border-top: 0;
}

.log time {
  color: var(--muted);
  font-size: 14px;
}

.log .event {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 14px;
}

@media (width <= 640px) {
  .log li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Experience timeline */
.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline > li {
  position: relative;
  padding: 0 0 32px 28px;
  border-left: 1px solid var(--border-strong);
}

.timeline > li:last-child {
  padding-bottom: 0;
}

.timeline > li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 6px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--ok);
}

.timeline > li:first-child::before {
  background: var(--ok);
}

.when {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.timeline h3 {
  margin-bottom: 8px;
}

.at {
  color: var(--accent);
  font-weight: 500;
}

.timeline ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.timeline p {
  max-width: 70ch;
  margin: 0;
  color: var(--muted);
}

/* Skills */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--tag-bg);
  font-size: 13px;
}

.badge {
  display: inline-block;
  margin: 14px 0 0;
  padding: 4px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
}

/* Education */
.edu h3 {
  margin-bottom: 6px;
}

.edu p {
  color: var(--muted);
  font-size: 15px;
}

/* Vlog */
.video {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 16px;
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
}

.video img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-bottom: 1px solid var(--border);
}

.video .when,
.video-title {
  padding-inline: 16px;
}

.video .when {
  margin-top: 8px;
}

.video-title {
  font-weight: 500;
}

.video:hover {
  border-color: var(--accent);
}

.videos + p {
  margin-top: 24px;
}

/* Contact */
.contact-mail {
  font-size: clamp(1.6rem, 5vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.contact-mail a {
  color: var(--text);
  text-decoration-color: var(--accent);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a::after {
  content: " ↗";
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: clamp(64px, 10vw, 120px);
  border-top: 1px solid var(--border);
  font-size: 14px;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding-block: 24px;
}

.footer-inner p {
  margin: 0;
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------- Scroll motion ----------
 * Everything below that hides content is scoped to html.motion, which
 * js/site.js adds only when motion is allowed (no reduced-motion
 * preference) and its observers are running. Without JS the page is static.
 */

/* Scroll gauge along the top edge */
.scroll-gauge {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--ok), var(--accent));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* Blocks glide up and fade in, staggered via --d */
.motion .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.8s ease,
    transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1),
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  transition-delay: var(--d, 0ms), var(--d, 0ms), 0ms, 0ms;
}

.motion .reveal.in {
  opacity: 1;
  transform: none;
}

/* Hero waits for "whoami" to finish typing */
.motion .hero .reveal {
  transform: translateY(16px);
}

/* Talks stream in from the left, like log lines */
.motion .log li.reveal {
  transform: translateX(-24px);
}

.motion .log li.reveal.in {
  transform: none;
}

.log li.tail-row {
  grid-template-columns: 1fr;
}

.log .tail {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 14px;
}

/* Blinking terminal caret for typed text */
.motion .caret::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1em;
  margin-left: 4px;
  vertical-align: -0.12em;
  background: var(--accent);
  animation: caret-blink 1s steps(1) infinite;
}

@keyframes caret-blink {
  50% {
    opacity: 0;
  }
}

/* Skill tags pop in one by one */
.motion .tags li {
  opacity: 0;
  transform: scale(0.7);
  transition:
    opacity 0.35s ease,
    transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
  transition-delay: var(--d, 0ms);
}

.motion .tags.in li {
  opacity: 1;
  transform: none;
}

/* Panels glow on hover, like a focused dashboard panel */
.stat:hover,
.cards .panel:hover,
.values .panel:hover,
.skills .panel:hover,
.edu .panel:hover,
.video:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* Experience: a line fills down the timeline as you read */
.timeline-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 2px;
  height: var(--fill, 0%);
  margin-left: -0.5px;
  background: linear-gradient(var(--ok), var(--accent));
  pointer-events: none;
}

.motion .timeline > li::before {
  z-index: 1;
  transition: background 0.3s ease, border-color 0.3s ease;
}

.motion .timeline > li.passed::before {
  background: var(--accent);
  border-color: var(--accent);
}
