/* =========================================================
   Design tokens
   ========================================================= */
:root {
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #171B1F;
  --muted: #5B6472;
  --line: #DCE1E7;

  --accent: #3B4FD9;      /* "keyword" blå */
  --accent-ink: #FFFFFF;
  --string: #B5541A;      /* "sträng"-orange, används sparsamt */
  --ok: #1E824C;          /* klar */
  --progress: #B58A1E;    /* pågår */
  --todo: #8A93A0;        /* ej påbörjad */

  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;

  --radius: 6px;
  --max-w: 780px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171B;
    --surface: #1C2025;
    --ink: #ECEFF2;
    --muted: #9AA3AF;
    --line: #2C3138;
    --accent: #7C8CFF;
    --string: #E08A4E;
    --ok: #3FBE7C;
    --progress: #E0B34E;
    --todo: #6B7482;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

code {
  font-family: var(--mono);
  background: var(--line);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

/* =========================================================
   Window chrome (dekorativt)
   ========================================================= */
.window-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot-red { background: #E5605A; }
.dot-yellow { background: #E5B35A; }
.dot-green { background: #5AB86B; }

.chrome-title {
  margin-left: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* =========================================================
   Tab-navigering (funktionell)
   ========================================================= */
.tab-nav {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  overflow-x: auto;
}

.tab {
  font-family: var(--mono);
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--muted);
  padding: 12px 16px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.tab:hover,
.tab:focus-visible {
  color: var(--ink);
}

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

.tab-nav a:target,
.tab:active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 72px 24px 48px;
}

.path-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.hero-name {
  font-family: var(--mono);
  font-size: clamp(0.95rem, 3.2vw, 1.85rem);
  font-weight: 700;
  margin: 0 0 20px;
  white-space: nowrap;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px; /* utrymme åt scrollbaren så texten inte känns skavd */
  animation: fade-in 0.6s ease both;
}

/* Dölj scrollbaren visuellt men låt raden fortfarande scrolla vid behov */
.hero-name::-webkit-scrollbar { height: 4px; }
.hero-name::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.code-kw { color: var(--accent); }
.code-str { color: var(--string); }
.code-op { color: var(--muted); }

.hero-tagline {
  max-width: 52ch;
  font-size: 1.05rem;
  color: var(--muted);
}

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

@media (prefers-reduced-motion: reduce) {
  .hero-name {
    animation: none;
  }
}

/* =========================================================
   Sektioner
   ========================================================= */
.section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 48px 24px;
  border-top: 1px solid var(--line);
}

.section-label {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  margin: 0 0 8px;
}

.section-title {
  font-size: 1.5rem;
  margin: 0 0 12px;
}

.section-intro {
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 28px;
}

/* ---- Om mig ---- */
.about-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 32px;
  align-items: start;
}

.avatar-frame {
  width: 160px;
  height: 160px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
}

.avatar-hint {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.4;
}

.fact-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.fact-list li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 12px;
}

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

/* ---- Uppgifter ---- */
.assignment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.assignment-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  padding: 16px 18px;
}

.assignment-index {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.85rem;
}

.assignment-title {
  display: block;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 4px;
}

.assignment-title:hover,
.assignment-title:focus-visible {
  color: var(--accent);
}

.assignment-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-done { color: var(--ok); background: color-mix(in srgb, var(--ok) 15%, transparent); }
.status-progress { color: var(--progress); background: color-mix(in srgb, var(--progress) 15%, transparent); }
.status-todo { color: var(--todo); background: color-mix(in srgb, var(--todo) 15%, transparent); }

/* ---- Bilder ---- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
}

.gallery-item {
  margin: 0;
}

.gallery-placeholder {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  padding: 8px;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
}

.gallery-item figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---- Kontakt ---- */
.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.95rem;
}

.contact-list a {
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 2px;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.contact-list a:hover,
.contact-list a:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 64px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a {
  text-decoration: none;
  color: var(--muted);
}
.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
}

/* =========================================================
   Responsivt
   ========================================================= */
@media (max-width: 560px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
  .avatar-frame {
    width: 120px;
    height: 120px;
  }
  .assignment-item {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .assignment-index {
    display: none;
  }
}