/* mylocationis.com: tokens, components, print. Colours exist only as the custom properties below (DESIGN.md §3). */
:root {
  color-scheme: light dark;
  --bg: #FBFBFA; --text: #17191C; --text-muted: #4A5057; --text-faint: #5F666D; --rule: #D8DBDE;
  --field-border: #767D84; --accent: #0A55A3; --accent-hover: #083F7A; --on-accent: #FFFFFF; --error: #A12020;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1B1C1E; --text: #ECEDEE; --text-muted: #B4B8BC; --text-faint: #9AA0A6; --rule: #3A3D41;
    --field-border: #80868C; --accent: #7DB2F0; --accent-hover: #A6CBF6; --on-accent: #0F1114; --error: #F28B82;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1B1C1E; --text: #ECEDEE; --text-muted: #B4B8BC; --text-faint: #9AA0A6; --rule: #3A3D41;
  --field-border: #80868C; --accent: #7DB2F0; --accent-hover: #A6CBF6; --on-accent: #0F1114; --error: #F28B82;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 17px/1.6 var(--font); font-variant-numeric: tabular-nums lining-nums; overflow-wrap: break-word; }
@media (min-width: 360px) { body { font-size: 18px; } }
img, video, svg, iframe, canvas { max-width: 100%; height: auto; }
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 20px; }
@media (min-width: 720px) { .wrap { padding: 0 24px; } }
main { padding-bottom: 48px; }
.skip { position: absolute; left: -9999px; top: 0; background: var(--bg); color: var(--text); padding: 12px 16px; z-index: 10; }
.skip:focus { left: 8px; top: 8px; }

/* header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; column-gap: 24px; row-gap: 0; padding-top: 8px; padding-bottom: 8px; }
.wordmark { font-size: 20px; line-height: 1; font-weight: 650; color: var(--text); text-decoration: none; padding: 12px 0; min-height: 44px; display: inline-flex; align-items: center; }
.wordmark span { color: var(--text-muted); font-weight: 400; }
.site-nav { display: flex; gap: 8px; margin-left: 0; }
.site-nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; color: var(--text); text-decoration: none; }
.site-nav a:hover { text-decoration: underline; }
.site-nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.theme-toggle { margin-left: auto; }
@media (max-width: 479px) { .site-nav { order: 3; width: 100%; margin-left: -8px; } }

/* type */
h1, h2, h3 { font-weight: 650; margin: 0; }
h1 { font-size: 32px; line-height: 1.2; margin: 32px 0 12px; }
@media (min-width: 720px) { h1 { font-size: 36px; } }
h2 { font-size: 24px; line-height: 1.3; border-top: 1px solid var(--rule); padding-top: 24px; margin: 48px 0 16px; }
h3 { font-size: 19px; line-height: 1.35; margin: 32px 0 8px; }
p, ul, ol, dl, table, figure { margin: 0 0 1em; max-width: 68ch; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: .35em; }
small, .small { font-size: 15px; line-height: 1.5; }
.muted { color: var(--text-muted); }
.lede { font-size: 18px; max-width: 68ch; }
.byline, .crumbs { font-size: 15px; line-height: 1.5; color: var(--text-muted); margin: 0 0 24px; }
.crumbs { margin: 24px 0 0; }
.crumbs a { color: var(--text-muted); }
.crumbs + h1 { margin-top: 12px; }
sup a { text-decoration: none; padding: 0 2px; }

a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; transition: color 120ms; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
a:visited { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }

/* buttons and fields */
.btn, button { font: inherit; min-height: 44px; border-radius: 4px; padding: 8px 16px; cursor: pointer; border: 1px solid var(--field-border); background: var(--bg); color: var(--text); transition: color 120ms, background-color 120ms, border-color 120ms; }
.btn:hover, button:hover { border-color: var(--text); }
.btn-primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 600; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
button:disabled { cursor: default; opacity: 1; color: var(--text-muted); border-color: var(--rule); }
.btn-primary:disabled { background: var(--bg); color: var(--text-muted); border-color: var(--field-border); }
button[hidden] { display: none; }
label { display: block; font-weight: 600; margin: 0 0 4px; }
input, select { font: inherit; font-size: 16px; min-height: 44px; width: 100%; max-width: 100%; padding: 8px 12px; border: 1px solid var(--field-border); border-radius: 4px; background: var(--bg); color: var(--text); }
input::placeholder { color: var(--text-faint); opacity: 1; }
.field { margin: 0 0 16px; }
.field .help { font-size: 15px; line-height: 1.5; color: var(--text-muted); margin: 4px 0 0; }
.fields { display: grid; gap: 0 16px; grid-template-columns: 1fr; }
@media (min-width: 560px) { .fields.cols-3 { grid-template-columns: 1fr 1fr 1fr; } .fields.cols-2 { grid-template-columns: 1fr 1fr; } }
.dms-row { display: grid; gap: 8px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0 0 16px; }
.dms-row input, .dms-row select { padding-left: 8px; padding-right: 8px; }
fieldset { border: 0; border-top: 1px solid var(--rule); margin: 24px 0 0; padding: 16px 0 0; min-width: 0; }
legend { font-weight: 650; padding: 0; margin-bottom: 8px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }

/* messages */
.error { color: var(--error); margin: 16px 0; font-weight: 600; }
.error[hidden], [hidden] { display: none !important; }
.note { border-left: 2px solid var(--rule); padding-left: 16px; color: var(--text-muted); }

/* tool */
.tool { border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 24px 0; margin: 24px 0 32px; }
.tool > :last-child { margin-bottom: 0; }
.sentence { font-size: 28px; line-height: 1.2; font-weight: 600; margin: 16px 0 8px; }
.sentence .lbl { display: block; font-size: 17px; font-weight: 400; color: var(--text-muted); margin-bottom: 4px; }
.figure { font-size: 28px; line-height: 1.2; font-weight: 600; font-variant-numeric: tabular-nums lining-nums; }
.unit { color: var(--text-muted); }
.result-note { color: var(--text-muted); margin: 8px 0; }
.result-links { font-size: 15px; margin: 8px 0 0; }
dl.card { margin: 16px 0; max-width: 68ch; }
dl.card .row { display: grid; grid-template-columns: 9em 1fr; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--rule); }
dl.card .row:last-child { border-bottom: 1px solid var(--rule); }
dl.card dt { color: var(--text-muted); font-size: 16px; }
dl.card dt a { color: var(--text-muted); }
dl.card dd { margin: 0; font-variant-numeric: tabular-nums lining-nums; }
dl.card dd .unit { margin-left: .25em; }
@media (max-width: 400px) { dl.card .row { grid-template-columns: 1fr; } }
.privacy-box { border: 1px solid var(--rule); padding: 16px; margin: 0 0 32px; max-width: 68ch; }
.privacy-box h2 { border: 0; padding: 0; margin: 0 0 8px; font-size: 19px; }
.privacy-box p:last-child { margin-bottom: 0; }

/* tables */
.table-wrap { overflow-x: auto; max-width: 100%; margin: 0 0 1em; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
table { border-collapse: collapse; width: 100%; max-width: none; margin: 0; font-variant-numeric: tabular-nums lining-nums; }
caption { text-align: left; color: var(--text-muted); font-size: 15px; padding: 0 0 8px; }
th, td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
thead th { font-weight: 600; border-bottom: 1px solid var(--text); }
td.num, th.num { text-align: right; }
figure { margin: 0 0 1.5em; }
figcaption { color: var(--text-muted); font-size: 15px; line-height: 1.5; margin-top: 8px; }

/* sources, ads, footer */
.sources li { overflow-wrap: anywhere; }
.page-note { font-size: 15px; line-height: 1.5; color: var(--text-muted); border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 48px; }
.ad-slot:empty { display: none; }
.ad-slot:not(:empty) { margin: 32px 0; padding: 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.ad-slot:not(:empty)::before { content: attr(data-label); display: block; font-size: 13px; color: var(--text-faint); padding: 8px 0; }
.site-footer { border-top: 1px solid var(--rule); padding: 32px 0 48px; font-size: 15px; line-height: 1.5; color: var(--text-muted); }
.footer-groups { display: grid; gap: 24px; grid-template-columns: 1fr; margin-bottom: 24px; }
@media (min-width: 560px) { .footer-groups { grid-template-columns: repeat(3, 1fr); } }
.footer-groups h2 { border: 0; padding: 0; margin: 0 0 8px; font-size: 15px; color: var(--text); }
.footer-groups ul { list-style: none; padding: 0; margin: 0; }
.footer-groups li { margin: 0; }
.footer-groups a { display: inline-block; padding: 8px 0; min-height: 44px; }
.site-footer p { color: var(--text-muted); margin: 0 0 8px; }
.site-footer a { color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print {
  :root, :root[data-theme] { --bg: #fff; --text: #000; --text-muted: #000; --text-faint: #000; --rule: #999; --accent: #000; --accent-hover: #000; --error: #000; --field-border: #000; }
  body { font-size: 12pt; }
  .theme-toggle, .ad-slot, .site-nav, .btn, button, .skip { display: none !important; }
  a { color: #000; text-decoration: underline; }
  a[href^="/"]::after { content: " (" attr(href) ")"; font-size: .85em; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; word-break: break-all; }
}
.theme-toggle[aria-pressed="true"] { border-color: var(--text); font-weight: 600; }

/* polish: type rhythm, browser surfaces, footer density */
h1, h2, h3 { text-wrap: balance; }
p, li, dd { text-wrap: pretty; }
h1 + .lede, h1 + p { margin-top: 0; }
.lede + .byline, .lede + p.muted { margin-top: -4px; }
::selection { background: var(--rule); color: var(--text); }
input, select, textarea { caret-color: var(--accent); accent-color: var(--accent); }
input:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--error); }
html { scrollbar-color: var(--field-border) var(--bg); scroll-padding-top: 16px; }
.site-header .wrap { padding-top: 4px; padding-bottom: 4px; }
.site-nav a[aria-current="page"], .site-nav a:hover { text-decoration-thickness: 2px; text-underline-offset: 6px; }
.btn-primary { padding-left: 24px; padding-right: 24px; }
.btn-primary:focus-visible { outline-offset: 3px; }
.tool { margin-top: 28px; padding: 28px 0; }
.sentence { margin-top: 20px; }
dl.card dt { padding-top: 1px; }
dl.card dd { overflow-wrap: anywhere; }
.privacy-box { border: 0; padding: 0; }
.tool { border-bottom: 0; padding-bottom: 8px; }
.quicklinks { margin: 0 0 16px; }
.page-note { margin-top: 56px; }
@media (min-width: 560px) {
  .footer-groups { grid-template-columns: 1.4fr 1fr 1fr; }
}
@media (hover: hover) and (pointer: fine) {
  .footer-groups a { padding: 4px 0; min-height: 32px; }
}
.footer-groups a, .site-footer a { text-underline-offset: 3px; }

/* design review 2: coverage line, link targets, coordinate row, status */
.lede-cover { margin: 0 0 8px; color: var(--text-muted); font-size: 16px; }
.quicklinks { display: flex; flex-wrap: wrap; column-gap: 12px; align-items: center; }
.quicklinks a { padding: 0; }
.quicklinks a, .result-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
.result-links { display: flex; flex-wrap: wrap; column-gap: 8px; align-items: center; }
@media (min-width: 560px) {
  .fields.cols-3 { grid-template-columns: 1fr 1fr; }
  .fields.cols-3 .field:nth-child(3) { grid-column: 1 / -1; }
}
.tool-status { margin: 0 0 12px; }

/* design review 4: collapsed fallback, tool list, footer columns */
details.fallback { border-top: 1px solid var(--rule); margin: 16px 0 0; padding: 0; }
details.fallback > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
details.fallback > summary:hover { color: var(--accent-hover); }
details.fallback > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.fallback[open] > summary { margin-bottom: 8px; }
ul.toollist { list-style: none; padding: 0; margin: 0; }
ul.toollist li { margin: 0; padding: 10px 0; border-top: 1px solid var(--rule); }
ul.toollist li:last-child { border-bottom: 1px solid var(--rule); }
@media (max-width: 559px) {
  .footer-groups { grid-template-columns: 1fr 1fr; }
  .footer-groups > div:first-child { grid-column: 1 / -1; }
  .footer-groups > div:first-child ul { columns: 2; column-gap: 24px; }
}
