/* Dark by default, one light theme; every color goes through a custom
   property. */

:root {
  color-scheme: dark;
  --font-body: "Source Serif 4", Georgia, "Times New Roman", Times, serif;
  --font-code: "JetBrains Mono", "Fira Code", "IBM Plex Mono", monospace;
  --font-size-base: 1.05rem;
  --bg: #14161a;
  --bg-raised: #1c1f25;
  --fg: #e6e6e6;
  --fg-dim: #8a8f98;
  --border: #2c313a;
  --accent: #f2f2f2;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5f2;
  --bg-raised: #ffffff;
  --fg: #1c1c1c;
  --fg-dim: #6b6b6b;
  --border: #ddd8d0;
  --accent: #1c1c1c;
}

/* ---- reset ---- */
* { box-sizing: border-box; }
h1, h2, h3, h4, h5, h6, p, ul, ol, figure { margin: 0; }
h1, h2, h3, h4, h5, h6 { font-weight: 600; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.7;
  overflow-x: hidden;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.5rem 2.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  line-height: 1.2;
}
.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  max-width: 80rem;
  margin: 0 auto;
}
.brand {
  font-weight: bold;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
  font-size: 1.3rem;
}
.site-header-right { display: flex; align-items: center; gap: 1.1rem; }

.icon-btn {
  background: none;
  border: none;
  color: var(--fg-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 0.2rem;
  line-height: 0;
  transition: color 0.15s ease;
}
.icon-btn:hover { color: var(--fg); }
.icon-btn svg { width: 20px; height: 20px; }

/* the toggle shows the theme it switches to */
.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.lang-switch { display: flex; align-items: center; gap: 0.3rem; font-size: 0.9rem; }
.lang-option {
  color: var(--fg-dim);
  text-decoration: none;
  padding: 0.1rem 0.15rem;
  transition: color 0.15s ease;
}
.lang-option:hover { color: var(--fg); }
.lang-option.active { color: var(--accent); font-weight: bold; }
.lang-sep { color: var(--border); }

@media (min-width: 881px) {
  .site-header { padding: 0.85rem 5.5rem; }
  .brand { font-size: 1.5rem; }
  .icon-btn svg { width: 23px; height: 23px; }
  .lang-switch { font-size: 1rem; }
}

/* ---- page ---- */
.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}
.page-header { text-align: center; line-height: 1.3; }
.page-header h1 { font-size: 2rem; margin-bottom: 0.4rem; }
.page-header .bio { color: var(--fg-dim); font-size: 1rem; }

.label {
  color: var(--fg-dim);
  font-family: var(--font-code);
  font-size: 0.75rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- link groups: code-fence boxes ---- */
.group {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.group-header {
  padding: 0.5rem 1rem;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}
.group-list {
  list-style: none;
  margin: 0;
  padding: 0.6rem 1rem 0.8rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
/* every row has the same gutter, holding either a "›" or a site icon */
.group-list li { position: relative; padding-left: 1.6rem; }
.group-list li::before {
  content: "\203a";
  position: absolute;
  left: 0.3rem;
  color: var(--accent);
  font-family: var(--font-code);
  font-weight: 700;
}
.group-list li.has-icon::before { content: none; }
.group-list .icon {
  position: absolute;
  left: 0;
  top: 0.4em;
  width: 1.05rem;
  height: 1.05rem;
  color: var(--fg-dim);
  transition: color 0.15s ease;
}
.group-list li:hover .icon { color: var(--fg); }
.group-list a {
  color: var(--fg);
  text-decoration: none;
  transition: color 0.15s ease;
}
.group-list a:hover { color: var(--accent); text-decoration: underline; }
.group-list .hint { color: var(--fg-dim); font-size: 0.9rem; margin-left: 0.4rem; }

/* ---- admin ---- */
.header-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--fg-dim);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
.header-link:hover { color: var(--fg); }
.site-header-right form { display: contents; }

.flash {
  margin-bottom: 1.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--bg-raised);
  font-size: 0.95rem;
}

/* same frame as a link group */
.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.panel-header {
  padding: 0.5rem 1rem;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}

.form { display: flex; flex-direction: column; gap: 1rem; padding: 1.25rem 1rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field label { color: var(--fg-dim); font-size: 0.9rem; }
.field input {
  font: inherit;
  color: var(--fg);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.field input:focus-visible { border-color: var(--accent); outline-offset: 0; }

.btn {
  align-self: flex-start;
  font: inherit;
  color: var(--fg);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 1.4rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.btn:hover { border-color: var(--accent); }

.admin .page { max-width: 42rem; }
.panel + .panel, .panel + .btn { margin-top: 1.5rem; }
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.panel-header .label { line-height: 1.6; }
.panel-footer { padding: 0.5rem 1rem; border-top: 1px solid var(--border); }

.actions { display: flex; align-items: center; gap: 0.9rem; flex-shrink: 0; }
.actions form { display: contents; }
.action {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.9rem;
  color: var(--fg-dim);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s ease;
}
.action:hover { color: var(--accent); }

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 1rem;
}
.details dt { color: var(--fg-dim); font-size: 0.9rem; }
.details dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 1rem;
}
.admin-list li + li { border-top: 1px solid var(--border); }
.admin-list-main { min-width: 0; overflow-wrap: anywhere; }
.admin-list .hint { display: block; color: var(--fg-dim); font-size: 0.85rem; }
.position { color: var(--fg-dim); font-family: var(--font-code); font-size: 0.75rem; margin-right: 0.3rem; }
.panel-header .position { margin-left: 0.4rem; }
.empty { padding: 0.75rem 1rem; color: var(--fg-dim); font-size: 0.9rem; }

.field textarea, .field select {
  font: inherit;
  color: var(--fg);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
}
.field textarea { resize: vertical; }
.field textarea:focus-visible, .field select:focus-visible { border-color: var(--accent); outline-offset: 0; }
.field small { color: var(--fg-dim); font-size: 0.8rem; }
.form-actions { display: flex; align-items: center; gap: 1.25rem; }
.form-actions .btn { align-self: auto; }
.error-list { margin: 0; padding-left: 1.1rem; }
.btn { display: inline-block; text-decoration: none; }

@media (max-width: 880px) {
  .site-header-right { gap: 0.8rem; }
  .site-header-right .header-link { font-size: 0.85rem; }
}

/* visually hidden, still read by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
