/*
  Lagklockan — streamlined.
  One job: tell counsel when each regulation begins to apply.
*/

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body, h1, h2, h3, p, ol, ul, li { margin: 0; }
ol, ul { list-style: none; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

/* Tokens — light-first palette mirroring oh wait what */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Libre Baskerville', Baskerville, 'Baskerville Old Face', 'Hoefler Text', Garamond, 'Times New Roman', serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Menlo, Consolas, monospace;

  --fs-xs:  0.8125rem;
  --fs-sm:  0.9375rem;
  --fs-base: 1.0625rem;
  --fs-md: 1.25rem;
  --fs-lg: 1.5rem;
  --fs-xl: 2rem;
  --fs-2xl: 2.75rem;
  --fs-3xl: clamp(2.75rem, 7vw, 5rem);

  --paper:   #f7f6f2;
  --paper-2: #ffffff;
  --ink:     #0b1220;
  --ink-2:   #1a2233;
  --ink-3:   #5a6072;
  --ink-4:   #8a8e98;
  --rule:        #e0ddd4;
  --rule-strong: #ebe9e1;
  --accent:  #c2a04a;
  --urgent:  #a85a48;
  --urgent-soft: rgba(168, 90, 72, 0.08);
  --soon:    #b07d2f;
  --soon-soft:   rgba(176, 125, 47, 0.06);
  --ok:      #7c8b62;

  /* Dark panel — for data visualizations embedded in the cream page.
     Mirrors oh wait what's matrix surface language. */
  --surface-dark:        #14130f;
  --surface-dark-2:      #1c1a15;
  --on-dark:             #ece6d6;
  --on-dark-soft:        #b5ad9a;
  --on-dark-dim:         #6f6957;
  --rule-on-dark:        rgba(236, 230, 214, 0.10);
  --rule-on-dark-strong: rgba(236, 230, 214, 0.22);
  --shadow-panel:
    0 1px 0 rgba(255, 255, 255, 0.03) inset,
    0 1px 2px rgba(20, 19, 15, 0.06),
    0 12px 24px -10px rgba(20, 19, 15, 0.14),
    0 32px 64px -24px rgba(20, 19, 15, 0.18);

  --page: min(72rem, 100% - 2rem);
  /* Wide container for the chrome (masthead + footer) — matches the
     landing-page topbar exactly so the Lagklockan wordmark sits at
     the same screen X when navigating between landing and article. */
  --page-wide: min(100% - 32px, 1640px);
  color-scheme: light;
}

/* Base */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
}
::selection { background: var(--accent); color: #ffffff; }

h1, h2, h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 1.1;
  color: var(--ink);
  text-wrap: balance;
}

a { transition: color 140ms ease; }
a:hover { color: var(--accent); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: absolute; left: -10000px; top: 0.5rem;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 1rem; font-size: var(--fs-xs);
  border-radius: 3px;
}
.skip-link:focus-visible { left: 1rem; outline: none; }

/* Masthead */
.masthead {
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  width: var(--page-wide);
  margin-inline: auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-block: 1.25rem;
}
.site-name {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--fs-md);
  letter-spacing: -0.01em;
  color: var(--ink);
}
.masthead-rss {
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.masthead-nav {
  display: flex;
  gap: 1.5rem;
  align-items: baseline;
}
.masthead-link {
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.masthead-link:hover { color: var(--ink); }

/* Footer */
.site-footer {
  margin-top: 8rem;
  border-top: 1px solid var(--rule);
}
.site-footer-inner {
  width: var(--page-wide);
  margin-inline: auto;
  padding-block: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 2rem;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}
.footer-links { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.footer-links a:hover { color: var(--accent); }
@media (max-width: 36rem) {
  .site-footer-inner { flex-direction: column; }
}

/* Search state — homepage dims the timeline when a query matches nothing */
.no-results {
  color: var(--ink-3);
  font-size: var(--fs-sm);
  padding-block: 2rem;
}

/* Article — Editorial column. Hero block can run wider than the body so the
   title and ingress get room; the body stays in a 38rem column. Figures may
   sit inside the column or break out to .bleed for full page width. */
.article-page {
  width: var(--page);
  margin-inline: auto;
  padding-block: 4rem;
}
/* One column for the whole article — hero, ingress, video, body all
   live in the same 42rem editorial column so every block has the same
   left and right edges, not just a shared center axis. */
.article-hero {
  max-width: 42rem;
  margin-inline: auto;
  margin-bottom: 3rem;
}
.article-body {
  max-width: 42rem;
  margin-inline: auto;
}
article h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.05;
  margin-bottom: 1.5rem;
  text-wrap: balance;
}
article .ingress {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  font-weight: 400;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 auto;
  text-wrap: pretty;
  max-width: 42rem;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}
.article-meta time { color: var(--ink-2); }
.article-meta .reading-time::before { content: '· '; color: var(--ink-4); }

/* Figure helpers — drop these inside the body to insert media. They share
   one .article-figure skin so video, image, and lagvideo-rendered briefs
   all sit in the same frame. */
.article-figure {
  margin-block: 2.25rem;
}
.article-figure .frame {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--paper-2);
  border-radius: 4px;
  overflow: hidden;
}
.article-figure .frame video,
.article-figure .frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.article-figure figcaption {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-3);
  margin-top: 0.6rem;
  letter-spacing: 0.02em;
}
.article-figure figcaption strong { color: var(--ink-2); font-weight: 500; }
/* Break out of the 38rem body to full page width. */
.article-figure.bleed {
  margin-inline: calc(50% - 50vw + max(1rem, calc((100vw - var(--page)) / 2)));
}
@media (min-width: 60rem) {
  .article-figure.bleed { margin-inline: calc(50% - 50vw); width: 100vw; max-width: var(--page); margin-left: auto; margin-right: auto; }
}
.article-figure.grid-2 .frame-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
.article-figure.grid-2 .frame-grid .frame { aspect-ratio: 4 / 5; }
@media (max-width: 40rem) {
  .article-figure.grid-2 .frame-grid { grid-template-columns: 1fr; }
}

article h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  margin-top: 3rem;
  margin-bottom: 1rem;
  color: var(--ink);
  scroll-margin-top: 2rem;
}
article h3 {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 400;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}
article p {
  color: var(--ink-2);
  margin-bottom: 1rem;
  line-height: 1.65;
}
article p strong { color: var(--ink); font-weight: 600; }
article p em { color: var(--ink); font-style: italic; }
article ul, article ol {
  margin: 0.5rem 0 1.25rem 1.5rem;
  color: var(--ink-2);
}
article ul { list-style: disc; }
article ol { list-style: decimal; }
article li { margin-bottom: 0.5rem; line-height: 1.65; padding-left: 0.25rem; }
article li::marker { color: var(--ink-4); }
article blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  font-style: italic;
  color: var(--ink-2);
}
article hr {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin-block: 2rem;
}

/* Drop the article body TOC details, asides, etc. — keep them collapsed */
article details.toc { display: none; }
article .related, article .prev-next-old { display: none; }

.prev-next {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}
.prev-next a { color: var(--ink-2); max-width: 22rem; }
.prev-next .next { margin-left: auto; text-align: right; }
.prev-next a:hover { color: var(--accent); }

/* Related reading — "Fler analyser" at the foot of an article */
.article-related {
  max-width: 42rem;
  margin: 4rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
}
.article-related-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.article-related-head h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 400;
  margin: 0;
}
.article-related-all {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
}
.article-related-all:hover { color: var(--accent); }
.article-related ul { display: grid; }
.article-related li { border-bottom: 1px solid var(--rule); }
.article-related li a {
  display: grid;
  grid-template-columns: 7rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
  padding-block: 0.85rem;
  color: var(--ink);
}
.article-related-date {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-4);
}
.article-related-title {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  line-height: 1.3;
}
.article-related li a:hover .article-related-title { color: var(--accent); }
@media (max-width: 40rem) {
  .article-related li a { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* Content pages (about, redaktionen, tag, amnen, arkiv) */
.content-page {
  width: var(--page);
  margin-inline: auto;
  max-width: 44rem;
  padding-block: 4rem;
}
.content-page h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.05;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.content-page h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 400;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}
.content-page .lede {
  font-family: var(--font-serif);
  font-size: var(--fs-md);
  color: var(--ink-2);
  margin-bottom: 2rem;
  line-height: 1.55;
}
.content-page p {
  color: var(--ink-2);
  margin-bottom: 1rem;
  line-height: 1.65;
}
.content-page strong { color: var(--ink); font-weight: 600; }
.content-page em { color: var(--ink); font-style: italic; }
.content-page ul, .content-page ol {
  margin: 0.5rem 0 1.25rem 1.5rem;
  color: var(--ink-2);
}
.content-page ul { list-style: disc; }
.content-page ol { list-style: decimal; }
.content-page li { margin-bottom: 0.5rem; }
.content-page li::marker { color: var(--ink-4); }

/* Tag/topic eyebrow strip */
.tag-hero { margin-bottom: 2.5rem; }
.tag-hero .eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 0.75rem;
}
.tag-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 400;
  letter-spacing: -0.028em;
  line-height: 1.0;
  margin-bottom: 0.5rem;
}
.tag-hero .count { font-size: var(--fs-sm); color: var(--ink-3); }
.tag-hero .count a { color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.tag-hero .count a:hover { color: var(--accent); border-color: var(--accent); }

/* Archive */
.archive-month { margin-bottom: 2.5rem; }
.archive-month-label {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 400;
  color: var(--ink);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0.75rem;
}
.archive-list { display: grid; gap: 0.25rem; }
.archive-list li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 1rem;
  padding-block: 0.5rem;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}
.archive-list li .date { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--ink-4); }
.archive-list li a { font-family: var(--font-serif); font-size: var(--fs-md); color: var(--ink); }
.archive-list li a:hover { color: var(--accent); }

/* Prose pages (/villkor, /integritet, /stotta, /tack) */
.prose-page {
  width: min(40rem, 100% - 2rem);
  margin: 3rem auto 5rem;
}
.prose-page h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-2xl);
  font-weight: 400;
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}
.prose-page h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 400;
  margin-top: 2.25rem;
  margin-bottom: 0.6rem;
}
.prose-page p, .prose-page li {
  color: var(--ink-2);
  margin-bottom: 0.9rem;
}
.prose-page ul { padding-left: 1.25rem; list-style: disc; }
.prose-page li { margin-bottom: 0.4rem; }
.prose-page a { color: var(--accent); text-decoration: underline; }

/* Footer nav */
.site-footer-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.site-footer-nav a { color: var(--ink-3); }
.site-footer-nav a:hover { color: var(--accent); }
