/* journal.css — Journal-style reading UI for Arbetsbok */

:root {
  --ink: #1a1a1a;
  --ink-light: #555;
  --ink-muted: #888;
  --ink-faint: #bbb;
  --bg: #fefefe;
  --bg-warm: #faf8f5;
  --bg-accent: #fff8f0;
  --border: #e8e4df;
  --border-light: #f0ece7;
  --accent: #FF9F46;
  --accent-dark: #e88a2e;
  --serif: 'Georgia', 'Times New Roman', serif;
  --sans: 'Helvetica Neue', -apple-system, sans-serif;
  --mono: 'SF Mono', 'Menlo', monospace;
  --measure: 680px;
  --leading: 1.75;
}

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

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: var(--leading);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.page-wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

/* ===== HERO (TOC) ===== */

.hero {
  text-align: center;
  padding: 64px 0 48px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 48px;
}

.hero-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.hero .subtitle {
  font-style: italic;
  font-size: 18px;
  color: var(--ink-light);
  margin-bottom: 24px;
}

.hero .author {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}

/* ===== TOC LIST ===== */

.toc-list {
  list-style: none;
}

.toc-item {
  border-bottom: 1px solid var(--border-light);
}

.toc-item:last-child {
  border-bottom: none;
}

.toc-link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 20px 0;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.15s;
}

.toc-link:hover {
  color: var(--accent-dark);
}

.toc-nummer {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  min-width: 32px;
  flex-shrink: 0;
}

.toc-content {
  flex: 1;
}

.toc-titel {
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
}

.toc-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}

.toc-item--sub {
  padding-left: 48px;
}

.toc-item--sub .toc-titel {
  font-size: 16px;
}

.toc-item--del {
  border-bottom: none;
  padding-top: 40px;
}

.toc-del-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  padding-bottom: 8px;
}

/* ===== CHAPTER HERO ===== */

.kap-hero {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.kap-hero .del-label {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
}

.kap-hero .kap-nummer {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.kap-hero h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 8px;
}

.kap-hero .undertitel {
  font-style: italic;
  font-size: 18px;
  color: var(--ink-light);
  margin-bottom: 16px;
}

.kap-hero .kap-meta {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-faint);
  display: flex;
  gap: 16px;
}

.kap-hero .oppningsbild {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: 4px;
  margin-top: 24px;
}

/* ===== INGRESS ===== */

.ingress {
  font-size: 18px;
  color: var(--ink-light);
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin-bottom: 40px;
  line-height: 1.6;
}

/* ===== SEKTION ===== */

.sektion {
  margin-bottom: 48px;
}

.sektion h2 {
  font-family: var(--sans);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ===== BRODTEXT ===== */

p {
  margin-bottom: 16px;
}

.has-dropcap::first-letter {
  float: left;
  font-size: 3.2em;
  line-height: 0.8;
  font-weight: 700;
  margin-right: 8px;
  margin-top: 6px;
  color: var(--accent);
}

/* ===== CITAT ===== */

.citat {
  border-left: 3px solid var(--border);
  padding: 16px 0 16px 24px;
  margin: 24px 0;
  font-style: italic;
  color: var(--ink-light);
  font-size: 18px;
  line-height: 1.6;
}

.citat .text {
  display: block;
}

.citat .kalla {
  display: block;
  font-style: normal;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 8px;
}

.citat .kalla::before {
  content: '— ';
}

/* ===== PUNKTLISTA ===== */

.prick-lista {
  margin: 20px 0;
}

.prick-lista .inledning {
  margin-bottom: 8px;
}

.prick-lista ul {
  list-style: none;
  padding-left: 0;
}

.prick-lista li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
}

.prick-lista li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ===== DEFINITION ===== */

.def-lista {
  margin: 24px 0;
}

.def-item {
  background: var(--bg-warm);
  padding: 16px 20px;
  border-radius: 6px;
  margin-bottom: 8px;
}

.def-item dt {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.def-item dd {
  color: var(--ink-light);
  font-size: 16px;
}

/* ===== MODELL / PLANSCH ===== */

.plansch {
  background: var(--bg-warm);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 24px;
  margin: 28px 0;
}

.plansch .plansch-titel {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-bottom: 8px;
}

.plansch .plansch-beskrivning {
  font-size: 15px;
  color: var(--ink-light);
  margin-bottom: 16px;
}

/* Spiral Dynamics variant */
.sd-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sd-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  font-family: var(--sans);
  font-size: 14px;
  align-items: center;
}

.sd-row .sd-niva {
  font-weight: 600;
  font-size: 13px;
}

.sd-row .sd-beskrivning {
  color: var(--ink-light);
}

/* Lyssnande-nivåer pyramid variant */
.pyramid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 0;
}

.pyramid-niva {
  font-family: var(--sans);
  font-size: 14px;
  text-align: center;
  padding: 10px 16px;
  border-radius: 4px;
  background: var(--border-light);
  color: var(--ink);
}

.pyramid-niva:first-child {
  width: 50%;
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.pyramid-niva:nth-child(2) { width: 62%; }
.pyramid-niva:nth-child(3) { width: 74%; }
.pyramid-niva:nth-child(4) { width: 86%; }
.pyramid-niva:nth-child(5) { width: 100%; }

/* Plansch grid (tabell) */
.plansch-grid {
  display: grid;
  font-family: var(--sans);
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.plansch-grid .grid-header {
  display: contents;
}

.plansch-grid .grid-header > div {
  background: var(--border-light);
  padding: 10px 12px;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.plansch-grid .grid-row {
  display: contents;
}

.plansch-grid .grid-row > div {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--ink-light);
}

.plansch-grid .grid-row:last-child > div {
  border-bottom: none;
}

/* ===== REFLEKTION / WORKSHEET ===== */

.worksheet {
  background: var(--bg-accent);
  border: 1px solid #f0e0cc;
  border-radius: 8px;
  padding: 24px;
  margin: 28px 0;
}

.worksheet .worksheet-titel {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.worksheet .worksheet-titel::before {
  content: '';
  display: inline-block;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.4;
}

.ws-block {
  margin-bottom: 20px;
}

.ws-block:last-child {
  margin-bottom: 0;
}

.ws-block .ws-fraga {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
}

.ws-block textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  background: white;
  resize: vertical;
  transition: border-color 0.15s;
}

.ws-block textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 159, 70, 0.12);
}

.ws-block textarea[readonly] {
  background: var(--bg-warm);
  cursor: default;
}

/* ===== BILD / FIGURE ===== */

figure {
  margin: 28px 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
}

figure figcaption {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  margin-top: 8px;
  font-style: italic;
}

/* ===== NAVIGATION ===== */

.kap-nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: 40px;
  margin-top: 48px;
  border-top: 1px solid var(--border);
}

.kap-nav a {
  font-family: var(--sans);
  font-size: 14px;
  text-decoration: none;
  color: var(--ink-muted);
  transition: color 0.15s;
  max-width: 45%;
}

.kap-nav a:hover {
  color: var(--accent-dark);
}

.kap-nav .nav-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}

.kap-nav .nav-titel {
  font-size: 15px;
  color: var(--ink);
  font-weight: 500;
}

.kap-nav a:hover .nav-titel {
  color: var(--accent-dark);
}

.nav-next {
  text-align: right;
  margin-left: auto;
}

/* ===== BACK LINK ===== */

.back-link {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.back-link:hover {
  color: var(--ink);
}

.back-link::before {
  content: '\2190';
}

/* ===== AUTH BANNER ===== */

.auth-banner {
  font-family: var(--sans);
  font-size: 14px;
  background: var(--bg-accent);
  border: 1px solid #f0e0cc;
  border-radius: 8px;
  padding: 12px 20px;
  margin-bottom: 24px;
  color: var(--accent-dark);
  text-align: center;
}

/* ===== LOADING / ERROR ===== */

.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--ink-muted);
  font-family: var(--sans);
  font-size: 14px;
}

.error {
  background: #fff3f3;
  border: 1px solid #fcc;
  padding: 16px 20px;
  border-radius: 8px;
  font-family: var(--sans);
  font-size: 14px;
  color: #a33;
  margin: 24px 0;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 640px) {
  .hero h1 { font-size: 28px; }
  .kap-hero h1 { font-size: 26px; }
  .toc-item--sub { padding-left: 32px; }
  .kap-nav { flex-direction: column; gap: 16px; }
  .kap-nav a { max-width: 100%; }
  .nav-next { text-align: left; }
  .plansch { padding: 16px; }
  .worksheet { padding: 16px; }
  .sd-row { grid-template-columns: 60px 1fr; }
}
