/* ==========================================================================
   AI-Bladet — "Nattupplagan"  (midnight broadsheet)
   A warm-ink editorial newspaper. Grotesque masthead over serif columns.
   Fonts: Familjen Grotesk (UI/labels) + Newsreader (display/body)
   ========================================================================== */

/* ----------  Self-hosted fonts  ------------------------------------------ */
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/fonts/FamiljenGrotesk-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Familjen Grotesk";
  src: url("/fonts/FamiljenGrotesk-Bold.ttf") format("truetype");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/Newsreader-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/Newsreader-Italic.ttf") format("truetype");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/Newsreader-SemiBold.ttf") format("truetype");
  font-weight: 600; font-style: normal; font-display: swap;
}

/* ----------  Tokens  ----------------------------------------------------- */
:root {
  --ink:      #1C1C1C;   /* deep ink — main body text */
  --ink-2:    #2B2B2B;   /* raised surface (cards, hover) */
  --ink-3:    #3A3A3A;   /* hover surface */
  --paper:    #FFF8F0;   /* cream luxury paper — background */
  --paper-2:  #F5EEE6;   /* secondary surface (alternate cards) */
  --dim:      #7A756A;   /* muted meta text */
  --faint:    #B0A99C;   /* hairline-adjacent text */
  --rule:     rgba(0, 0, 0, 0.08);
  --rule-2:   rgba(0, 0, 0, 0.16);
  --accent:   #C41230;   /* classic red (Economist-inspired) */
  --accent-dim: #8A0E22; /* darker red for hover */
  --kicker:   #C41230;   /* red kickers */

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --grot:  "Familjen Grotesk", "Helvetica Neue", Arial, sans-serif;

  --measure: 1200px;
  --gutter: clamp(1.1rem, 4vw, 3rem);
}

/* ----------  Reset  ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  font-feature-settings: "liga" 1, "kern" 1, "onum" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Atmospheric layers: warm top glow + fine paper grain */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(196, 18, 48, 0.03), transparent 60%),
    radial-gradient(90% 60% at 85% 0%, rgba(196, 18, 48, 0.02), transparent 55%);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  opacity: 0.05; mix-blend-mode: overlay; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection { background: var(--accent); color: var(--paper); }

a { color: inherit; text-decoration: none; }

/* ----------  Masthead  --------------------------------------------------- */
.masthead {
  padding: clamp(1.1rem, 3vw, 2rem) var(--gutter) 0;
  max-width: var(--measure);
  margin: 0 auto;
}
.masthead-top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--grot);
  font-size: 0.66rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--dim);
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--rule);
}
.masthead-top .pulse { color: var(--accent); }
.masthead-top .pulse::before {
  content: "●"; font-size: 0.6em; margin-right: 0.5em;
  vertical-align: 0.18em; animation: blink 2.6s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.35} }

.masthead-brand {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; flex-wrap: wrap;
  padding: clamp(0.8rem, 2vw, 1.4rem) 0 0.5rem;
}
.masthead-name a {
  display: block;
  font-family: var(--grot);
  font-weight: 700;
  font-size: clamp(2.5rem, 8.5vw, 5.6rem);
  line-height: 0.9;
  letter-spacing: -0.045em;
  color: var(--ink);
  transition: color 0.3s ease;
}
.masthead-name a:hover { color: var(--accent); }
.masthead-name .bladet { color: var(--accent); }
.masthead-tag {
  font-family: var(--grot);
  font-size: 0.74rem; letter-spacing: 0.04em; line-height: 1.4;
  color: var(--dim); max-width: 22ch; text-align: right;
  padding-bottom: 0.45rem;
}

/* Double rule under masthead — classic broadsheet */
.masthead-rule {
  max-width: var(--measure); margin: 0 auto;
  padding: 0 var(--gutter);
}
.masthead-rule::before {
  content: ""; display: block; height: 0;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: 4px;
}

/* ----------  Navigation / edition strip  -------------------------------- */
.edition {
  max-width: var(--measure); margin: 0 auto;
  padding: 0.7rem var(--gutter) 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  font-family: var(--grot);
}
.edition-meta {
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--dim);
}
.edition-meta b { color: var(--ink); font-weight: 700; }
.nav { display: flex; gap: 0.4rem; align-items: center; }
.nav a {
  position: relative;
  font-size: 0.74rem; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 700;
  padding: 0.35rem 0.55rem;
  transition: color 0.25s ease;
}
.nav a::after {
  content: ""; position: absolute; left: 0.55rem; right: 0.55rem; bottom: 0.15rem;
  height: 2px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 0.3s ease;
}
.nav a:hover { color: var(--accent); }
.nav a:hover::after { transform: scaleX(1); }

/* ----------  Page container  -------------------------------------------- */
.sheet {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) var(--gutter) 5rem;
}

/* ----------  Lead story  ------------------------------------------------- */
.lead {
  padding-bottom: clamp(2rem, 4vw, 3.2rem);
  margin-bottom: clamp(2rem, 4vw, 3.2rem);
  border-bottom: 1px solid var(--rule);
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.lead-kicker {
  font-family: var(--grot);
  font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap;
  margin-bottom: 1.1rem;
}
.lead-kicker::before {
  content: ""; width: 2.2rem; height: 2px; background: var(--accent);
}
.lead-sources { color: var(--dim); font-weight: 400; letter-spacing: 0.12em; }
.lead-headline {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 6.2vw, 4.7rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 1.4rem;
  max-width: 18ch;
  text-wrap: balance;
}
.lead-headline a { transition: color 0.25s ease; }
.lead-headline a:hover { color: var(--accent); }
.lead-ingress {
  font-size: clamp(1.18rem, 2vw, 1.45rem);
  line-height: 1.55;
  color: var(--dim);
  max-width: 60ch;
}
.lead-ingress::first-letter {
  initial-letter: 2;
  -webkit-initial-letter: 2;
  font-weight: 600; color: var(--accent);
  margin-right: 0.5rem;
}
.lead-analysis {
  margin-top: 1.8rem;
  max-width: 60ch;
  padding: 1.1rem 1.4rem;
  background: var(--paper-2);
  border-left: 3px solid var(--accent);
}
.lead-analysis-label {
  display: block;
  font-family: var(--grot);
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.lead-analysis p {
  margin: 0;
  font-size: 1.0rem; line-height: 1.55;
  color: var(--ink-2);
}

/* ----------  Sections row (categories)  --------------------------------- */
.sections {
  font-family: var(--grot);
  font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--dim);
  display: flex; flex-wrap: wrap; gap: 0.25rem 1rem;
  margin: -1.2rem 0 2.4rem;
}
.sections .label { color: var(--faint); }
.sections .cat { color: var(--dim); }
.sections .cat::before { content: "· "; color: var(--accent-dim); margin-right: 0.15em; }

/* ----------  Figures (images + branded fallback)  ----------------------- */
.figure { margin: 0; display: block; }
.figure-frame {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  max-height: 300px;            /* editorial press-photo band, not a giant hero */
  background: var(--ink);
}
.figure-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  z-index: 1;
}
/* Branded placeholder behind the image — revealed when no/dead image. */
.figure-fallback {
  position: absolute; inset: 0; z-index: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--grot); font-weight: 700;
  letter-spacing: -0.04em;
  font-size: clamp(1.5rem, 4.5vw, 2.8rem);
  color: var(--paper);
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(196, 18, 48, 0.55), transparent 55%),
    radial-gradient(130% 150% at 100% 100%, rgba(196, 18, 48, 0.28), transparent 55%),
    var(--ink);
}
.figure-fallback-b { color: var(--accent); }
/* Newspaper-style photo byline under each image */
.figure-credit {
  margin-top: 0.5rem;
  font-family: var(--grot);
  font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--faint);
}

/* ----------  Lead hero image  ------------------------------------------- */
.lead-figure { margin-bottom: clamp(1.4rem, 3vw, 2.2rem); }
.lead-figure .figure-frame {
  aspect-ratio: 16 / 8;
  max-height: 456px;
  box-shadow: 0 20px 44px -26px rgba(0, 0, 0, 0.6);
}

/* ----------  Stories column (single vertical, tabloid-style)  ----------- */
.stories-column {
  display: flex;
  flex-direction: column;
}
.story-card {
  position: relative;
  padding: clamp(1.8rem, 4vw, 2.8rem) 0;
  border-top: 1px solid var(--rule);
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.story-card:first-child { border-top: none; padding-top: 0; }
.story-figure { margin-bottom: clamp(1rem, 2.5vw, 1.4rem); }
.story-figure .figure-frame {
  max-height: 336px;
  box-shadow: 0 14px 32px -24px rgba(0, 0, 0, 0.55);
  transition: filter 0.35s ease;
}
.story-card:hover .story-figure .figure-frame { filter: saturate(1.06) contrast(1.02); }
.story-text { max-width: 66ch; }
.story-kicker {
  font-family: var(--grot);
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.6rem;
}
.story-headline {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: 0;
  text-wrap: balance;
}
.story-ingress {
  margin-top: 0.85rem;
  font-size: clamp(1.05rem, 1.5vw, 1.22rem);
  line-height: 1.55;
  color: var(--dim);
}
/* Pull-quote — real, sourced quotes sprinkled through the column */
.story-quote {
  margin: 1.4rem 0 0;
  padding: 0.1rem 0 0.1rem 1.5rem;
  border-left: 3px solid var(--accent);
  max-width: 56ch;
}
.story-quote p {
  position: relative;
  margin: 0;
  font-family: var(--serif);
  font-weight: 500; font-style: italic;
  font-size: clamp(1.3rem, 2.3vw, 1.75rem);
  line-height: 1.26;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-wrap: balance;
}
.story-quote cite {
  display: block;
  margin-top: 0.75rem;
  font-family: var(--grot); font-style: normal;
  font-size: 0.72rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent);
}
.story-quote cite::before { content: "— "; }
.story-body-wrap {
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.story-body {
  margin-top: 0.95rem;
  font-size: 1.06rem; line-height: 1.62;
  color: var(--ink-2);
  max-width: 62ch;
}
.story-body:first-child { margin-top: 1.1rem; }
.story-more {
  display: inline-flex; align-items: center; gap: 0.5rem;
  margin-top: 1.05rem;
  font-family: var(--grot);
  font-size: 0.74rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent);
  background: none; border: 0; cursor: pointer;
  padding: 0.2rem 0;
  -webkit-appearance: none; appearance: none;
  transition: gap 0.2s ease, opacity 0.2s ease;
}
.story-more:hover { gap: 0.8rem; opacity: 0.78; }
.story-more-arrow { font-size: 1.05em; line-height: 1; }

/* staggered entrance */
.story-card:nth-child(1){animation-delay:.05s}
.story-card:nth-child(2){animation-delay:.11s}
.story-card:nth-child(3){animation-delay:.17s}
.story-card:nth-child(4){animation-delay:.23s}
.story-card:nth-child(5){animation-delay:.29s}
.story-card:nth-child(6){animation-delay:.35s}

/* ----------  Briefs / Kortnytt  ----------------------------------------- */
.briefs-section {
  margin-top: clamp(2.6rem, 5vw, 4rem);
  padding: clamp(1.6rem, 3vw, 2.4rem);
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  animation: rise 0.8s cubic-bezier(0.16, 1, 0.3, 1) 0.4s both;
}
.briefs-header {
  font-family: var(--grot);
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink);
  display: flex; align-items: center; gap: 0.9rem;
  margin-bottom: 1.3rem;
}
.briefs-header::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}
.briefs-list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.1rem 2.4rem;
}
.briefs-list li {
  display: flex; gap: 0.8rem;
  padding: 0.7rem 0;
  font-size: 1.04rem; line-height: 1.4;
  color: var(--dim);
  border-top: 1px solid var(--rule);
}
.briefs-list li::before {
  content: "→"; color: var(--accent); flex-shrink: 0;
  font-family: var(--grot); font-weight: 700;
}

/* ----------  Bottom navigation / folio  --------------------------------- */
.bottom-nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  margin-top: clamp(2.4rem, 5vw, 3.6rem);
  padding-top: 1.3rem;
  border-top: 1px solid var(--rule);
  font-family: var(--grot);
  font-size: 0.78rem; letter-spacing: 0.06em;
}
.bottom-nav a {
  color: var(--accent); font-weight: 700;
  letter-spacing: 0.08em;
  transition: opacity 0.2s ease;
}
.bottom-nav a:hover { opacity: 0.7; }
.bottom-nav .folio {
  color: var(--dim); text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.7rem;
}
.bottom-nav--cta { justify-content: flex-start; gap: 1.6rem; }

/* ----------  Interior pages (archive / about / 404)  -------------------- */
.page-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.04; letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  animation: rise 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.page-intro {
  font-size: 1.2rem; color: var(--dim);
  max-width: 56ch; margin: 0 0 clamp(2rem, 4vw, 3rem);
}

/* Archive */
.archive-year {
  font-family: var(--grot);
  font-size: 0.82rem; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent);
  display: flex; align-items: baseline; gap: 0.9rem;
  margin: 2.6rem 0 0.4rem;
}
.archive-year::after {
  content: ""; flex: 1; height: 1px; background: var(--rule);
}
.archive-year span { color: var(--dim); font-weight: 400; letter-spacing: 0.1em; }
.issue-card {
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) 1fr;
  gap: 0.5rem 2rem; align-items: baseline;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  transition: padding-left 0.25s ease;
}
.issue-card:hover { padding-left: 0.6rem; }
.issue-card-week a {
  font-family: var(--grot); font-weight: 700;
  font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
}
.issue-card-week .date { display: block; color: var(--dim); font-weight: 400; letter-spacing: 0.1em; margin-top: 0.2rem; }
.issue-card-title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.15rem, 1.8vw, 1.45rem); line-height: 1.2;
  letter-spacing: -0.01em;
}
.issue-card-cats {
  display: block; margin-top: 0.5rem;
  font-family: var(--grot); font-size: 0.66rem;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim);
}
.issue-card-cats .cat::before { content: "/ "; color: var(--accent-dim); }

/* About / prose */
.about-section { max-width: 64ch; animation: rise 0.7s cubic-bezier(0.16,1,0.3,1) both; }
.about-section p { font-size: 1.12rem; line-height: 1.7; color: var(--dim); margin: 0 0 1.3rem; }
.about-section h2 {
  font-family: var(--grot); font-weight: 700;
  font-size: 0.86rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent);
  margin: 2.6rem 0 1rem;
  padding-top: 1.2rem; border-top: 1px solid var(--rule);
}
.about-section a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); transition: opacity .2s; }
.about-section a:hover { opacity: 0.7; }

/* 404 */
.notfound { text-align: center; padding: clamp(3rem, 8vw, 6rem) 0; }
.notfound .page-title { margin-bottom: 1rem; }
.notfound p { font-size: 1.15rem; color: var(--dim); max-width: 44ch; margin: 0 auto; }
.notfound a { color: var(--accent); border-bottom: 1px solid var(--accent-dim); }

/* ----------  Footer  ----------------------------------------------------- */
.footer {
  max-width: var(--measure); margin: 0 auto;
  padding: 2.2rem var(--gutter) 3rem;
  border-top: 3px solid var(--rule-2);
  font-family: var(--grot);
  font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim);
  display: flex; gap: 0.6rem 1.4rem; flex-wrap: wrap; align-items: center;
}
.footer::before {
  content: "AB"; font-weight: 700; letter-spacing: -0.04em;
  font-size: 1.1rem; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: 5px;
  padding: 0.15rem 0.4rem; text-transform: none; line-height: 1;
}
.footer a { color: var(--dim); }
.footer a:hover { color: var(--accent); }
.footer .spacer { flex: 1; }

/* ----------  Motion keyframes  ------------------------------------------ */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----------  Responsive  ------------------------------------------------- */
@media (max-width: 880px) {
  .briefs-list { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .lead-figure { aspect-ratio: 16 / 10; }
  .masthead-tag { text-align: left; }
  .masthead-brand { align-items: flex-start; }
  .issue-card { grid-template-columns: 1fr; gap: 0.4rem; }
  .lead-ingress::first-letter { initial-letter: 1; -webkit-initial-letter: 1; }
}

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