/* Juridiska dokument (villkor, integritet) – views/partials/legal-doc.php */

.lg {
    --lg-line: color-mix(in srgb, var(--border) 75%, transparent);
    --lg-soft: color-mix(in srgb, var(--text) 5%, transparent);
    --lg-card: color-mix(in srgb, var(--bg-surface) 88%, transparent);
    --lg-grad: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent) 45%, #22d3ee));
    position: relative;
    width: min(1180px, 100% - clamp(24px, 6vw, 64px));
    margin: 0 auto;
    padding: clamp(20px, 4vw, 40px) 0 clamp(48px, 7vw, 80px);
}
.page-shell .lg { width: 100%; }
.lg h1, .lg h2, .lg h3, .lg p { margin: 0; }

.lg-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 400; height: 3px; pointer-events: none; }
.lg-progress span { display: block; width: 0; height: 100%; background: var(--lg-grad); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 60%, transparent); transition: width 0.1s linear; }

/* ── Hero ── */
.lg-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: clamp(22px, 4vw, 40px);
    overflow: hidden;
    border: 1px solid var(--lg-line);
    border-radius: 28px;
    background: radial-gradient(90% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%), var(--lg-card);
    backdrop-filter: blur(16px);
}
.lg-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: linear-gradient(color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px), linear-gradient(90deg, color-mix(in srgb, var(--text) 4%, transparent) 1px, transparent 1px);
    background-size: 28px 28px;
    mask-image: radial-gradient(60% 80% at 100% 0%, #000, transparent 75%);
    -webkit-mask-image: radial-gradient(60% 80% at 100% 0%, #000, transparent 75%);
}
.lg-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.78rem; color: var(--text-muted); }
.lg-crumbs a { color: var(--text-muted); text-decoration: none; }
.lg-crumbs a:hover { color: var(--accent); }
.lg-crumbs .material-icons-round { font-size: 1rem; opacity: 0.6; }
.lg-crumbs [aria-current] { color: var(--text); font-weight: 650; }
.lg-hero__main { display: flex; align-items: flex-start; gap: 18px; }
.lg-hero__icon { display: grid; place-items: center; flex-shrink: 0; width: 64px; height: 64px; border-radius: 20px; color: #fff; background: var(--lg-grad); box-shadow: 0 16px 34px -14px color-mix(in srgb, var(--accent) 75%, transparent); }
.lg-hero__icon .material-icons-round { font-size: 2rem; }
.lg-badge { display: inline-flex; margin-bottom: 6px; padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.lg-hero h1 { font-size: clamp(1.9rem, 4.6vw, 3rem); font-weight: 900; line-height: 1.05; letter-spacing: -0.045em; }
.lg-lead { max-width: 64ch; margin-top: 8px !important; font-size: clamp(0.96rem, 1.6vw, 1.06rem); line-height: 1.6; color: var(--text-muted); }
.lg-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.lg-meta > span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--lg-line); border-radius: 999px; font-size: 0.78rem; font-weight: 600; color: var(--text-muted); background: var(--lg-soft); }
.lg-meta .material-icons-round { font-size: 1rem; color: var(--accent); }
.lg-meta time { color: var(--text); }
.lg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lg-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--lg-line);
    border-radius: 12px;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text);
    background: var(--bg-surface);
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.lg-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.lg-btn .material-icons-round { font-size: 1.1rem; }
.lg-btn.is-done { color: var(--success, #10b981); border-color: color-mix(in srgb, var(--success, #10b981) 45%, var(--border)); }

/* ── I korthet ── */
.lg-summary { margin-top: 18px; padding: clamp(18px, 3vw, 28px); border: 1px solid var(--lg-line); border-radius: 24px; background: var(--lg-card); }
.lg-summary header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 16px; }
.lg-summary h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 850; }
.lg-summary h2 .material-icons-round { color: var(--accent); }
.lg-summary header p { font-size: 0.8rem; color: var(--text-muted); }
.lg-summary__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lg-point { display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: var(--lg-soft); transition: transform 0.2s ease, background 0.2s ease; }
.lg-point:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.lg-point > .material-icons-round { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; font-size: 1.2rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.lg-point strong { display: block; font-size: 0.9rem; }
.lg-point p { margin-top: 3px !important; font-size: 0.8rem; line-height: 1.5; color: var(--text-muted); }

/* ── Layout ── */
.lg-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: clamp(20px, 3vw, 36px); align-items: start; margin-top: 22px; }
.lg-side { position: sticky; top: calc(var(--topnav-h, 64px) + 16px); }
.lg-side__inner { display: flex; flex-direction: column; gap: 12px; max-height: calc(100dvh - var(--topnav-h, 64px) - 32px); }
.lg-search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 6px 0 12px;
    border: 1px solid var(--lg-line);
    border-radius: 14px;
    background: var(--lg-card);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.lg-search:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.lg-search > .material-icons-round { font-size: 1.15rem; color: var(--text-muted); }
.lg-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: none; font: inherit; font-size: 0.88rem; color: var(--text); background: transparent; outline: none; box-shadow: none; }
.lg-search__count { font-size: 0.72rem; font-weight: 700; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lg-search__count[hidden], .lg-search__nav[hidden] { display: none; }
.lg-search__nav { display: flex; }
.lg-search__nav button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 8px; color: var(--text-muted); background: transparent; cursor: pointer; }
.lg-search__nav button:hover { color: var(--text); background: var(--lg-soft); }

.lg-toc { display: flex; flex-direction: column; min-height: 0; padding: 8px; border: 1px solid var(--lg-line); border-radius: 18px; background: var(--lg-card); }
.lg-toc__toggle { display: none; }
.lg-toc__list { margin: 0; padding: 0; overflow-y: auto; list-style: none; scrollbar-width: thin; }
.lg-toc__list a {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.35;
    color: var(--text-muted);
    text-decoration: none;
    transition: background 0.12s ease, color 0.12s ease;
}
.lg-toc__list a:hover { color: var(--text); background: var(--lg-soft); }
.lg-toc__list a.is-active { color: var(--accent); font-weight: 700; background: color-mix(in srgb, var(--accent) 11%, transparent); }
.lg-toc__list a.is-active::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--accent); }
.lg-toc__list a.is-read .lg-toc__num { color: var(--success, #10b981); }
.lg-toc__list a.is-dim { opacity: 0.35; }
.lg-toc__num { min-width: 18px; font-size: 0.74rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.lg-side__help { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--lg-line); border-radius: 16px; font-size: 0.8rem; background: var(--lg-card); }
.lg-side__help > .material-icons-round { color: var(--accent); }
.lg-side__help div { display: flex; flex-direction: column; min-width: 0; }
.lg-side__help a { overflow: hidden; color: var(--accent); text-overflow: ellipsis; white-space: nowrap; }

/* ── Innehåll ── */
.lg-content { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.lg-sec {
    position: relative;
    padding: clamp(20px, 3vw, 30px);
    border: 1px solid var(--lg-line);
    border-radius: 22px;
    background: var(--lg-card);
    scroll-margin-top: calc(var(--topnav-h, 64px) + 18px);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.lg-sec.is-flash { border-color: color-mix(in srgb, var(--accent) 55%, var(--border)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 14%, transparent); }
.lg-sec[hidden] { display: none; }
.lg-sec h2 { display: flex; align-items: center; gap: 12px; padding-right: 40px; font-size: clamp(1.1rem, 2vw, 1.3rem); font-weight: 850; line-height: 1.25; letter-spacing: -0.02em; }
.lg-sec h2 > .material-icons-round:first-child { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 12px; font-size: 1.2rem; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.lg-sec h3 { margin-top: 18px !important; font-size: 0.98rem; font-weight: 800; }
.lg-sec p { margin-top: 10px !important; font-size: 0.94rem; line-height: 1.75; color: color-mix(in srgb, var(--text) 82%, var(--text-muted)); }
.lg-sec h2 + p { margin-top: 14px !important; }
.lg-sec a { color: var(--accent); font-weight: 650; text-underline-offset: 3px; }
.lg-sec strong { color: var(--text); }
.lg-sec em { color: var(--text-muted); }
.lg-sec ul { display: grid; gap: 7px; margin: 12px 0 0; padding: 0; list-style: none; }
.lg-sec ul li { position: relative; padding-left: 22px; font-size: 0.93rem; line-height: 1.65; color: color-mix(in srgb, var(--text) 82%, var(--text-muted)); }
.lg-sec ul li::before { content: ''; position: absolute; left: 4px; top: 0.7em; width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 70%, transparent); }
.lg-sec ul.pub-legal-list--plain li { padding: 10px 14px; border-radius: 12px; background: var(--lg-soft); }
.lg-sec ul.pub-legal-list--plain li::before { display: none; }
.lg-sec .pub-legal-note { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--warning, #f59e0b) 35%, transparent); border-radius: 14px; font-size: 0.88rem; color: var(--text); background: color-mix(in srgb, var(--warning, #f59e0b) 9%, transparent); }
.lg-sec .pub-legal-note::before { content: 'info'; font-family: 'Material Icons Round'; font-size: 1.2rem; line-height: 1.4; color: var(--warning, #f59e0b); }
.lg-anchor {
    position: absolute;
    top: clamp(18px, 3vw, 28px);
    right: clamp(14px, 2.5vw, 22px);
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: none;
    border-radius: 10px;
    color: var(--text-muted);
    background: transparent;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.lg-sec:hover .lg-anchor, .lg-anchor:focus-visible { opacity: 1; }
.lg-anchor:hover { color: var(--accent); background: var(--lg-soft); }
.lg-anchor.is-done { opacity: 1; color: var(--success, #10b981); }
.lg-anchor .material-icons-round { font-size: 1.1rem; }
mark.lg-hit { padding: 0 2px; border-radius: 4px; color: inherit; background: color-mix(in srgb, #facc15 40%, transparent); }
mark.lg-hit.is-current { background: #facc15; color: #111; box-shadow: 0 0 0 2px #facc15; }
.lg-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 40px 16px; border: 1px dashed var(--lg-line); border-radius: 20px; color: var(--text-muted); }
.lg-empty[hidden] { display: none; }

.lg-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
.lg-related { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1px solid var(--lg-line); border-radius: 20px; color: var(--text); text-decoration: none; background: var(--lg-card); transition: border-color 0.15s ease, transform 0.15s ease; }
.lg-related:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.lg-related > .material-icons-round:first-child { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 14px; color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.lg-related div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lg-related small { font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); }
.lg-related strong { font-size: 1rem; }
.lg-related p { font-size: 0.82rem; color: var(--text-muted); }
.lg-related__go { color: var(--text-muted); transition: transform 0.15s ease, color 0.15s ease; }
.lg-related:hover .lg-related__go { color: var(--accent); transform: translateX(3px); }

.lg-top { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); z-index: 120; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--lg-line); border-radius: 50%; color: var(--text); background: color-mix(in srgb, var(--bg-surface) 90%, transparent); box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.6); backdrop-filter: blur(12px); cursor: pointer; animation: lg-in 0.2s ease; }
.lg-top[hidden] { display: none; }
.lg-top:hover { color: var(--accent); }
@keyframes lg-in { from { opacity: 0; transform: translateY(8px); } }

/* ── Mobil ── */
@media (max-width: 980px) {
    .lg-layout { grid-template-columns: minmax(0, 1fr); }
    .lg-side { top: calc(var(--topnav-h, 60px) + 8px); z-index: 20; }
    .lg-side__inner { max-height: none; gap: 8px; }
    .lg-side__help { display: none; }
    .lg-toc { padding: 0; overflow: hidden; background: color-mix(in srgb, var(--bg-surface) 94%, transparent); backdrop-filter: blur(14px); box-shadow: 0 14px 30px -20px rgba(0, 0, 0, 0.7); }
    .lg-toc__toggle { display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0 14px; border: none; font: inherit; font-size: 0.88rem; font-weight: 750; text-align: left; color: var(--text); background: transparent; cursor: pointer; }
    .lg-toc__toggle > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .lg-toc__toggle .material-icons-round { color: var(--accent); }
    .lg-toc__chev { transition: transform 0.2s ease; }
    .lg-toc.is-open .lg-toc__chev { transform: rotate(180deg); }
    .lg-toc__list { display: none; max-height: 55dvh; padding: 0 6px 8px; }
    .lg-toc.is-open .lg-toc__list { display: block; }
    .lg-summary__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .lg-hero { border-radius: 22px; }
    .lg-hero__main { flex-direction: column; gap: 12px; }
    .lg-hero__icon { width: 52px; height: 52px; border-radius: 16px; }
    .lg-summary__grid, .lg-foot { grid-template-columns: minmax(0, 1fr); }
    .lg-search { order: 2; }
    .lg-anchor { opacity: 0.6; }
    .lg-sec { border-radius: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .lg *, .lg *::before { animation: none !important; transition: none !important; }
}

/* ── Utskrift / PDF ── */
@media print {
    body { background: #fff !important; color: #000 !important; }
    .app-topnav, .tn, .pub-footer, .pub-ambient, .au-ambient, .lg-progress, .lg-side, .lg-actions, .lg-top, .lg-anchor, .lg-foot, .lg-crumbs, .loading-screen, footer { display: none !important; }
    .lg { width: 100% !important; padding: 0 !important; }
    .lg-layout { display: block; margin: 0; }
    .lg-hero, .lg-summary, .lg-sec { border: none !important; background: none !important; box-shadow: none !important; padding: 0 0 14px !important; break-inside: avoid-page; color: #000; }
    .lg-hero__icon { display: none; }
    .lg-sec h2 > .material-icons-round:first-child { display: none; }
    .lg-sec p, .lg-sec li, .lg-lead, .lg-point p { color: #222 !important; }
    .lg-sec[hidden] { display: block !important; }
    .lg-sec a::after { content: ' (' attr(href) ')'; font-size: 0.8em; color: #555; }
    mark.lg-hit { background: none !important; }
}
