/* Theme tokens */
:root {
  --bg: #0b0e14;
  --text: #e6e6e6;
  --muted: #9aa4b2;
  --card: #12151e;
  --border: #202434;
  --accent: #7aa2f7;
  --accent-2: #bb9af7;
  --success: #9ece6a;
  --warning: #e0af68;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Light theme tokens */
:root[data-theme="light"] {
  --bg: #f7f8fb;
  --text: #111827;
  --muted: #4b5563;
  --card: #ffffff;
  --border: #e5e7eb;
  --shadow: 0 6px 24px rgba(0,0,0,.08);
}

/* Dark theme tokens fallback */
:root[data-theme="dark"] {}

/* Base */
* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(122,162,247,.12), transparent 60%),
    radial-gradient(800px 400px at 90% 10%, rgba(187,154,247,.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;  /* thickness */
  z-index: 1000;

  /* Animated gradient */
  background: linear-gradient(
    90deg,
    #ff4b1f,
    #ff9068,
    #1fddff,
    #28a745,
    #bb9af7
  );
  background-size: 400% 100%;
  animation: gradientMove 2s linear infinite;
}

@keyframes gradientMove {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* Push body content down so it’s not covered */
body {
  padding-top: 5px; /* match height of .top-bar */
}

h1, h2, h3, h4 { margin: 0 0 8px; }
.muted { color: var(--muted); }
.spacer { flex: 1 1 auto; }

/* Header & Nav */
.header {
  max-width: 1100px;
  margin: 24px auto 0;
  padding: 0 20px;
}

.nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.nav-links {
  display: flex;
  gap: 12px;
}

.nav a {
  padding: 8px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
}

.nav a:hover {
  background: rgba(122,162,247,.15);
}

.nav a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: transform .12s ease, box-shadow .12s ease;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

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

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

.btn.small {
  padding: 8px 12px;
  font-size: 14px;
}

/* Hero */
.hero {
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 16px 0 0;
  position: relative;
}

.hero::before {
  content: "oskar@portfolio:~ $";
  display: inline-block;
  font-family: var(--mono);
  color: var(--muted);
  margin-right: 8px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: -0.02em;
}

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

/* Sections */
.section {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 20px;
}

.section h2 {
  font-family: var(--mono);
  color: var(--accent-2);
  letter-spacing: -0.5px;
}

.section-head {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* Filters & Sort */
.filters {
  display: flex;
  gap: 8px;
}

.filters button {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor: pointer;
}

.filters button.active,
.filters button:hover {
  border-color: rgba(122,162,247,.45);
}

.sort select {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
}

/* Grid & Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  border-color: rgba(122,162,247,.45);
}

.card h3 {
  margin: 4px 0 6px;
  font-size: 18px;
}

.card p {
  margin: 0 0 12px;
  color: var(--muted);
}

.card img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  margin-top: 10px;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.3);
}

.tag.js {
  color: var(--warning);
  border-color: rgba(224,175,104,.35);
}

.tag.py {
  color: var(--success);
  border-color: rgba(158,206,106,.35);
}

.tag.cpp {
  color: var(--accent);
  border-color: rgba(122,162,247,.35);
}

/* Timeline */
.timeline {
  border-left: 2px dashed var(--border);
  margin: 24px 0;
  padding-left: 18px;
}

.entry {
  position: relative;
  margin: 0 0 18px;
}

.entry::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(122,162,247,.25);
}

.entry .meta {
  color: var(--muted);
  font-size: 14px;
}

/* Footer */
.footer {
  max-width: 1100px;
  margin: 48px auto;
  padding: 0 20px 40px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
}

.social {
  display: flex;
  gap: 12px;
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: 400ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* Copy button for code blocks (optional) */
pre.code {
  position: relative;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.copy-btn:active {
  transform: translateY(1px);
}

/* Lightbox */
#lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: grid;
  place-items: center;
}

#lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 12px;
}

#lightbox[hidden] {
  display: none;
}

/* Back to top */
#to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
}

/* Accessibility + motion */
a {
  text-decoration: none;
  position: relative;
}

a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  height: 2px;
  width: 0;
  background: currentColor;
  transition: width .2s ease;
}

a:hover::after {
  width: 100%;
}

html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Mobile tweaks */
@media (max-width: 720px) {
  .nav { gap: 8px; }
  .nav-links { width: 100%; }
}
