/* Shared SpeckLog colors and layout. */
:root {
  --bg: #e6e1d7; --card: #f1ede5; --text: #26241f; --muted: #5b574f; --outline: #39362e;
  --fill: #ddd7cb; --accent: #302d26; --callout: #e9e3d8;
  --outline-width: 3px;
  --page-width: 700px;
  --page-gutter: 16px;
  --controls-width: 180px;
  --controls-gap: 12px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #171310; --card: #221b17; --text: #f4eee8; --muted: #cabbb0; --outline: #f1ded0;
  --fill: #342a24; --accent: #f1ded0; --callout: #2a221d;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 475 17px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* Text selection hugs the text: Safari fills the gaps between selected blocks out to the page
   edges, but not inside flex columns, so the containers are flex columns (margins don't
   collapse in them, so spacing is set with margin-bottom only). */
body, main, ul, ol, section, .topic, .entry, .box { display: flex; flex-direction: column; }
li { display: list-item; }
.hidden { display: none !important; }

main { width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 28px var(--page-gutter) 64px; }
.site-header + main { padding-bottom: calc(180px + env(safe-area-inset-bottom)); }
h1 { font-size: 36px; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.page-title h1 { min-width: 0; margin: 0; }
.title-app-icon { display: block; flex: none; width: clamp(48px, 7vw, 64px); height: auto; }
.app-store-link { flex: none; border-radius: 23%; }
.app-store-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
/* Section titles: grey and bold above a card, like the app's Settings. */
h2 { font-size: 21px; font-weight: 700; color: var(--muted); margin: 26px 0 8px 4px; }
h3 { font-size: 17px; font-weight: 700; margin: 0 0 4px; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 22px; }
li { margin: 0 0 6px; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
strong { font-weight: 700; }
.muted { color: var(--muted); font-size: 15px; }

/* Cards keep the app’s rounded outlines. */
.box, .card, .summary, .entry {
  background: var(--card); border: var(--outline-width) solid var(--outline); border-radius: 22px;
  padding: 16px 18px; margin: 0 0 18px;
}
.box > :last-child, .card > :last-child, .summary > :last-child, .entry > :last-child { margin-bottom: 0; }
.box > h3:not(:first-child) { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--fill); }
.card { display: block; }
.contact, .summary { display: block; }
/* A highlighted note inside a card. */
.box .card { border-width: 2px; border-radius: 16px; background: var(--callout); }

/* FAQ */
input[type=search] {
  width: 100%; font: inherit; padding: 12px 16px; border-radius: 16px; border: 3px solid var(--outline);
  background: var(--card); color: var(--text); margin: 4px 0 8px;
}
section.qa { scroll-margin-top: 16px; }
.box > section.qa + section.qa { margin-top: 10px; padding-top: 12px; border-top: 1px solid var(--fill); }
section.qa:target { background: var(--fill); border-radius: 12px; padding: 8px 12px; margin-left: -12px; margin-right: -12px; }
section.qa h3 a { color: inherit; text-decoration: none; }

/* What's new */
.release { margin-top: 20px; }
.release-heading { margin: 0; color: var(--text); font-size: 27px; }
.release-rule { width: 100%; margin: 6px 0 14px; border: 0; border-top: 1px solid var(--outline); }
.entry h3 { margin: 0 0 2px; font-size: 19px; }
.date { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.entry ul { margin: 6px 0 0; padding-left: 20px; }
.feature-emoji { margin-inline-end: 5px; }
.feature-date { display: block; margin-top: 2px; color: var(--muted); font-size: 0.8em; }
.tag {
  display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 9px; border-radius: 999px;
  background: var(--fill); border: 2px solid var(--outline); margin-left: 6px; vertical-align: middle;
}

/* Fold / expand (What's new, Report). Built by site.js; without JavaScript everything stays open. No animation. */
.fold-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  margin: 0; padding: 0; font: inherit; color: inherit; text-align: start; background: none; border: 0; cursor: pointer;
}
.fold-toggle::after {
  content: ''; flex: 0 0 7px; width: 7px; height: 7px; border-right: 2px solid; border-bottom: 2px solid;
  transform: translateY(-2px) rotate(225deg);
}
.fold-toggle[aria-expanded=false]::after { transform: translateY(-2px) rotate(45deg); }
.fold-toggle:focus-visible, .fold-more:focus-visible, .fold-titles button:focus-visible, .btn:focus-visible, .report-btn:focus-visible, .choice:focus-visible, .dialog-close:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.release.folded > :not(h2):not(.fold-titles) { display: none; }
.entry.folded li:not(:first-child) { display: none; }
.fold-more { align-self: flex-start; margin: 2px 0 0; padding: 4px 0; font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.entry:not(.folded) .fold-more { display: none; }
.fold-titles { margin: 4px 0 20px 4px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.fold-titles button { display: inline; padding: 0; font: inherit; color: inherit; background: none; border: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.entry, .release { scroll-margin-top: 12px; }
.release:not(.folded) > .fold-titles { display: none; }

/* Buttons and the Problem dialog */
.btn, .choice {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; font: inherit; font-size: 16px; font-weight: 700;
  color: var(--text); background: var(--fill); border: var(--outline-width) solid var(--outline); border-radius: 14px; cursor: pointer; text-decoration: none; text-align: center;
}
.btn:hover, .choice:hover { background: var(--callout); }
.btn.primary { background: var(--accent); color: var(--bg); }
.choice { justify-content: flex-start; text-align: start; width: 100%; }
.report-top .btn { width: 100%; margin-bottom: 10px; }
.problem-dialog {
  width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 0;
  color: var(--text); background: var(--card); border: var(--outline-width) solid var(--outline); border-radius: 22px;
}
.dialog-body { padding: 18px; }
.problem-dialog::backdrop { background: #0007; }
.problem-dialog h2 { margin: 0 0 10px; font-size: 21px; color: var(--text); }
.problem-dialog h2:focus { outline: none; }
.problem-dialog p { margin: 0 0 12px; font-size: 15px; }
.dialog-choices, .dialog-actions { display: grid; gap: 8px; margin: 0; padding: 0; }
.dialog-actions { margin-top: 12px; }
.dialog-close { margin-top: 12px; padding: 8px 0; font: inherit; font-size: 15px; color: var(--muted); background: none; border: 0; cursor: pointer; text-decoration: underline; }
.menu-problem {
  display: block; width: 100%; padding: 9px 10px; font: inherit; font-size: 14px; text-align: start;
  color: var(--text); background: none; border: 0; border-radius: 7px; cursor: pointer;
}
.menu-problem:hover { background: var(--fill); }
.menu-problem:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Report page list */
.group-count { margin-inline-start: 6px; font-size: 13px; font-weight: 700; color: var(--muted); }
.entry.report-group ul.report-list { margin: 6px 0 0; padding: 0; list-style: none; }
.report-item { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 10px 0; border-top: 1px solid var(--fill); }
.report-item:first-child { border-top: 0; padding-top: 4px; }
.item-text { font-size: 16px; }
.item-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.item-id { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.report-btn {
  min-height: 36px; padding: 4px 12px; font: inherit; font-size: 14px; font-weight: 700; color: var(--text);
  background: var(--fill); border: 2px solid var(--outline); border-radius: 10px; cursor: pointer;
}
.report-btn:hover { background: var(--callout); }

/* Privacy policy versions: a small list above the floating controls (built by site.js; without JavaScript every version shows in order). */
.version-list { margin: 0 0 4px; padding: 4px; background: var(--card); border: var(--outline-width) solid var(--outline); border-radius: 12px; }
.version-list ul { margin: 0; padding: 0; list-style: none; }
.version-list li { margin: 0; }
.version-list button {
  display: block; width: 100%; min-height: 36px; padding: 6px 10px; font: inherit; font-size: 14px; font-weight: 700; text-align: start;
  color: var(--text); background: none; border: 0; border-radius: 8px; cursor: pointer;
}
.version-list button:hover { background: var(--callout); }
.version-list button[aria-current=true] { background: var(--fill); box-shadow: inset 0 0 0 2px var(--outline); }
.version-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
body.has-versions .site-header + main { padding-bottom: calc(260px + env(safe-area-inset-bottom)); }
.policy { scroll-margin-top: 16px; }
.version-heading { color: var(--text); font-size: 27px; margin-left: 0; }

/* All page, language and appearance controls live together. */
.site-header {
  position: fixed; bottom: max(12px, env(safe-area-inset-bottom));
  /* Follow the text column until the window edge is the tighter constraint. */
  right: max(12px, env(safe-area-inset-right),
    calc((100% - var(--page-width)) / 2 + var(--page-gutter) - var(--controls-gap) - var(--controls-width)));
  z-index: 10; width: min(var(--controls-width), calc(100% - 24px));
}
.site-controls { display: grid; gap: 4px; }
.site-pages { position: relative; }
.site-control {
  width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 7px 12px; font: inherit; font-size: 14px; text-align: start;
  color: var(--text); background: var(--card); border: var(--outline-width) solid var(--outline);
  border-radius: 12px; cursor: pointer;
}
.site-control:hover { background: var(--callout); }
.site-control:disabled { cursor: wait; }
.site-control:focus-visible, .page-menu a:focus-visible, input[type=search]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.site-pages summary { list-style: none; }
.site-pages summary::-webkit-details-marker { display: none; }
.site-pages summary::after {
  content: ''; width: 6px; height: 6px; border-right: 1.5px solid; border-bottom: 1.5px solid;
  transform: translateY(-2px) rotate(45deg); flex: 0 0 6px;
}
.site-pages[open] summary::after { transform: translateY(2px) rotate(225deg); }
.pages-label, .control-label, .control-value { font-weight: 700; white-space: nowrap; }
.page-menu {
  position: absolute; bottom: calc(100% + 5px); right: 0; z-index: 2;
  width: min(226px, calc(100vw - 24px));
  border: var(--outline-width) solid var(--outline); border-radius: 12px; background: var(--card);
  padding: 5px; box-shadow: 0 6px 18px #0002; max-height: calc(100dvh - 172px); overflow-y: auto;
}
.page-menu ul { margin: 0; padding: 0; list-style: none; }
.page-menu li { margin: 0; }
.page-menu a {
  display: block; padding: 9px 10px; border-radius: 7px; color: var(--text);
  font-size: 14px; text-decoration: none;
}
.page-menu a:hover, .page-menu a[aria-current=page] { background: var(--fill); }
.menu-contact { border-top: 1px solid var(--fill); padding-top: 3px; }
.site-status { margin: 0; color: var(--muted); font-size: 13px; }

@media (max-width: 700px) {
  body { font-weight: 550; -webkit-font-smoothing: auto; }
}
