:root {
  --bg: #ffffff;
  --fg: #161616;
  --muted: #6e6e6e;
  --accent: #3358d4;
  --border: #e6e6e6;
  --card-bg: #fafafa;
}

:root[data-theme="dark"] {
  --bg: #0b0b0c;
  --fg: #ededec;
  --muted: #949494;
  --accent: #7c9cff;
  --border: #232324;
  --card-bg: #131314;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.65;
  font-size: 17px;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3 {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

a {
  color: var(--fg);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0% 1px;
  border-bottom: 1px solid var(--border);
  transition: background-size 0.25s ease, color 0.2s ease, border-color 0.2s ease;
}

a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  max-width: 600px;
  margin: 3rem auto;
}

/* scroll progress */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 20;
  background: transparent;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.08s linear;
}

.theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  display: grid;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--fg);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, transform 0.3s cubic-bezier(.34,1.56,.64,1), background-color 0.2s ease;
}

.theme-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: rotate(-14deg) scale(1.06);
}

.theme-toggle:active {
  transform: scale(0.92);
}

.theme-toggle svg {
  grid-area: 1 / 1;
  transition: opacity 0.2s ease, transform 0.3s ease;
}

.theme-toggle .moon {
  display: block;
}

.theme-toggle .sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .sun {
  display: block;
}

/* hero: centered, aleksagordic-style */
.hero {
  max-width: 560px;
  margin: 0 auto;
  padding: 6.5rem 1.5rem 3.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.in {
  opacity: 0;
  animation: fade-in-up 0.7s cubic-bezier(.22,.61,.36,1) forwards;
  animation-delay: calc(var(--d, 0) * 0.12s);
}

.avatar {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
  margin-bottom: 1.75rem;
  transition: transform 0.35s cubic-bezier(.22,.61,.36,1), box-shadow 0.35s ease;
  box-shadow: 0 0 0 6px var(--card-bg);
}

.avatar:hover {
  transform: scale(1.04);
  box-shadow: 0 0 0 6px var(--card-bg), 0 8px 24px -12px var(--accent);
}

.hero h1 {
  font-size: 1.85rem;
  margin: 0 0 0.6rem;
}

.tagline {
  color: var(--muted);
  margin: 0 0 2rem;
}

.links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: none;
  background-image: none;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  position: relative;
  padding-bottom: 2px;
}

.links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(.22,.61,.36,1);
}

.links a:hover {
  color: var(--fg);
}

.links a:hover::after {
  transform: scaleX(1);
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

section h2 {
  font-size: 1.2rem;
  margin: 0 0 1.25rem;
}

section p {
  margin: 0 0 1rem;
}

/* scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(.22,.61,.36,1), transform 0.6s cubic-bezier(.22,.61,.36,1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-item {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s cubic-bezier(.22,.61,.36,1), transform 0.5s cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--d, 0s);
}

.reveal-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.phrases {
  margin: 1.25rem 0 1.75rem;
  padding: 0.1rem 0 0.1rem 1.25rem;
  border-left: 2px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.phrases p {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.signoff {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-style: italic;
  color: var(--muted);
  font-size: 0.95rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 34px 110px 1fr;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  transition: transform 0.2s ease;
}

.timeline li:hover {
  transform: translateX(3px);
}

.timeline li:last-child {
  border-bottom: none;
}

.tl-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.timeline li:hover .tl-logo {
  color: var(--accent);
  border-color: var(--accent);
}

.tl-when {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pubs li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.pubs li:last-child {
  border-bottom: none;
}

.pubs li a {
  font-weight: 600;
}

.pub-meta {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.card {
  display: block;
  border: 1px solid var(--border);
  background: var(--card-bg);
  background-image: none;
  border-radius: 8px;
  padding: 1.1rem 1.2rem;
  transition: border-color 0.2s ease, transform 0.25s cubic-bezier(.22,.61,.36,1), box-shadow 0.25s ease;
}

.card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px -16px var(--accent);
}

.card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

.card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 0.7rem;
}

.card .lang {
  font-size: 0.75rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.card-wip {
  opacity: 0.55;
}

.card-wip.visible {
  opacity: 0.55;
}

.card-wip:hover {
  border-color: var(--border);
  transform: none;
  box-shadow: none;
}

.wip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.65rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1rem 0.35rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.more {
  margin-top: 1rem;
  font-size: 0.9rem;
}

.more a {
  border-bottom: none;
  background-image: none;
  color: var(--muted);
}

.more a:hover {
  color: var(--accent);
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0 1.5rem 3rem;
}

@media (max-width: 600px) {
  body {
    font-size: 16px;
  }
  main {
    padding: 0 1.25rem 3rem;
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .timeline li {
    grid-template-columns: 32px 1fr;
    grid-template-areas:
      "logo when"
      "logo what";
    row-gap: 0.3rem;
    column-gap: 0.75rem;
    padding: 0.75rem 0;
  }
  .tl-logo { grid-area: logo; align-self: start; }
  .tl-when { grid-area: when; }
  .tl-what { grid-area: what; }
  .hero {
    padding: 5rem 1.25rem 2.5rem;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .links {
    gap: 0.6rem 1rem;
  }
  .avatar {
    width: 108px;
    height: 108px;
  }
  .theme-toggle {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }
  section h2 {
    font-size: 1.15rem;
  }
}

@media (max-width: 360px) {
  .hero h1 {
    font-size: 1.45rem;
  }
  .avatar {
    width: 96px;
    height: 96px;
  }
  .phrases p {
    font-size: 1.05rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .in, .reveal, .reveal-item, .avatar, .card, .timeline li, .theme-toggle {
    animation: none !important;
    transition: none !important;
  }
}
