/* SverigeFokus tools (Verktyg): the hub and every tool page, in Swedish and English.
   Colours and fonts follow the landing (landing/public/styles.css). */
:root {
  --blue: #005293; --blue-dark: #003a69; --blue-deep: #04264a; --yellow: #fecb00;
  --ink: #0e2038; --muted: #4f6076; --faint: #64748b; --bg: #f7f9fc; --surface-alt: #eef4fa;
  --card: #ffffff; --line: #e3eaf3; --green: #14804a; --green-soft: #e3f3ea; --red: #b42318; --red-soft: #fdecea; --radius: 20px;
  --shadow-sm: 0 2px 10px #04264a0f; --shadow-md: 0 12px 32px #04264a1a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: var(--blue); }
h1, h2, h3 { font-family: "Manrope", "Figtree", sans-serif; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 780px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }

.flag { width: 26px; height: 17px; border-radius: 3px; display: inline-block; flex-shrink: 0; box-shadow: var(--shadow-sm);
  background: linear-gradient(to bottom, transparent 40%, var(--yellow) 40%, var(--yellow) 60%, transparent 60%),
    linear-gradient(to right, transparent 31%, var(--yellow) 31%, var(--yellow) 44%, transparent 44%), var(--blue); }
.flag.tiny { width: 20px; height: 13px; }

/* Header and footer, like the landing's. */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--blue-dark); font: 800 1.12rem "Manrope", sans-serif; text-decoration: none; letter-spacing: -0.02em; }
.topnav { display: flex; gap: 20px; margin-inline-start: auto; }
.topnav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: .95rem; }
.topnav a[aria-current="page"] { color: var(--blue); }
.lang { display: flex; gap: 4px; font-size: .85rem; font-weight: 700; }
.lang a, .lang span { padding: 4px 8px; border-radius: 8px; text-decoration: none; color: var(--faint); }
.lang span { background: var(--surface-alt); color: var(--blue); }
.footer { border-top: 1px solid var(--line); background: var(--card); margin-top: 48px; padding: 24px 0 32px; color: var(--muted); font-size: .9rem; }
.footer .wrap { display: grid; gap: 12px; }
.footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.footer nav a { color: var(--muted); text-decoration: none; font-weight: 600; }
.disclaimer { display: flex; gap: 10px; align-items: flex-start; background: var(--surface-alt); border-radius: 14px; padding: 12px 16px; color: var(--muted); font-size: .9rem; }
.disclaimer i { color: var(--blue); font-size: 20px; line-height: 1.3; }

/* The hub: one tile per tool, like a phone's home screen. */
.hero { padding: 40px 0 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--blue); font-size: .9rem; background: var(--surface-alt); padding: 6px 12px; border-radius: 99px; }
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); line-height: 1.12; margin: 14px 0 10px; color: var(--blue-deep); max-width: 20ch; }
.hero p { margin: 0; color: var(--muted); max-width: 62ch; font-size: 1.05rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; padding: 28px 0 12px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); min-height: 168px; transition: transform .12s ease, box-shadow .12s ease; }
a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 28px; background: var(--blue); color: #fff; flex-shrink: 0; }
.icon.yellow { background: var(--yellow); color: var(--blue-deep); }
.icon.green { background: var(--green-soft); color: var(--green); }
/* Long one-word names (Försäkringskassan, Uppehållstillstånd) are wider than a tile on a phone. The hub marks where
   each compound may break (&shy;), which reads better than a dictionary's break; anything else breaks where it must. */
.tile h2 { font-size: 1.02rem; overflow-wrap: break-word; }
.tile p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.4; }
.pill { position: absolute; top: 14px; inset-inline-end: 14px; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
.pill.new { background: var(--yellow); color: var(--blue-deep); }
.pill.ext { background: var(--surface-alt); color: var(--blue); }
.tile .progress { margin-top: auto; font-size: .78rem; font-weight: 600; color: var(--green); }
.tile.soon { background: #fbfcfe; box-shadow: none; border-style: dashed; }
.tile.soon .icon { background: var(--surface-alt); color: var(--faint); }
.tile.soon h2 { color: var(--muted); }
.tile.soon .pill { background: var(--surface-alt); color: var(--faint); }

/* Illustrations (tools/gen-images.mjs). Their light blue background is the same as --surface-alt. */
.hero.with-art { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 28px; align-items: center; }
.hero-art { margin: 0; }
.hero-art img { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.tool-art { display: block; width: 100%; max-width: 360px; height: auto; margin: 0 auto 16px; border-radius: 16px; }

/* A tool page. */
.tool { padding-top: 24px; padding-bottom: 8px; }
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; text-decoration: none; color: var(--blue); }
.toolhead { display: flex; gap: 16px; align-items: center; margin: 18px 0 6px; }
.toolhead h1 { font-size: clamp(1.7rem, 4vw, 2.3rem); color: var(--blue-deep); }
.toolhead p { margin: 2px 0 0; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .85rem; color: var(--faint); margin: 8px 0 18px; }
.meta i { vertical-align: -2px; }
.meta .count { font-weight: 700; color: var(--green); }
.intro { margin: 0 0 6px; max-width: 66ch; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.panel + .panel { margin-top: 16px; }
.switch { display: inline-flex; flex-wrap: wrap; background: var(--surface-alt); border-radius: 18px; padding: 4px; gap: 4px; margin: 14px 0 18px; }
.switch button { font: inherit; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 9px 16px; border-radius: 14px; cursor: pointer; }
.switch button[aria-pressed="true"] { background: var(--card); color: var(--blue); box-shadow: var(--shadow-sm); }
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
ol.steps > li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; counter-increment: step; }
ol.steps > li > input { width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--green); }
ol.steps > li > label { font: 800 1.05rem "Manrope", sans-serif; letter-spacing: -0.01em; cursor: pointer; }
ol.steps > li > label::before { content: counter(step) ". "; color: var(--faint); }
ol.steps > li > .body { grid-column: 2; color: var(--ink); font-size: .95rem; }
ol.steps > li > .body p { margin: 6px 0 0; }
ol.steps > li > .body ul { margin: 6px 0 0; padding-inline-start: 20px; }
ol.steps > li.done > label { color: var(--faint); text-decoration: line-through; }
ol.steps > li.done > .body { opacity: .7; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.links a { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; text-decoration: none; background: var(--surface-alt); padding: 6px 12px; border-radius: 99px; }
/* A step that applies only to some people says so in a small label after its title. */
.tag { display: inline-block; margin-inline-start: 6px; padding: 2px 9px; border-radius: 99px; background: var(--surface-alt); color: var(--blue); font: 700 .74rem "Figtree", sans-serif; letter-spacing: 0; vertical-align: 2px; }
ol.steps > li.done > label .tag { text-decoration: none; }
/* Good-to-know points under a tool's intro. */
ul.notes { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .93rem; color: var(--muted); }
ul.notes li { position: relative; padding-inline-start: 22px; }
ul.notes li::before { content: ""; position: absolute; inset-inline-start: 4px; top: .55em; width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); }
.tip { margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #fff7d6; border: 1px solid #f3dc7a; color: #5a4600; font-size: .9rem; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--blue); }
details.more ul { margin: 6px 0 0; padding-inline-start: 20px; }
.sources h2 { font-size: 1.1rem; margin-bottom: 8px; }
.sources ul { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: .92rem; }
.related { margin-top: 16px; font-size: .95rem; }
/* A date calculator inside a step (the driving licence tool's last day). */
.deadline { margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: var(--surface-alt); }
.deadline label { display: block; font-weight: 700; margin-bottom: 6px; }
.deadline input[type="date"] { font: inherit; color: var(--ink); background: var(--card); border: 1px solid #c9d6e6; border-radius: 10px; padding: 8px 12px; min-height: 44px; max-width: 100%; }
.deadline .hint { font-size: .85rem; color: var(--muted); }
.deadline-out strong { color: var(--blue-deep); }
.deadline .links a { background: var(--card); }

/* The rent check: a part per question, warning signs with a verdict, and a small calculator. */
.part h2 { font-size: 1.35rem; color: var(--blue-deep); }
.part h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.part > p { margin: 8px 0 0; }
.signs { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.signs label { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; font-size: .95rem; }
.signs label.on { border-color: #f1b8b1; background: var(--red-soft); }
.signs input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--red); flex-shrink: 0; }
.verdict { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 14px 16px; border-radius: 14px; font-weight: 600; }
.verdict i { font-size: 22px; line-height: 1.2; }
.verdict.ok { background: var(--green-soft); color: #0d5c35; }
.verdict.warn { background: #fff7d6; border: 1px solid #f3dc7a; color: #5a4600; }
.verdict.bad { background: var(--red-soft); border: 1px solid #f1b8b1; color: #8a1c12; }
ul.checklist { margin: 0; padding-inline-start: 22px; display: grid; gap: 4px; }
.calc { display: grid; gap: 14px; margin-top: 14px; padding: 16px; border-radius: 14px; background: var(--surface-alt); }
.calc label { display: grid; gap: 4px; font-weight: 700; font-size: .95rem; }
.calc input[type="text"] { font: inherit; font-weight: 400; color: var(--ink); background: var(--card); border: 1px solid #c9d6e6; border-radius: 10px; padding: 8px 12px; min-height: 44px; width: 100%; max-width: 220px; }
.calc label.check { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.calc label.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--blue); }
.calc .hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
.calc-out { margin-top: 12px; padding: 14px 16px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.calc-out p { margin: 0; }
.calc-out p + p { margin-top: 8px; }
.calc-out strong { color: var(--blue-deep); }
.calc-out .hint { font-size: .85rem; color: var(--muted); }
.case-panel { margin-top: 4px; }

@media (max-width: 760px) {
  .hero.with-art { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .hero-art { max-width: 260px; justify-self: center; }
  .tool-art { max-width: 240px; }
  .topnav { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { min-height: 156px; }
  .panel { padding: 16px; }
  ol.steps > li { padding: 14px 12px; }
  /* A switch with more than two choices becomes a 2 x 2 grid on phones. */
  .switch.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .switch.grid button { padding: 9px 10px; line-height: 1.25; }
  /* With three choices, the last one takes the whole second row. */
  .switch.grid button:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Arabic, right to left (/ar/tools). The layout follows dir="rtl" through the logical properties above. Manrope and
   Figtree have no Arabic letters, so an Arabic face comes first; letter-spacing would pull joined Arabic letters apart. */
:lang(ar) body { font-family: "IBM Plex Sans Arabic", "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
:lang(ar) h1, :lang(ar) h2, :lang(ar) h3, :lang(ar) ol.steps > li > label, :lang(ar) .tag { font-family: "IBM Plex Sans Arabic", "Manrope", sans-serif; letter-spacing: 0; }
