/* The site's base styles: colour tokens, type, controls, the top bar, lists and cards,
   and the sidebar layout the recipes page uses. Moved from the removed Pi interface's
   pi/pi.css, so pages look as they did. */

:root {
  --bg: #ffffff;
  --bg-2: #f7f7f8;
  --bg-3: #ececf1;
  --border: #e5e5e5;
  --border-2: #d4d4d4;
  --text: #0d0d0d;
  --text-2: #5d5d5d;
  --text-3: #8e8e8e;
  --bubble: #f4f4f4;
  --primary: #0d0d0d;
  --primary-text: #ffffff;
  --ok: #10a37f;
  --warn: #d97706;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --diff-add-bg: #eaf6ee;
  --diff-add-text: #1a6b3a;
  --diff-del-bg: #fbeceb;
  --diff-del-text: #a3302a;
  --shadow: 0 2px 12px rgba(0, 0, 0, .06), 0 0 0 1px rgba(0, 0, 0, .04);
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 46rem;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-2: #212121;
    --bg-3: #2f2f2f;
    --border: #2e2e2e;
    --border-2: #444444;
    --text: #ececec;
    --text-2: #b4b4b4;
    --text-3: #8a8a8a;
    --bubble: #2f2f2f;
    --primary: #ececec;
    --primary-text: #0d0d0d;
    --danger: #f87171;
    --danger-bg: #3a1f1f;
    --diff-add-bg: #16301f;
    --diff-add-text: #86d19f;
    --diff-del-bg: #3a1f1f;
    --diff-del-text: #f2a09a;
    --shadow: 0 2px 12px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 255, 255, .06);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.6 var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); }
h1, h2, h3 { font-weight: 600; line-height: 1.3; margin: 0; }
p { margin: 0; }
code, pre { font-family: var(--mono); font-size: 13px; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  margin: 8px 0 0;
  max-height: 50vh;
  overflow: auto;
  line-height: 1.5;
}
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
[hidden] { display: none !important; }

/* controls */
button, .button, input, select, textarea { font: inherit; color: inherit; }
button, .button {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.3;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button:hover, .button:hover { background: var(--bg-2); }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
button.primary:hover { opacity: .9; }
button.danger { color: var(--danger); }
button:disabled { opacity: .4; cursor: default; }
input, select, textarea {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--r-md);
  padding: 9px 12px;
  width: 100%;
  min-height: 40px;
}
select { width: auto; padding-right: 28px; }
label { display: block; color: var(--text-2); font-size: 14px; }
label > input, label > select, label > textarea { margin-top: 6px; }
label > select { display: block; }
.muted { color: var(--text-2); }
.small { font-size: 13px; }
.error { color: var(--danger); }
p.error { background: var(--danger-bg); border-radius: var(--r-md); padding: 10px 14px; margin: 8px 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* sign-in page */
body.auth { display: flex; flex-direction: column; }
.auth-card { width: 100%; max-width: 380px; margin: auto; padding: 24px; text-align: center; }
.auth-card .mark { font-size: 40px; line-height: 1; margin-bottom: 20px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card p { color: var(--text-2); margin-bottom: 24px; }

/* top bar, shared */
.bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.bar h1 { font-size: 17px; flex: 1; }
.bar nav { display: flex; gap: 14px; align-items: center; color: var(--text-2); font-size: 14px; }
.bar nav a { color: var(--text-2); text-decoration: none; }
.bar-title { flex: 1; min-width: 0; }
.back { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; text-decoration: none; color: var(--text); font-size: 22px; line-height: 1; }
.back:hover { background: var(--bg-2); }

/* a centred start screen (Spanish quizzes) */
.start { flex: 1; overflow-y: auto; display: flex; flex-direction: column; justify-content: center; padding: 24px 16px 18vh; }
.start > * { width: 100%; max-width: var(--measure); margin-inline: auto; }
.start h1 { font-size: 26px; font-weight: 500; text-align: center; margin-bottom: 24px; }

/* lists of cards (Spanish quizzes) */
.list { max-width: var(--measure); margin: 0 auto; padding: 12px 16px 48px; }
.list section { padding: 12px 0 20px; }
.list h2 { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 8px 0 8px 4px; }
.sessions { list-style: none; margin: 0; padding: 0; }
.sessions li + li { margin-top: 2px; }
.sessions form { margin: 0; }
.card { display: flex; flex-direction: column; gap: 3px; width: 100%; min-width: 0; padding: 12px; border: 0; border-radius: var(--r-md); background: none; align-items: stretch; justify-content: flex-start; text-align: left; text-decoration: none; color: var(--text); cursor: pointer; font-weight: normal; min-height: 0; }
.card:hover, .card:focus-visible { background: var(--bg-2); }
.row-title { font-weight: 500; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.row-summary { font-size: 14px; line-height: 1.4; color: var(--text-2); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.row-meta { font-size: 13px; color: var(--text-3); }
.empty { color: var(--text-3); padding: 8px 12px; }

/* sidebar layout (the recipes page): the sidebar, then the main column */
body.sidebar-layout { display: flex; height: 100dvh; }
.sidebar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar {
  width: 260px; flex: none;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px; padding-top: max(10px, env(safe-area-inset-top));
  background: var(--bg-2); border-right: 1px solid var(--border);
  overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 8px 8px; }
.sidebar-brand { font-weight: 600; font-size: 17px; text-decoration: none; }
.sidebar h2 { font-size: 13px; font-weight: 500; color: var(--text-3); margin: 18px 10px 4px; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 36px; padding: 7px 10px;
  border: 0; border-radius: var(--r-sm); background: none;
  justify-content: flex-start; text-align: left; text-decoration: none;
  color: var(--text); font-size: 14px; line-height: 1.35;
}
.side-item:hover, .side-item:focus-visible { background: var(--bg-3); }
.side-item.current { background: var(--bg-3); font-weight: 500; }
.side-item svg { flex: none; color: var(--text-2); }
.side-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.side-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.side-note { padding: 0 10px; }
.icon-button { width: 36px; height: 36px; min-height: 0; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--text-2); flex: none; }
.icon-button:hover { background: var(--bg-3); color: var(--text); }
.icon-button svg { display: block; }
.sidebar-backdrop { display: none; }
/* Wide screens: the sidebar sits beside the main column; the toggle hides it. */
@media (min-width: 900px) {
  .sidebar-top .icon-button { display: none; }
  body.sidebar-toggled .sidebar { display: none; }
}
/* Phones and narrow windows: the sidebar slides over the page; the toggle opens it. */
@media (max-width: 899px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1201; width: min(300px, 85vw); transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-toggled .sidebar { transform: none; box-shadow: 0 0 30px rgba(0, 0, 0, .2); }
  body.sidebar-toggled .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 1200; background: rgba(0, 0, 0, .3); }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

form.submitting { opacity: .6; pointer-events: none; }

@media (min-width: 700px) {
  .bar { padding-inline: 20px; }
}

/* iOS Safari zooms into any focused form control under 16px. */
@media (pointer: coarse) { input, select, textarea { font-size: 16px; } }
