/* Neutral minimal look, chosen by the owner 2026-10-20; replaces the grey indigo palette. Dark tokens appear twice: once for the system setting, once for the toggle. */
:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #666666;
  --line: #e8e8e8;
  --accent: #111111;
  --accent-fg: #ffffff;
  --danger: #c62828;
  --tint: #f7f7f7;
  --chip: #f7f7f7;
  --gutter: 16px;
  --measure: 680px;
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e0e;
    --fg: #eeeeee;
    --muted: #9a9a9a;
    --line: #262626;
    --accent: #eeeeee;
    --accent-fg: #0e0e0e;
    --danger: #ff6b6b;
    --tint: #171717;
    --chip: #171717;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e0e;
  --fg: #eeeeee;
  --muted: #9a9a9a;
  --line: #262626;
  --accent: #eeeeee;
  --accent-fg: #0e0e0e;
  --danger: #ff6b6b;
  --tint: #171717;
  --chip: #171717;
  color-scheme: dark;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 1.0625rem/1.6 var(--font);
}
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Motion is only added when the visitor has not asked for less. */
@media (prefers-reduced-motion: no-preference) {
  a, .button, .card, .card::after, .theme-toggle {
    transition: background-color .15s, border-color .15s, color .15s, opacity .15s, transform .2s;
  }
}

.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px;
  padding: 16px max(var(--gutter), calc(50% - var(--measure) / 2 + var(--gutter))) 8px;
  background: var(--bg);
}
.brand { color: var(--fg); font-weight: 700; letter-spacing: -.01em; text-decoration: none; padding: 10px 0; }
.brand[aria-current="page"] { text-decoration: underline; }
.header-tools { display: flex; align-items: center; gap: 4px; }
.site-header nav { display: flex; gap: 4px; }
.site-header nav a {
  color: var(--fg); text-decoration: none; padding: 10px 12px; border-radius: 999px;
  min-height: 44px; display: inline-flex; align-items: center;
}
.site-header nav a:hover { background: var(--chip); }
.site-header nav a[aria-current="page"] {
  font-weight: 600; text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 2px;
}
.theme-toggle {
  font: inherit; cursor: pointer; color: var(--fg); background: transparent;
  border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 44px; min-width: 44px; padding: 0 12px;
}
.theme-toggle:hover { background: var(--tint); }

main, .site-footer { max-width: var(--measure); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: 32px 0; }
.intro { padding: 72px 0 32px; }
.page { padding-top: 40px; }
h1 { font-size: clamp(2.2rem, 8vw, 3.2rem); line-height: 1.1; letter-spacing: -.03em; font-weight: 750; margin: 0 0 12px; }
.lead { font-size: 1.3rem; line-height: 1.5; color: var(--muted); max-width: 30ch; margin: 0; }
h2 { font-size: 1.5rem; margin: 0 0 16px; }
h3 { font-size: 1.1rem; margin: 24px 0 6px; }
section > h3:first-of-type { margin-top: 0; }
.page h1 { font-size: 2rem; letter-spacing: -.02em; margin: 0 0 16px; }
.page h2 { font-size: 1.05rem; margin: 32px 0 8px; }
.page > h1 + h2 { margin-top: 0; }

.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 32px; }
.hero > div { flex: 1 1 280px; }
.portrait { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; flex: none; }

.cards { list-style: none; margin: 56px 0 0; padding: 0; border-top: 1px solid var(--line); }
.card {
  display: flex; flex-direction: row; justify-content: space-between; align-items: baseline; gap: 16px;
  min-height: 44px; padding: 20px 4px; border-bottom: 1px solid var(--line);
  color: var(--fg); text-decoration: none;
}
.card strong { font-size: 1.15rem; }
.card span { color: var(--muted); font-size: 0.95rem; margin-left: auto; margin-right: 12px; }
.card::after { content: "\2192"; color: var(--muted); }
.card:hover strong, .card:focus-visible strong { text-decoration: underline; text-underline-offset: 4px; }
.card:hover::after, .card:focus-visible::after { transform: translateX(4px); color: var(--fg); }
.card:active { transform: translateY(1px); }

.project { padding: 24px 0; }
.project + .project { border-top: 1px solid var(--line); }
.project h2 { margin-top: 0; }
.project h3 { font-size: 1rem; margin: 16px 0 4px; }
.project p { margin: 0 0 8px; }
.tech { color: var(--muted); font-size: 0.95rem; }
.note { color: var(--muted); font-size: 0.95rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.button {
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 999px; padding: 10px 20px; min-height: 44px;
  display: inline-flex; align-items: center;
}
.button:hover { opacity: .85; }
.button:active { transform: translateY(1px); }
.text-link { padding: 10px 0; min-height: 44px; display: inline-flex; align-items: center; }
.external::after { content: " \2197"; }

.demo { margin-top: 16px; }
.demo iframe {
  display: block; width: 100%; height: 70vh; min-height: 420px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 0.95rem; }

.entry { margin: 0 0 20px; }
.entry p { margin: 0; }
.entry-title { font-weight: 600; }
.entry-meta { color: var(--muted); }
.facts { margin: 0 0 8px; padding-left: 20px; }

.site-footer { padding-top: 24px; padding-bottom: 88px; color: var(--muted); border-top: 1px solid var(--line); }
.site-footer p { margin: 0; }

#contact a, a[href^="mailto:"] { display: inline-flex; align-items: center; min-height: 44px; }

@media (max-width: 520px) {
  .card { flex-wrap: wrap; }
  .card span { order: 3; flex-basis: 100%; margin: 0; }
  .card::after { margin-left: auto; }
}

/* Chat widget (chat.js) and the owner's admin page (admin.html). */
.chat-fab {
  position: fixed; right: var(--gutter); bottom: var(--gutter); z-index: 20;
  font: inherit; font-weight: 600; cursor: pointer; min-height: 48px; padding: 0 22px;
  background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 999px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, .25);
}
.chat-fab:hover { opacity: .85; }
.chat-dot {
  position: absolute; top: 2px; right: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--bg);
}
.chat-panel {
  padding: 0;
  position: fixed; z-index: 21; right: var(--gutter); bottom: var(--gutter);
  width: min(380px, calc(100vw - 2 * var(--gutter))); max-height: min(560px, calc(100dvh - 2 * var(--gutter)));
  display: flex; flex-direction: column; background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
}
.chat-panel[hidden] { display: none; }
.chat-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 6px 6px 16px; border-bottom: 1px solid var(--line); }
.chat-close {
  font: inherit; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--fg); background: transparent;
  border: 0; border-radius: var(--radius); min-width: 44px; min-height: 44px;
}
.chat-close:hover { background: var(--tint); }
.chat-status { margin: 0; padding: 8px 16px; color: var(--muted); font-size: .9rem; background: var(--tint); }
.chat-log { flex: 1; min-height: 120px; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { margin: 0; padding: 8px 12px; border-radius: 14px; max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-mine { align-self: flex-end; background: var(--accent); color: var(--accent-fg); }
.chat-theirs { align-self: flex-start; background: var(--chip); border: 1px solid var(--line); }
.chat-form { padding: 8px 12px 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.chat-who { font-size: .9rem; color: var(--muted); }
.chat-who input { display: block; width: 100%; margin-bottom: 8px; }
.chat-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.chat-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-panel textarea, .chat-panel input, .admin textarea, .admin input {
  font: inherit; color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px;
}
.chat-panel textarea { flex: 1; min-width: 0; resize: none; }
.chat-error { margin: 0; color: var(--danger); font-size: .9rem; }
.chat-note { margin: 0; color: var(--muted); font-size: .8rem; }
@media (prefers-reduced-motion: no-preference) {
  .chat-fab, .chat-close { transition: opacity .15s, background-color .15s, transform .2s; }
  .chat-fab:active { transform: translateY(1px); }
}

.admin-main { max-width: 960px; }
.admin [hidden] { display: none; }
.admin h1 { font-size: 1.5rem; }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.admin-bar label { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.admin-bar input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.admin-delete { color: var(--danger); margin-left: 16px; }
.admin-reply-error { padding: 0 12px 8px; }
.admin-login { display: flex; flex-direction: column; gap: 12px; max-width: 320px; }
.admin-panes { display: grid; grid-template-columns: 280px 1fr; gap: 16px; }
.admin-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.admin-list li + li { border-top: 1px solid var(--line); }
.admin-list button {
  font: inherit; text-align: left; width: 100%; cursor: pointer; color: var(--fg); background: transparent; border: 0;
  padding: 10px 12px; min-height: 44px; display: block;
}
.admin-list button:hover, .admin-list button[aria-current="true"] { background: var(--tint); }
.admin-list .who { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.admin-list .preview { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.admin-badge { background: var(--accent); color: var(--accent-fg); border-radius: 999px; padding: 0 8px; font-size: .85rem; }
.admin-thread { padding: 0; border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 360px; max-height: 70vh; }
.admin-thread-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 12px; border-bottom: 1px solid var(--line); }
.admin-thread-head .back { display: none; }
.admin .chat-log { flex: 1; }
.admin-reply { display: flex; gap: 8px; align-items: flex-end; padding: 8px 12px 12px; border-top: 1px solid var(--line); }
.admin-reply textarea { flex: 1; min-width: 0; resize: vertical; }
.admin-quiet { font: inherit; cursor: pointer; color: var(--fg); background: transparent; border: 1px solid var(--line); border-radius: var(--radius); min-height: 44px; padding: 0 12px; }
.admin-quiet:hover { background: var(--tint); }
@media (max-width: 720px) {
  .admin-panes { grid-template-columns: 1fr; }
  .admin[data-view="list"] .admin-thread, .admin[data-view="thread"] .admin-list { display: none; }
  .admin-thread-head .back { display: inline-flex; align-items: center; }
  .admin[data-view="thread"] h1, .admin[data-view="thread"] .admin-bar, .admin[data-view="thread"] #online-hint { display: none; }
}
