/* =================================================================
   Hamilton Blom — Portfolio
   Innehåll:
   1. Variabler & teman
   2. Reset
   3. Typografi
   4. Layout-hjälpklasser
   5. Header & navigation
   6. Hero
   7. Om mig
   8. Erfarenhet (tidslinje)
   9. Kompetenser
   10. Kontakt
   11. Footer & "till toppen"
   12. Knappar
   13. Scroll-reveal-animationer
   14. Responsivitet
   15. Utskrift
   ================================================================= */

/* 1. VARIABLER & TEMAN */
:root {
  /* Typsnitt */
  --font-heading: 'Archivo', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  /* Färger — ljust tema (standard) */
  --bg: #f5f6f7;
  --bg-alt: #eceef0;
  --surface: #ffffff;
  --text: #16181a;
  --text-muted: #5a6169;
  --border: #dbdfe2;
  --accent: #a8480a;
  --accent-soft: rgba(168, 72, 10, 0.1);
  --on-accent: #ffffff;
  --header-bg: rgba(245, 246, 247, 0.85);
  --shadow: 0 1px 2px rgba(22, 24, 26, 0.05), 0 8px 24px rgba(22, 24, 26, 0.07);
  --shadow-hover: 0 4px 10px rgba(22, 24, 26, 0.08), 0 20px 36px rgba(22, 24, 26, 0.12);

  /* Layout */
  --container-width: 1140px;
  --header-height: 72px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --transition: 200ms ease;
}

[data-theme="dark"] {
  --bg: #14171a;
  --bg-alt: #1b1f23;
  --surface: #1e2226;
  --text: #eef0f2;
  --text-muted: #9aa3ab;
  --border: #2c3138;
  --accent: #f2823d;
  --accent-soft: rgba(242, 130, 61, 0.14);
  --on-accent: #14171a;
  --header-bg: rgba(20, 23, 26, 0.85);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.25), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 4px 10px rgba(0, 0, 0, 0.3), 0 24px 44px rgba(0, 0, 0, 0.45);
}

/* 2. RESET */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* 3. TYPOGRAFI */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
}

h1 { font-weight: 800; font-size: clamp(2.75rem, 4vw + 1.2rem, 4.5rem); }
h2 { font-size: clamp(1.9rem, 2.4vw + 1rem, 2.75rem); }
h3 { font-size: 1.15rem; }

p { color: var(--text); }

.section-title { margin-bottom: 1.5rem; }

.section-lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-top: -0.75rem;
  margin-bottom: 2.5rem;
  max-width: 40em;
}

/* 4. LAYOUT-HJÄLPKLASSER */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

section { padding-block: clamp(4rem, 8vw, 7rem); }
.about { background: var(--bg-alt); }
.contact { background: var(--bg-alt); }

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 999;
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus { left: 0; }

/* 5. HEADER & NAVIGATION */
.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  height: var(--header-height);
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}

.site-header.scrolled {
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom-color: var(--border);
}

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1.15rem;
}

.logo-dot { color: var(--accent); }

.nav-list {
  display: flex;
  gap: 2rem;
}

.nav-link {
  position: relative;
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-block: 0.4rem;
  transition: color var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}

.nav-link:hover,
.nav-link.active { color: var(--text); }
.nav-link.active::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 0.35rem; }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--text);
  transition: background var(--transition);
}

.icon-button:hover { background: var(--accent-soft); }
.icon { width: 19px; height: 19px; }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }

.nav-toggle { display: none; }

.hamburger,
.hamburger::before,
.hamburger::after {
  content: '';
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  transition: transform var(--transition), opacity var(--transition), background var(--transition);
}

.hamburger { position: relative; }
.hamburger::before { position: absolute; top: -6px; left: 0; }
.hamburger::after { position: absolute; top: 6px; left: 0; }

.nav-toggle[aria-expanded="true"] .hamburger { background: transparent; }
.nav-toggle[aria-expanded="true"] .hamburger::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .hamburger::after { transform: translateY(-6px) rotate(-45deg); }

/* 6. HERO */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: var(--header-height);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 0.9rem;
}

.hero-role {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 0.9rem;
  font-weight: 500;
}

.hero-text {
  margin-top: 1.4rem;
  max-width: 42em;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.25rem;
}

.hero-visual { display: flex; justify-content: center; }

.profile-photo {
  position: relative;
  width: min(300px, 60vw);
  aspect-ratio: 1;
  margin-inline: auto;
}

.profile-photo-img,
.profile-photo-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-lg);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.profile-photo-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--accent);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 3.25rem;
}

.profile-photo.no-image .profile-photo-fallback { display: flex; }

.viewport-frame {
  position: absolute;
  inset: -18px;
  width: calc(100% + 36px);
  height: calc(100% + 36px);
  pointer-events: none;
}

.viewport-frame polyline {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scroll-indicator {
  position: absolute;
  bottom: clamp(1.5rem, 4vh, 3rem);
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text-muted);
  animation: bob 2.4s ease-in-out infinite;
  transition: color var(--transition), border-color var(--transition);
}

.scroll-indicator:hover { color: var(--accent); border-color: var(--accent); }
.scroll-indicator svg { width: 17px; height: 17px; }

@keyframes bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 6px); }
}

/* 7. OM MIG */
.about-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.about-text p {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 1.2rem;
}

.about-text p:last-child { margin-bottom: 0; }

.about-facts {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.fact dt {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.fact dd { color: var(--text); font-size: 0.98rem; }

/* 8. ERFARENHET / TIDSLINJE */
.timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
}

.timeline-item { position: relative; padding-left: 2.75rem; }

.timeline-marker {
  position: absolute;
  left: 0;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
}

.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.timeline-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.timeline-role {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 0.88rem;
  margin-top: 0.25rem;
}

.timeline-desc { color: var(--text-muted); margin-top: 0.65rem; }

.tag-list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.tag {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

/* 9. KOMPETENSER */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition);
}

.skill-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.skill-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 1.25rem;
}

.skill-icon svg { width: 22px; height: 22px; }
.skill-card h3 { margin-bottom: 1rem; }

/* 10. KONTAKT */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.contact-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent);
}

.contact-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.contact-icon svg { width: 19px; height: 19px; }
.contact-text { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }

.contact-label {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.contact-value {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 11. FOOTER & TILL TOPPEN */
.site-footer { border-top: 1px solid var(--border); }

.footer-inner {
  padding-block: 2rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-top-link { color: var(--accent); font-weight: 600; }

.back-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity var(--transition), transform var(--transition), border-color var(--transition), color var(--transition);
  z-index: 90;
}

.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { border-color: var(--accent); color: var(--accent); }
.back-to-top svg { width: 18px; height: 18px; }

/* 12. KNAPPAR */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid transparent;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition), border-color var(--transition), color var(--transition);
}

.button-primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); }
.button-primary:hover { opacity: 0.9; transform: translateY(-2px); box-shadow: var(--shadow-hover); }

.button-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.button-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }

/* 13. SCROLL-REVEAL */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible { opacity: 1; transform: translateY(0); }

/* 14. RESPONSIVITET */
@media (max-width: 900px) {
  .nav {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height var(--transition), visibility 0s linear var(--transition);
  }

  .nav.open {
    max-height: 320px;
    visibility: visible;
    transition: max-height var(--transition), visibility 0s linear;
  }

  .nav-list { flex-direction: column; gap: 0; padding: 0.5rem clamp(1.25rem, 5vw, 3rem) 1.5rem; }
  .nav-list li { border-bottom: 1px solid var(--border); }
  .nav-list li:last-child { border-bottom: none; }
  .nav-link { display: block; padding-block: 0.9rem; }
  .nav-link::after { display: none; }
  .nav-toggle { display: grid; place-items: center; }

  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .hero-visual { order: -1; }
  .hero-actions { justify-content: center; }

  .about-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .timeline-header { flex-direction: column; align-items: flex-start; }
}

/* 15. UTSKRIFT */
@media print {
  .site-header, .scroll-indicator, .back-to-top, .nav-toggle, #theme-toggle { display: none !important; }
  body { background: #fff; color: #000; }
  .hero { min-height: auto; padding-top: 2rem; }
  section { padding-block: 2rem; }
  .reveal { opacity: 1; transform: none; }
  a { text-decoration: underline; }
}
