/* Design tokens per the `raft-style` skill v1.2 (../.claude/skills/raft-style/SKILL.md in the
   umbrella repo): warm off-white palette, bento-grid layout principle, light/dark theme toggle,
   filter box pattern. Content is migrated from a real WordPress export (WXR) — see
   changelog_private/CHANGELOG.md for what's been done and what's still pending. */
:root {
  --bg: #EBE8E6;
  --bg-alt: rgba(255, 255, 255, 0.6);
  --fg: #1D1F25;
  --fg-inverse: #FDFDFD;
  --accent: #C26148;
  --accent-secondary: #AC5039;
  --border: rgba(29, 31, 37, 0.10);
  --border-strong: rgba(29, 31, 37, 0.18);
  --content-width: 740px;
  --wide-width: 1100px;
  --radius: 8px;
}

html[data-theme="dark"] {
  --bg: #1E1E1E;
  --bg-alt: rgba(255, 255, 255, 0.06);
  --fg: #FDFDFD;
  --fg-inverse: #1D1F25;
  --accent: #E48468;
  --accent-secondary: #C26148;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.20);
  color-scheme: dark;
}
html { color-scheme: light; }

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Readex Pro", sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s, color 0.2s;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; margin: 0 0 16px; }
h1 { font-size: 56px; line-height: 1.25; }
h2 { font-size: 32px; line-height: 1.35; }
h3 { font-size: 28px; line-height: 1.35; }
h4 { font-size: 24px; line-height: 1.4; }

p { margin: 0 0 16px; }

a { color: var(--fg); text-decoration: none; }
a:hover { color: var(--accent); }

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

.wide {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 24px;
}

.narrow {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

.center { text-align: center; }

.btn {
  display: inline-block;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-inverse);
  background: var(--accent);
  border: 2px solid transparent;
  border-radius: 3px;
  padding: 12px 24px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-secondary); color: var(--fg-inverse); }
.btn-outline { background: transparent; border: 2px solid var(--fg); color: var(--fg); }
.btn-outline:hover { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-row { display: flex; flex-wrap: wrap; gap: 16px; }

.search-input {
  font-family: inherit;
  font-size: 15px;
  color: var(--fg);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 10px 18px;
  width: 100%;
  max-width: 320px;
}
.search-input:focus-visible { outline: none; border-color: var(--border-strong); }
.search-input::placeholder { color: var(--fg); opacity: 0.5; }
.search-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.search-form .search-input { max-width: 260px; }
[data-posts-search] { display: block; margin-bottom: 24px; }

/* Password gate — client-side soft gate for password-protected posts (e.g. bok/).
   Not real security (the hash + JS are visible in page source, same exposure level as
   WordPress's own post-password feature) — see js/password-gate.js and AGENTS.md. */
.gate-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 24px;
  margin: 0 0 16px;
}
.gate-form { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.gate-error { color: var(--accent); font-size: 14px; margin-top: 10px; }

/* ==========================================================================
   Header / nav-controls (theme toggle + language switch)
   ========================================================================== */
.site-header {
  background: var(--bg-alt);
  padding: 16px 0;
}
.site-header .wide {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.logo { display: block; flex-shrink: 0; }
.logo img { display: block; height: 48px; width: auto; }

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a { font-size: 14px; font-weight: 600; white-space: nowrap; }

.nav-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: none;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.nav-toggle:hover, .nav-toggle:focus-visible { border-color: var(--border-strong); }
.nav-toggle svg { width: 20px; height: 20px; }
.nav-toggle .icon-close { display: none; }
.site-header.menu-open .nav-toggle .icon-bars { display: none; }
.site-header.menu-open .nav-toggle .icon-close { display: block; }

.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.15s;
  flex-shrink: 0;
}
.theme-toggle:hover, .theme-toggle:focus-visible { border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.lang-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 9999px;
  padding: 3px;
  flex-shrink: 0;
}
.lang-btn {
  border: none;
  background: none;
  font-family: inherit;
  color: var(--fg);
  opacity: 0.55;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 10px;
  border-radius: 9999px;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
.lang-btn:hover, .lang-btn:focus-visible { opacity: 0.85; }
.lang-btn.active { background: var(--bg); opacity: 1; }
html[data-theme="dark"] .lang-btn.active { background: rgba(255,255,255,0.10); }

/* ==========================================================================
   Hero
   ========================================================================== */
.hero {
  background: var(--bg-alt);
  padding: 64px 24px;
}
.hero .wide {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
  align-items: center;
}
.hero-kicker {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 8px;
}
.hero-sub { font-size: 18px; opacity: 0.8; max-width: 50ch; margin-bottom: 24px; }
.hero-figure { margin: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.hero-figure img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 4/3; }
.hero-figure figcaption { font-size: 12px; opacity: 0.6; padding: 8px 12px; }

.section { padding: 64px 24px; }
.section-lead { max-width: var(--content-width); margin: 0 0 32px; }
.section-lead.center { text-align: center; margin: 0 auto 32px; }

/* ==========================================================================
   Bento tile grid (category / subject hub pickers)
   ========================================================================== */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: minmax(140px, 1fr);
  grid-auto-flow: dense;
  gap: 16px;
}
.tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  transition: border-color 0.15s;
}
.tile:hover, .tile:focus-within { border-color: var(--border-strong); }
.tile.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0) 60%);
}
.tile h4 {
  position: relative;
  font-size: 17px;
  margin: 0;
  padding: 16px;
}
.tile.has-image h4 { color: #FDFDFD; }
.tile-link { position: absolute; inset: 0; z-index: 1; }
.tile--featured { grid-column: span 2; grid-row: span 2; }
.tile--featured h4 { font-size: 22px; }

/* ==========================================================================
   Filter box — single group of stacked full-width buttons (see raft-style
   v1.2 "Filter bar"; læremedki's taxonomy only needs one dimension at a time
   per listing, so this is the "comprehensive first box alone" variant).
   ========================================================================== */
.filter-group-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.55;
  margin: 0 0 10px;
}
.filter-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-bar.filter-bar--row { flex-direction: row; flex-wrap: wrap; }
.filter-btn {
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 11px 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  flex: 0 0 auto;
}
.filter-bar--row .filter-btn { width: auto; }
.filter-btn:hover { border-color: var(--border-strong); }
.filter-btn.is-active { background: var(--accent); color: var(--fg-inverse); }

/* ==========================================================================
   Posts grid / cards
   ========================================================================== */
.posts-section { padding: 64px 24px 88px; }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.load-more { text-align: center; margin-top: 40px; }
.load-more:empty { margin-top: 0; }
.post-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-alt);
  transition: border-color 0.15s;
}
.post-card:hover { border-color: var(--border-strong); }
.post-card img { width: 100%; height: 170px; object-fit: cover; display: block; }
.post-card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.post-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.badge {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  color: var(--accent);
}
.badge:hover { border-color: var(--border-strong); }
.post-title { font-size: 21px; margin-bottom: 4px; }
.post-title a:hover { color: var(--accent); }
.post-date { font-size: 13px; opacity: 0.6; margin: 0 0 8px; }
.post-description { font-size: 14px; margin-bottom: 0; opacity: 0.8; flex: 1; }

/* ==========================================================================
   Article / post-body — prose styling for migrated WordPress block content.
   WP block classes (wp-block-*) are left in the migrated HTML as-is but
   deliberately not given their own rules here: they inherit sane defaults
   from these plain-element rules, same finding as on skolesim.no.
   ========================================================================== */
.article-header { padding: 56px 24px 32px; }
.article-header .narrow { }
.article-title { margin-bottom: 12px; }
.article-meta { font-size: 14px; opacity: 0.6; margin-bottom: 16px; }
.post-body { padding: 0 24px 24px; }
.post-body .narrow { }
.post-body ul, .post-body ol { padding-left: 1.3em; margin: 0 0 16px; }
.post-body li { margin-bottom: 6px; }
.post-body blockquote {
  margin: 0 0 16px;
  padding: 4px 20px;
  border-left: 4px solid var(--accent);
  opacity: 0.9;
  font-style: italic;
}
.post-body figure { margin: 0 0 16px; }
.post-body img { max-width: 100%; height: auto; display: block; border-radius: 4px; border: 1px solid var(--border-strong); }
.post-body figcaption { font-size: 13px; opacity: 0.6; margin-top: 6px; }
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 15px;
}
.post-body th, .post-body td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.post-body a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.post-body a:hover { color: var(--accent); text-decoration-color: currentColor; }
.post-body hr { border: none; border-top: 1px solid var(--border); margin: 32px 0; }
.post-body pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
}
.post-body code { font-family: "Consolas", "Menlo", monospace; }
.post-body :not(pre) > code {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.9em;
}

/* wp:columns — side-by-side content (e.g. image + text) */
.post-body .wp-block-columns { display: flex; gap: 24px; flex-wrap: wrap; margin: 0 0 16px; }
.post-body .wp-block-column { flex: 1 1 240px; min-width: 0; }
.post-body .wp-block-column figure { margin: 0; }

/* wp:file — download button block */
.post-body .wp-block-file {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 16px;
  margin: 0 0 16px;
}
.post-body .wp-block-file object { border-radius: 4px; margin-bottom: 12px; }
.post-body .wp-block-file__button {
  display: inline-block;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-inverse);
  background: var(--accent);
  border-radius: 3px;
  padding: 8px 16px;
  margin-left: 8px;
}
.post-body .wp-block-file__button:hover { background: var(--accent-secondary); color: var(--fg-inverse); }

/* Otter "visual link preview" — external/internal link card */
.post-body .wp-block-visual-link-preview-link {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 16px;
  margin: 0 0 16px;
  transition: border-color 0.15s;
}
.post-body .wp-block-visual-link-preview-link:hover { border-color: var(--border-strong); color: var(--fg); }
.post-body .wp-block-visual-link-preview-link .vlp-image { width: 100%; height: auto; border-radius: 4px; margin-bottom: 10px; display: block; }
.post-body .wp-block-visual-link-preview-link h3 { font-size: 17px; margin-bottom: 4px; }
.post-body .wp-block-visual-link-preview-link .summary { font-size: 14px; opacity: 0.75; margin: 0; }

/* "Instrukser"-category copy-block — a labeled, copyable prompt/instruction.
   Standard for Instrukser-posts, see AGENTS.md "Instrukser — standard
   copy-block-format". Copy-button click handling lives in js/copy-block.js. */
.post-body .copy-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 20px;
  margin: 0 0 16px;
}
.post-body .copy-block-label { font-weight: 600; color: var(--accent); font-size: 0.95rem; margin: 0 0 10px; }
.post-body .copy-block-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 9px;
  background: var(--accent);
  color: var(--fg-inverse);
  border-radius: 9999px;
  font-size: 0.72rem;
  font-weight: 500;
  vertical-align: middle;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.post-body .copy-block-content {
  font-size: 0.9rem;
  line-height: 1.65;
  white-space: pre-wrap;
  margin: 0;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 6px;
  max-height: 300px;
  overflow-y: auto;
}
.post-body .copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 8px 18px;
  background: var(--accent);
  color: var(--fg-inverse);
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s, transform 0.1s;
}
.post-body .copy-btn:hover { background: var(--accent-secondary); }
.post-body .copy-btn:active { transform: scale(0.97); }
.post-body .copy-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.post-body .copy-btn.copied { background: #4a8c6f; }

/* Raw iframe embeds (YouTube/Spotify, dropped in via wp:html) */
.post-body iframe { max-width: 100%; border-radius: var(--radius); }
.post-body .embed-16-9 { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: var(--radius); margin: 0 0 16px; }
.post-body .embed-16-9 iframe { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--radius); }

/* ==========================================================================
   Dual-language content blocks — both languages exist in the same document;
   js/i18n.js toggles which [data-lang-block] block is visible. Distinct from
   the data-i18n dict mechanism used for short chrome strings (nav/buttons),
   and deliberately a different attribute from .lang-btn's own [data-lang] —
   sharing the name meant this rule and the JS toggle also matched the
   buttons and force-hid whichever one didn't match the page's current
   language (found 2026-08-29, see js/i18n.js).
   ========================================================================== */
/* Norwegian shows by default with no JS required (matches DEFAULT_LANG in js/i18n.js) — only
   switching to English needs the deferred script, so there's no flash-of-blank-content while it
   loads, and content stays visible to no-JS clients/crawlers. */
[data-lang-block="en"] { display: none; }
.translation-pending {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-alt);
  padding: 16px 20px;
  font-size: 15px;
}
.translation-pending p { margin: 0; }

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--bg-alt);
  padding: 24px;
}
.site-footer .wide {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.site-footer p { margin: 0; font-size: 14px; }
.site-footer nav { display: flex; gap: 20px; }
.site-footer nav a { font-size: 14px; font-weight: 600; }

/* ==========================================================================
   Om meg — bio page specifics
   ========================================================================== */
.bio-columns { display: flex; gap: 32px; flex-wrap: wrap; margin-bottom: 24px; }
.bio-columns figure { flex: 0 0 240px; margin: 0; }
.bio-columns figure img { width: 100%; border-radius: var(--radius); display: block; }
.bio-columns figure figcaption { font-size: 12px; opacity: 0.6; margin-top: 6px; }
.bio-columns .bio-text { flex: 1 1 320px; }
.social-links { display: flex; gap: 12px; list-style: none; padding: 0; margin: 0 0 32px; }
.social-links a {
  width: 36px; height: 36px; border-radius: 9999px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.social-links a:hover { border-color: var(--border-strong); color: var(--accent); }
.social-links svg { width: 16px; height: 16px; }
.bio-section { margin-bottom: 8px; }
.bio-section h3 { margin-bottom: 12px; }

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

@media (max-width: 780px) {
  h1 { font-size: 38px; }
  .tile-grid { grid-template-columns: repeat(2, 1fr); }
  .tile--featured { grid-column: span 2; grid-row: span 1; aspect-ratio: 16/9; }
  .posts-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }
  .header-right {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    order: 5;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
  }
  .site-header.menu-open .header-right { display: flex; }
  .site-nav { flex-direction: column; gap: 12px; }
  .nav-controls { justify-content: space-between; }

  .bio-columns { flex-direction: column; }
  .bio-columns figure { flex: 0 0 auto; max-width: 220px; }
}
