/* ══════════════════════════════════════════════════════════════
   Nyhetsportalen — stylesheet
   ══════════════════════════════════════════════════════════════ */

/* ── Reset & variables ──────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:            #f8f7f4;
  --surface:       #ffffff;
  --border:        #e4e0d8;
  --text:          #1a1a1a;
  --text-soft:     #6b6560;
  --accent:        #c0392b;
  --accent-hover:  #a93226;
  --footer-bg:     #141414;
  --footer-text:   #a0a0a0;
  --font-display:  'Playfair Display', Georgia, serif;
  --font-body:     'Source Sans 3', 'Segoe UI', sans-serif;
  --max-w:         1120px;
  --radius:        6px;
  --header-h:      70px;
}

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

a { color: inherit; text-decoration: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Utility ────────────────────────────────────────── */
.wrapper {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-inline: clamp(16px, 4vw, 24px);
  padding-left:  max(clamp(16px, 4vw, 24px), env(safe-area-inset-left));
  padding-right: max(clamp(16px, 4vw, 24px), env(safe-area-inset-right));
}

/* ── Header / brand bar ─────────────────────────────── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__inner {
  display: flex;
  align-items: center;
  gap: 40px;
  height: var(--header-h);
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo__icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo__icon svg { width: 20px; height: 20px; fill: #fff; }

.logo__text {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(1.1rem, 1vw + 0.9rem, 1.35rem);
  letter-spacing: -0.02em;
  color: var(--text);
}

.logo__text span { color: var(--accent); }

/* ── Navigation ─────────────────────────────────────── */
.nav { display: flex; align-items: center; gap: 4px; }

.nav__link {
  position: relative;
  padding: 8px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
  border-radius: var(--radius);
  transition: color .2s, background .2s;
}

.nav__link:hover {
  color: var(--text);
  background: rgba(0,0,0,.04);
}

.nav__link--active { color: var(--accent); }

.nav__link--active::after {
  content: '';
  position: absolute;
  bottom: -21px;
  left: 18px;
  right: 18px;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
}

/* Hamburger button — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  content: '';
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, top .25s ease;
  position: relative;
}
.nav-toggle__bars::before { position: absolute; top: -7px; left: 0; }
.nav-toggle__bars::after  { position: absolute; top:  7px; left: 0; }

.nav-toggle[aria-expanded="true"] .nav-toggle__bars {
  background: transparent;
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before {
  top: 0;
  transform: rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ── Dateline strip ─────────────────────────────────── */
.dateline {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.dateline__text {
  display: block;
  font-size: 0.82rem;
  color: var(--text-soft);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.dateline__text::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════════════════════════
   News feed (index)
   ══════════════════════════════════════════════════════ */
.feed { padding: 40px 0 60px; }

.feed__hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 48px;
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: box-shadow .25s, transform .25s;
}

.card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,.07);
  transform: translateY(-3px);
}

.card__image-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.card__image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s ease;
}

.card:hover .card__image-wrap img { transform: scale(1.04); }

.card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 3px;
}

.card__body { padding: 22px 24px 26px; }

.card__time {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.card__title {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.2vw + 0.9rem, 1.35rem);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  color: var(--text);
  transition: color .2s;
}

.card:hover .card__title { color: var(--accent); }

.card__lead {
  font-size: 0.95rem;
  color: var(--text-soft);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.feed__grid .card__title {
  font-size: clamp(1rem, 0.8vw + 0.9rem, 1.1rem);
}

.feed__divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.feed__divider h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  white-space: nowrap;
}

.feed__divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ══════════════════════════════════════════════════════
   Article page
   ══════════════════════════════════════════════════════ */
.article-hero {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.article-hero img {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 520px;
  object-fit: cover;
}

.article-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.55) 0%, transparent 60%);
}

.article-hero__badge {
  position: absolute;
  top: 24px;
  left: 24px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 3px;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 48px;
  padding: 0 0 60px;
}

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

.article-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}

.article-header__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw + 0.75rem, 2.6rem);
  font-weight: 900;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  color: var(--text);
}

.article-header__lead {
  font-size: 1.22rem;
  line-height: 1.65;
  color: var(--text-soft);
  font-weight: 400;
}

/* Byline */
.byline {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 36px;
}

.byline__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #e67e22);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
  flex-shrink: 0;
}

.byline__name { font-weight: 600; font-size: 0.95rem; }
.byline__time { font-size: 0.84rem; color: var(--text-soft); }

/* Body text */
.article-body p {
  font-size: 1.12rem;
  line-height: 1.82;
  margin-bottom: 24px;
  color: #2c2c2c;
}

.article-body p:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 3.8rem;
  font-weight: 900;
  float: left;
  line-height: 0.8;
  margin: 6px 12px 0 0;
  color: var(--accent);
}

/* Share bar */
.share-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  margin-top: 16px;
}

.share-bar__label {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.share-bar__btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}

.share-bar__btn:hover {
  border-color: var(--accent);
  background: var(--accent);
}

.share-bar__btn:hover svg,
.share-bar__btn.is-copied svg { fill: #fff; }
.share-bar__btn.is-copied {
  background: var(--accent);
  border-color: var(--accent);
}

.share-bar__btn svg {
  width: 15px;
  height: 15px;
  fill: var(--text-soft);
  transition: fill .2s;
}

/* Sidebar */
.sidebar { padding-top: 40px; }

.sidebar__heading {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
}

.sidebar-card {
  display: flex;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  transition: opacity .2s;
}

.sidebar-card:hover { opacity: .75; }

.sidebar-card__img {
  width: 96px;
  height: 68px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-card__title {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 4px;
}

.sidebar-card__time { font-size: 0.76rem; color: var(--text-soft); }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 28px;
  transition: gap .2s;
}

.back-link:hover { gap: 10px; }
.back-link svg { width: 16px; height: 16px; fill: var(--accent); }

/* ══════════════════════════════════════════════════════
   Footer
   ══════════════════════════════════════════════════════ */
.footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: 56px 0 calc(36px + env(safe-area-inset-bottom));
}

.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 48px;
  margin-bottom: 48px;
}

.footer__brand-text {
  font-size: 0.88rem;
  line-height: 1.7;
  margin-top: 14px;
  max-width: 300px;
}

.footer__heading {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 18px;
}

.footer__links { list-style: none; }
.footer__links li { margin-bottom: 10px; }

.footer__links a {
  font-size: 0.88rem;
  color: var(--footer-text);
  transition: color .2s;
}
.footer__links a:hover { color: #fff; }

.footer__bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.footer__socials { display: flex; gap: 16px; }

.footer__socials a {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, background .2s;
}

.footer__socials a:hover { border-color: var(--accent); background: var(--accent); }
.footer__socials svg { width: 15px; height: 15px; fill: #fff; }

/* ══════════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════════ */

/* Tablet */
@media (max-width: 900px) {
  .feed__hero { grid-template-columns: 1fr; gap: 20px; margin-bottom: 32px; }
  .feed__grid { grid-template-columns: 1fr 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; }
  .article-layout { grid-template-columns: 1fr; gap: 32px; padding-bottom: 40px; }
  .sidebar { padding-top: 0; }
}

/* Phone — activate hamburger */
@media (max-width: 720px) {
  :root { --header-h: 60px; }

  .header__inner {
    gap: 12px;
    flex-wrap: wrap;
  }

  .nav-toggle { display: flex; }

  .nav {
    display: none;
    order: 3;
    width: 100%;
    flex-direction: column;
    gap: 0;
    padding: 8px 0 12px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    margin: 0 calc(-1 * clamp(16px, 4vw, 24px));
    padding-inline: clamp(16px, 4vw, 24px);
  }
  .nav--open { display: flex; }

  .nav__link {
    width: 100%;
    padding: 14px 12px;
    font-size: 0.9rem;
    border-radius: var(--radius);
  }
  .nav__link--active { background: rgba(192, 57, 43, 0.08); }
  .nav__link--active::after { display: none; }

  .dateline { padding: 8px 0; }
  .dateline__text { font-size: 0.72rem; }

  .feed { padding: 24px 0 40px; }
  .feed__grid { grid-template-columns: 1fr; gap: 16px; }
  .card__body { padding: 16px 18px 20px; }
  .card__lead { -webkit-line-clamp: 2; }

  .article-hero img { aspect-ratio: 4 / 3; max-height: 320px; }
  .article-hero__badge { top: 14px; left: 14px; font-size: 0.68rem; }
  .article-header { padding: 24px 0 20px; margin-bottom: 24px; }
  .article-body p { font-size: 1rem; line-height: 1.7; margin-bottom: 18px; }
  .article-body p:first-child::first-letter {
    font-size: 2.8rem;
    margin: 4px 8px 0 0;
  }
  .byline { gap: 10px; margin-bottom: 24px; }
  .byline__avatar { width: 38px; height: 38px; }
  .share-bar { padding: 18px 0; }
  .sidebar-card__img { width: 80px; height: 60px; }

  .footer__grid { grid-template-columns: 1fr; }
  .footer__bottom { flex-direction: column; gap: 16px; text-align: center; }
}

/* Small phone */
@media (max-width: 380px) {
  .article-header__title { font-size: 1.55rem; }
  .article-body p:first-child::first-letter { font-size: 2.4rem; }
}

/* Sticky header anchor offset */
:target { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ══════════════════════════════════════════════════════
   Animations
   ══════════════════════════════════════════════════════ */
.card {
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp .5s ease forwards;
}
.card:nth-child(1) { animation-delay: .05s; }
.card:nth-child(2) { animation-delay: .12s; }
.card:nth-child(3) { animation-delay: .19s; }
.card:nth-child(4) { animation-delay: .26s; }
.card:nth-child(5) { animation-delay: .33s; }
.card:nth-child(6) { animation-delay: .40s; }

@keyframes fadeUp {
  to { opacity: 1; transform: translateY(0); }
}

.article-main, .sidebar {
  opacity: 0;
  animation: fadeIn .6s ease .1s forwards;
}
.sidebar { animation-delay: .25s; }

@keyframes fadeIn {
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card { opacity: 1; transform: none; }
  .article-main, .sidebar { opacity: 1; }
}
