/* Epg Guides — shared stylesheet. Palette och typografi: se references/design.md */

/* ---------- Fonts (lokala filer — sajten ska funka offline) ---------- */

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins-400-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins-600-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/poppins-700-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/poppins-900-latin.woff2') format('woff2');
}

/* ---------- Tokens ---------- */

:root {
  --bg: #f5f5f5;
  --bg-2: #eeeeee;
  --bg-3: #e5e5e5;
  --heading: #2f323a;
  /* Body/muted är satta för att klara 4.5:1 även mot --bg-2 (#eeeeee),
     som är den mörkaste bakgrund text hamnar på (alt-sektioner + footern). */
  --body: #5c5c5c;
  --muted: #6a6a6a;
  --accent: #5900ff;
  --accent-2: #8340ff;
  --gradient: linear-gradient(45deg, var(--accent-2) 15%, var(--accent) 65%);
  --line: rgba(0, 0, 0, .25);
  --line-soft: rgba(0, 0, 0, .08);
  --max: 1140px;
}

/* ---------- Base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.7;
  color: var(--body);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--heading); line-height: 1.15; }

h1 { font-size: clamp(2.5rem, 8vw, 6rem); font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: clamp(1.75rem, 4vw, 3rem); font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }

p + p { margin-top: 1em; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { text-decoration: underline; }

/* Länkar i löptext måste gå att se utan färg — accenten mot brödtexten
   ligger på 1.09:1, så understrykningen är enda dugliga signalen. */
p a:not(.btn) { text-decoration: underline; text-underline-offset: .15em; }

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

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

.grad-text {
  background-image: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent); /* fallback */
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--heading);
  color: #f9f9f9;
  padding: .75rem 1.25rem;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Knappar ---------- */

.btn {
  display: inline-block;
  padding: 12px 25px;
  border-radius: 2px;
  background: var(--accent);
  color: #f9f9f9;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.5;
  border: 0;
  cursor: pointer;
}
.btn:hover, .btn:focus {
  background-image: var(--gradient);
  color: #f9f9f9;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--heading);
  position: relative;
  border: 2px solid var(--accent);
}
.btn-outline:hover, .btn-outline:focus {
  background-image: var(--gradient);
  border-color: transparent;
  color: #f9f9f9;
}

/* ---------- Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.site-header.scrolled { border-bottom-color: var(--line-soft); box-shadow: 0 2px 12px rgba(0,0,0,.06); }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: 1rem;
}

.brand {
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: -.01em;
  color: var(--heading);
}
.brand:hover, .brand:focus { text-decoration: none; }
.brand span { color: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  width: 48px;
  height: 48px;
  cursor: pointer;
  color: var(--heading);
}
.nav-toggle svg { width: 28px; height: 28px; margin: auto; }

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.75rem;
  align-items: center;
}
.nav-links a {
  color: var(--heading);
  font-weight: 600;
  font-size: .95rem;
  padding: .5rem 0;
}
.nav-links a:hover, .nav-links a:focus { color: var(--accent); text-decoration: none; }
.nav-links a[aria-current="page"] { color: var(--accent); }

@media (max-width: 800px) {
  .nav-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg);
    flex-direction: column;
    gap: 0;
    padding: .5rem 0 1rem;
    border-bottom: 1px solid var(--line-soft);
    box-shadow: 0 12px 24px rgba(0,0,0,.08);
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: .75rem 1.25rem; width: 100%; }
}

/* ---------- Sektioner ---------- */

section { padding: 4.5rem 0; }
section.alt { background: var(--bg-2); }

.section-head { max-width: 640px; margin-bottom: 2.5rem; }
.kicker {
  color: var(--accent);
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  display: block;
  margin-bottom: .5rem;
}
.section-head p { margin-top: 1rem; }

/* ---------- Hero ---------- */

.hero { padding: 5rem 0 4.5rem; overflow: hidden; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 3rem;
  align-items: center;
}

.hero-copy .sub {
  margin: 1.5rem 0 2rem;
  font-size: 1.1rem;
  max-width: 34rem;
}

.hero-meta { margin-top: 1.25rem; font-size: .9rem; color: var(--muted); }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 420px; margin: 0 auto; }
}

/* ---------- Split-sektioner (text + illustration) ---------- */

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}
.split.rev > .split-art { order: -1; }

@media (max-width: 900px) {
  .split, .split.rev { grid-template-columns: 1fr; }
  .split.rev > .split-art { order: 0; }
  .split-art { max-width: 380px; margin: 0 auto; }
}

/* ---------- Kort ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}
.card {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  padding: 1.75rem;
  border-radius: 2px;
}
section.alt .card { background: var(--bg); }
.card .num {
  font-size: 2.25rem;
  font-weight: 900;
  background-image: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: var(--accent);
  line-height: 1.1;
}
.card h3 { margin: .5rem 0; }
.card p { font-size: .95rem; }

@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }

/* ---------- Tablå-grid ---------- */

.tabla-note {
  font-size: .9rem;
  color: var(--muted);
  margin-bottom: 1.5rem;
}

.tabla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.5rem;
}

.channel {
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
}
.channel-head {
  padding: .85rem 1.15rem;
  border-bottom: 2px solid var(--accent);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.channel-head h3 { font-size: 1.05rem; }
.channel-head a { color: var(--heading); }
.channel-head .count { font-size: .8rem; color: var(--muted); }

.channel ol { list-style: none; }
.channel li {
  display: grid;
  grid-template-columns: 4.25rem 1fr;
  gap: .75rem;
  padding: .65rem 1.15rem;
  border-bottom: 1px solid var(--line-soft);
  font-size: .95rem;
}
.channel li:last-child { border-bottom: 0; }
.channel time { font-weight: 700; color: var(--heading); white-space: nowrap; }
.channel .title { color: var(--body); }
.channel .title small { color: var(--muted); display: block; font-size: .85em; }

.channel li.now {
  background: var(--bg-2);
  box-shadow: inset 3px 0 0 var(--accent);
}
.channel li.now time { color: var(--accent); }

/* ---------- Brödsmulor ---------- */

.crumbs { padding: 1.25rem 0 0; font-size: .85rem; color: var(--muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; }
.crumbs li + li::before { content: "›"; margin-right: .4rem; color: var(--muted); }

/* ---------- Artikel / blogg ---------- */

.post-header { padding: 3rem 0 2rem; }
.post-header h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
.post-meta { margin-top: 1rem; font-size: .9rem; color: var(--muted); }
.post-meta a { color: var(--accent); }

article.post { max-width: 720px; }

.post-art { margin: 0 auto 2.5rem; max-width: 400px; }
.post-art img { width: 100%; height: auto; }
article.post h2 { font-size: 1.6rem; margin: 2.5rem 0 1rem; }
article.post h3 { margin: 1.75rem 0 .75rem; }
article.post ul, article.post ol { padding-left: 1.5rem; margin: 1em 0; }
article.post li + li { margin-top: .35em; }
article.post blockquote {
  border-left: 3px solid var(--accent);
  padding: .5rem 0 .5rem 1.25rem;
  margin: 1.5em 0;
  color: var(--heading);
}
article.post table { border-collapse: collapse; width: 100%; margin: 1.5em 0; }
article.post th, article.post td { border: 1px solid var(--line-soft); padding: .6rem .8rem; text-align: left; font-size: .95rem; }
article.post th { color: var(--heading); background: var(--bg-2); }

.tldr {
  background: var(--bg-2);
  border-left: 3px solid var(--accent);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 2px;
}
.tldr strong { color: var(--heading); }

.toc {
  background: var(--bg-2);
  padding: 1.25rem 1.5rem;
  margin: 2rem 0;
  border-radius: 2px;
  font-size: .95rem;
}
.toc h2 { font-size: 1rem; margin: 0 0 .5rem; }
.toc ol { list-style: decimal; padding-left: 1.25rem; }

.faq h3 { color: var(--heading); }
.faq div + div { margin-top: 1.5rem; }

.byline {
  display: flex;
  gap: 1rem;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  margin-top: 3rem;
  padding-top: 1.5rem;
  font-size: .95rem;
}

.post-list { list-style: none; display: grid; gap: 1.5rem; }
.post-list .card h3 a { color: var(--heading); }
.post-list .meta { font-size: .85rem; color: var(--muted); margin-bottom: .5rem; }

/* ---------- Footer ---------- */

.site-footer { background: var(--bg-2); border-top: 1px solid var(--line-soft); padding: 3.5rem 0 0; }
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}
.footer-grid h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: .75rem; }
.footer-grid ul { list-style: none; }
.footer-grid li { margin: .4rem 0; }
.footer-grid a { color: var(--body); }
.footer-grid a:hover, .footer-grid a:focus { color: var(--accent); }
.footer-grid .about { font-size: .95rem; max-width: 28rem; }

.copyright {
  border-top: 1px solid var(--line-soft);
  padding: 1.1rem 0;
  font-size: .85rem;
  color: var(--muted);
}

@media (max-width: 800px) { .footer-grid { grid-template-columns: 1fr; } }

/* ---------- Scroll-animationer (JS lägger .in) ---------- */

.fx { opacity: 0; transform: translateY(24px); transition: opacity .5s ease, transform .5s ease; }
.fx.in { opacity: 1; transform: none; }
.fx.d1 { transition-delay: .1s; }
.fx.d2 { transition-delay: .2s; }
.fx.d3 { transition-delay: .3s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .fx { opacity: 1; transform: none; transition: none; }
}

/* ---------- Diverse ---------- */

.back-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 48px;
  height: 48px;
  border-radius: 2px;
  background: var(--accent);
  color: #f9f9f9;
  border: 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  z-index: 40;
}
.back-top.show { display: flex; }
.back-top:hover, .back-top:focus { background-image: var(--gradient); }
