/* QoraDaily styles. Brand: red and black. Mobile first; light and dark themes.
   Colours are tokens at the top: change them here and the whole site follows. */

:root {
  --brand-red: #C8102E;
  --brand-black: #0E0E0F;

  --bg: #F7F6F4;
  --surface: #FFFFFF;
  --ink: #141414;
  --muted: #5F5B57;
  --line: #E3E0DC;
  --accent: #C8102E;
  --accent-ink: #FFFFFF;
  --accent-soft: #FBEAEC;
  --good: #11743A;
  --bad: #B3261E;
  --amber: #A45F00;
  --blue: #3559A8;
  --header-bg: #FFFFFF;
  --header-ink: #141414;
  --header-muted: #5F5B57;
  --header-line: #E3E0DC;

  /* older names used by the calculators */
  --up: var(--good);
  --down: var(--bad);

  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 10px;
  color-scheme: light;
}

/* Dark theme: chosen with the switch, or following the phone/computer setting */
:root[data-theme="dark"] {
  --bg: #0C0C0D; --surface: #161618; --ink: #F1F1F1; --muted: #A7A3A0; --line: #2B2A2C;
  --accent: #FF4D5E; --accent-ink: #0C0C0D; --accent-soft: #3A1418;
  --good: #4CC983; --bad: #FF7A72; --amber: #F0B04C; --blue: #8FAEF0;
  --header-bg: #111112; --header-ink: #F4F4F4; --header-muted: #A9A9A9; --header-line: #2E2E30; color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0C0D; --surface: #161618; --ink: #F1F1F1; --muted: #A7A3A0; --line: #2B2A2C;
    --accent: #FF4D5E; --accent-ink: #0C0C0D; --accent-soft: #3A1418;
    --good: #4CC983; --bad: #FF7A72; --amber: #F0B04C; --blue: #8FAEF0;
    --header-bg: #111112; --header-ink: #F4F4F4; --header-muted: #A9A9A9; --header-line: #2E2E30; color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.55; overflow-wrap: break-word; }
img { max-width: 100%; height: auto; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { width: 100%; max-width: 1200px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 8px; z-index: 50; background: var(--surface); padding: 8px; }

h1, h2, h3 { font-family: var(--display); font-stretch: 85%; line-height: 1.12; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(28px, 6vw, 44px); font-weight: 800; }
h2 { font-size: clamp(20px, 3.4vw, 25px); font-weight: 700; }
h3 { font-size: 18px; font-weight: 700; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.small { font-size: 13px; color: var(--muted); margin: 0; }
code { font-family: var(--mono); font-size: .9em; }

/* ---------- header ---------- */
header.mast { position: sticky; top: 0; z-index: 20; background: var(--header-bg); color: var(--header-ink); border-top: 4px solid var(--brand-red); border-bottom: 1px solid var(--header-line); box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.mast .top { display: flex; align-items: center; gap: 12px; padding-block: 12px 4px; }
.brand { font-family: var(--display); font-weight: 800; font-stretch: 80%; font-size: 28px; letter-spacing: -.01em; line-height: 1; text-decoration: none; color: var(--header-ink); }
.brand span { color: var(--brand-red); }
.brand img { display: block; height: 34px; width: auto; }
.mast .updated { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--header-muted); display: none; }
.theme-toggle { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; background: transparent; color: var(--header-ink); border: 1px solid var(--header-line); border-radius: 999px; padding: 6px 12px; font: 600 13px var(--body); cursor: pointer; }
.theme-toggle:hover { border-color: var(--brand-red); }
.theme-toggle svg { width: 16px; height: 16px; }
.groups { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin-inline: -4px; }
.groups::-webkit-scrollbar, .subnav::-webkit-scrollbar, .tabs::-webkit-scrollbar { display: none; }
.groups a { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--header-muted); padding: 10px 10px 11px; border-bottom: 3px solid transparent; white-space: nowrap; margin-bottom: -1px; }
.groups a:hover { color: var(--header-ink); }
.groups a[aria-current="page"] { color: var(--header-ink); border-color: var(--brand-red); }
.subnav { display: flex; gap: 6px; overflow-x: auto; padding-block: 10px; scrollbar-width: none; border-top: 1px solid var(--header-line); }
.subnav a { font: 600 13.5px var(--body); text-decoration: none; color: var(--header-muted); padding: 5px 12px; border-radius: 999px; border: 1px solid var(--header-line); white-space: nowrap; }
.subnav a:hover { color: var(--header-ink); border-color: var(--header-muted); }
.subnav a[aria-current="page"] { background: var(--brand-red); color: #FFFFFF; border-color: var(--brand-red); }
@media (min-width: 700px) { .mast .updated { display: block; } .theme-toggle { margin-left: 12px; } }

.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; padding-top: 16px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* ---------- page layout ---------- */
.desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 20px 48px; }
.desk > * { min-width: 0; }
@media (min-width: 1000px) { .desk { grid-template-columns: minmax(0, 1fr) 340px; gap: 36px; padding-top: 28px; } }
@media (min-width: 1200px) { .desk { grid-template-columns: minmax(0, 1fr) 370px; } }
.page { display: grid; gap: 18px; padding-block: 20px 56px; max-width: 820px; min-width: 0; }
.page p, .page li { max-width: 68ch; }
.page p { margin: 0; }
.page.flush { padding-top: 0; }
.page.wide { max-width: none; }
aside { display: flex; flex-direction: column; gap: 22px; min-width: 0; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: grid; gap: 14px; align-content: start; min-width: 0; }
@media (min-width: 600px) { .panel { padding: 22px; } }

/* ---------- news ---------- */
.feedhead { display: grid; gap: 10px; margin-bottom: 16px; }
.feedhead p { margin: 0; color: var(--muted); max-width: 62ch; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { font-weight: 700; font-size: 15px; text-decoration: none; color: var(--muted); padding: 10px 12px; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-color: var(--accent); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 4px; }
.chips button { font: 600 13px var(--body); border: 1px solid var(--line); background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lead { display: grid; gap: 8px; padding: 16px 0 18px; border-bottom: 1px solid var(--line); }
.lead h3 { font-size: clamp(21px, 3.6vw, 28px); }
.story { display: grid; gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.story h3 { font-family: var(--body); font-stretch: normal; font-size: 17.5px; line-height: 1.32; }
.story a, .lead a { text-decoration: none; }
.story a:hover h3, .lead a:hover h3 { color: var(--accent); }
.meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.meta .topic { color: var(--accent); font-weight: 700; }
.snip { margin: 0; color: var(--muted); max-width: 68ch; }
.empty { padding: 18px 0; color: var(--muted); margin: 0; }
.btn.more { margin-top: 14px; justify-self: start; }
.regions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 16px; margin-top: 28px; }
.minifeed { gap: 10px; }
.mf-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mf { display: grid; gap: 3px; text-decoration: none; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.mf:last-child { border-bottom: 0; padding-bottom: 0; }
.mf b { font-size: 15px; line-height: 1.32; }
.mf:hover b { color: var(--accent); }
.tools-block { display: grid; gap: 12px; margin-top: 28px; }

/* ---------- tool cards ---------- */
.toolgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 12px; }
.tool { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.tool:hover { border-color: var(--accent); }
.tool strong { font-family: var(--display); font-stretch: 85%; font-size: 18px; }
.tool span { font-size: 14px; color: var(--muted); }
.panel.tools a { display: block; font-weight: 600; text-decoration: none; padding: 9px 0; border-bottom: 1px solid var(--line); }
.panel.tools a:last-child { border-bottom: 0; }
.panel.tools a:hover { color: var(--accent); }

/* ---------- forms and calculators ---------- */
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 560px) { .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .page .fields { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); } }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .calc > label { font-weight: 700; font-size: 14px; }
.inrow { display: flex; align-items: center; min-width: 0; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); overflow: hidden; }
.inrow:focus-within { border-color: var(--accent); }
.inrow > span { flex: none; font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 0 10px; white-space: nowrap; }
.inrow > span:first-child { padding-right: 0; }
.inrow input, .inrow select { flex: 1 1 auto; width: 100%; min-width: 0; border: 0; background: transparent; color: var(--ink); outline: none; padding: 11px 12px; font: 500 18px var(--mono); }
.inrow select { font: 600 15px var(--body); cursor: pointer; padding-right: 8px; }
.inrow input + select { flex: 0 1 auto; width: auto; border-left: 1px solid var(--line); }
.net { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; padding: 14px; border-radius: 8px; background: var(--accent-soft); }
.net > span { font-weight: 600; }
.net strong { font-family: var(--mono); font-size: clamp(20px, 5vw, 26px); color: var(--accent); font-variant-numeric: tabular-nums; }
.bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); }
.bar i { display: block; height: 100%; }
table.brk { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.brk td { padding: 8px 0; border-bottom: 1px solid var(--line); }
table.brk td:last-child { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; padding-left: 12px; white-space: nowrap; }
table.brk tr.sub td { color: var(--muted); font-size: 13px; }
table.brk tr.total td { font-weight: 700; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.yrs summary { cursor: pointer; font-weight: 700; font-size: 14px; }
.assumptions { font-size: 13px; color: var(--muted); border-left: 3px solid var(--line); padding-left: 12px; margin: 0; }

.btn { display: inline-block; text-align: center; text-decoration: none; font: 700 15px var(--body); border: 0; border-radius: 8px; padding: 11px 18px; cursor: pointer; background: var(--accent); color: var(--accent-ink); }
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border: 1.5px solid var(--ink); color: var(--ink); }
.btn.dark { background: var(--ink); color: var(--bg); }

.form { display: grid; gap: 14px; max-width: 640px; }
.form input:not([type=checkbox]):not([type=radio]), .form textarea, .form select, .join input {
  width: 100%; min-width: 0; font: 16px var(--body); padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }
.form textarea { min-height: 160px; resize: vertical; line-height: 1.5; }
.form input:focus, .form textarea:focus, .form select:focus { outline: none; border-color: var(--accent); }
.form .row { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .form .row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.form .check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.form .btn { justify-self: start; }
.alert { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); border: 1px solid var(--accent); }
.alert.ok { background: transparent; border-color: var(--good); color: var(--ink); }
.join form { display: grid; gap: 8px; grid-template-columns: minmax(0, 1fr) auto; }
.join label { grid-column: 1 / -1; }
.lede-small { font-size: 14px; color: var(--muted); margin: 0; }
.full { grid-column: 1 / -1; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.side-calc { display: grid; gap: 10px; }

/* ---------- data tables and figures ---------- */
.bands { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.bands table:not(.data) { border-collapse: collapse; width: 100%; font-size: 15px; }
.bands table:not(.data) th, .bands table:not(.data) td { text-align: left; padding: 9px 16px 9px 0; border-bottom: 1px solid var(--line); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: left; font-weight: 700; padding: 8px 12px 8px 0; border-bottom: 2px solid var(--ink); white-space: nowrap; }
table.data td { padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data .n { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data th.n { font-family: var(--body); }
table.data tr.hl td { background: var(--accent-soft); }
table.data tr.hl td:first-child { box-shadow: inset 3px 0 0 var(--accent); padding-left: 8px; }
table.data a { text-decoration: none; }
table.data a:hover { color: var(--accent); }
@media (max-width: 559px) { table.data { font-size: 14px; } table.data td, table.data th { padding-right: 8px; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 12px; }
.stat { display: grid; gap: 2px; padding: 14px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat strong { font-family: var(--mono); font-size: clamp(18px, 4.5vw, 22px); font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.good { color: var(--good); font-size: 13px; font-weight: 600; }
.bad { color: var(--bad); font-size: 13px; font-weight: 600; }
.flat { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; font: 700 11.5px var(--body); padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 4px; }
.pill.warn { background: transparent; border: 1px solid var(--amber); color: var(--amber); }
.source { font-size: 13px; color: var(--muted); margin: 0; }
.source a { color: var(--accent); }
.note { padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--muted); margin: 0; }
.steps { display: grid; gap: 10px; padding-left: 22px; margin: 0; }
.snapshot { gap: 12px; }
.snap { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.snap a { display: grid; gap: 1px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--bg); min-width: 0; }
.snap a:hover { border-color: var(--accent); }
.snap span { font-size: 12px; color: var(--muted); font-weight: 600; }
.snap strong { font-family: var(--mono); font-size: 17px; font-variant-numeric: tabular-nums; }
.snap em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.faq details { border-bottom: 1px solid var(--line); padding: 12px 0; }
.faq summary { font-weight: 700; cursor: pointer; }
.faq p { margin: 8px 0 0; }
.ad-slot { min-height: 0; }
.ad-slot ins { display: block; }
.email-big { font-size: 20px; font-weight: 700; user-select: all; }

/* ---------- blog ---------- */
.posts { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.post-card { display: grid; gap: 8px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.post-card img { aspect-ratio: 16/9; object-fit: cover; width: 100%; display: block; background: var(--line); }
.post-card .pc-body { display: grid; gap: 6px; padding: 14px 16px 18px; }
.post-card h2 { font-size: 21px; }
.post-card:hover h2 { color: var(--accent); }
.article { display: grid; gap: 18px; max-width: 760px; padding-block: 20px 56px; min-width: 0; }
.article .cover { border-radius: var(--radius); aspect-ratio: 16/9; object-fit: cover; width: 100%; }
.prose { font-size: 18px; line-height: 1.7; display: grid; gap: 16px; }
.prose > * { margin: 0; max-width: 70ch; }
.prose h2 { margin-top: 12px; }
.prose a { color: var(--accent); }
.prose img { border-radius: 8px; }
.prose blockquote { border-left: 4px solid var(--accent); padding-left: 16px; color: var(--muted); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; display: block; overflow-x: auto; }
.prose td, .prose th { border-bottom: 1px solid var(--line); padding: 8px 12px 8px 0; text-align: left; }

/* ---------- footer ---------- */
footer { background: var(--header-bg); color: var(--header-ink); border-top: 1px solid var(--header-line); box-shadow: inset 0 4px 0 var(--brand-red); }
footer .wrap { padding-block: 28px 36px; display: grid; gap: 18px; }
footer .links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); gap: 18px; font-size: 14px; }
footer .links div { display: grid; gap: 7px; align-content: start; }
footer .links b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--brand-red); }
footer a { text-decoration: none; color: var(--header-ink); }
footer .brand-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
footer a:hover { color: var(--brand-red); }
footer .small { color: var(--header-muted); }

/* ---------- setup and admin helpers ---------- */
.setup code { background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.setup pre { font-family: var(--mono); font-size: 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }
.setup pre.copy { user-select: all; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.checklist li { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.checklist li.pass b { color: var(--good); }
.checklist li.fail { border-color: var(--bad); }
.checklist li.fail b { color: var(--bad); }
.setup-ok, .report { padding: 12px 14px; border-radius: 8px; background: var(--accent-soft); }
.report p { margin: 0 0 8px; }
.setup form { display: flex; gap: 8px; flex-wrap: wrap; }
.settings { display: grid !important; gap: 14px; max-width: 560px; }
.settings input:not([type=checkbox]) { font: 15px var(--body); padding: 10px 11px; border: 1.5px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: 100%; }
.settings .check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.settings .btn { justify-self: start; }

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

/* ---------- rates strip under the header ---------- */
.ticker { background: var(--surface); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 13px; overflow-x: auto; scrollbar-width: none; }
.ticker::-webkit-scrollbar { display: none; }
.ticker .wrap { display: flex; gap: 22px; padding-block: 8px; white-space: nowrap; }
.ticker a { text-decoration: none; color: var(--ink); font-variant-numeric: tabular-nums; }
.ticker a:hover { color: var(--accent); }
.ticker b { font-family: var(--body); font-weight: 700; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }

/* ---------- homepage and topics ---------- */
.topics { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 28px; }
.topics .eyebrow { margin-right: 6px; }
.topics a { font: 600 14px var(--body); text-decoration: none; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.topics a:hover { border-color: var(--accent); color: var(--accent); }
.wide-only { display: none; }
@media (min-width: 1000px) { .wide-only { display: block; } }
.guides-panel { border-top: 3px solid var(--accent); }
.posts .post-card h2 { font-size: 19px; }
.posts.compact { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }
.posts.compact .post-card { border-top: 3px solid var(--accent); }
.posts.compact .post-card h2 { font-size: 18px; }
.posts.compact .snip { font-size: 14.5px; line-height: 1.55; max-height: 6.2em; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; padding: 0; }

/* Salary calculators by country */
.field[hidden] { display: none; }
.calc .checks { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 14px; }
.calc .check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.calc .check input { width: 18px; height: 18px; accent-color: var(--accent); }
