/* Flask architecture demo — sober, readable, no framework. */

:root {
  --bg: #f7f5f1;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #636c76;
  --border: #e3ded6;
  --accent: #2f4858;
  --accent-hover: #233745;
  --accent-contrast: #ffffff;
  --danger: #a3372d;
  --danger-hover: #862c24;
  --success-bg: #e7f3ec;
  --success-text: #1d5b3a;
  --error-bg: #fbeceb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.06), 0 1px 3px rgba(31, 35, 40, 0.04);
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --surface: #1d2126;
    --text: #e6e3de;
    --muted: #9aa3ad;
    --border: #2e343b;
    --accent: #8fb3c9;
    --accent-hover: #a9c6d8;
    --accent-contrast: #10161b;
    --danger: #e0786e;
    --danger-hover: #ea968e;
    --success-bg: #1b3326;
    --success-text: #9fd6b5;
    --error-bg: #3a2220;
    --shadow: none;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font-sans);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-hover);
}

h1,
h2 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin: 0 0 0.5rem;
}

.container {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 0 1rem;
}

main.container {
  flex: 1;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* Header & footer */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.site-header nav {
  display: flex;
  gap: 1.25rem;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--text);
}

.site-footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.875rem;
  padding: 1.25rem 0;
}

/* Content */

.hero {
  padding: 2rem 0;
}

.lead {
  color: var(--muted);
  font-size: 1.125rem;
  max-width: 40rem;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* Flash messages */

.flash {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  background: var(--success-bg);
  color: var(--success-text);
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent) 5%, transparent);
}

td.num {
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--muted);
}

/* Definition list (detail page) */

dl.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1.5rem;
}

dl.details dt {
  color: var(--muted);
}

dl.details dd {
  margin: 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Forms */

form.stack {
  display: grid;
  gap: 1.25rem;
  max-width: 32rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.field input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.field .hint {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.3rem 0 0;
}

.field .error {
  color: var(--danger);
  font-size: 0.875rem;
  margin: 0.3rem 0 0;
}

.field.has-error input {
  border-color: var(--danger);
  background: var(--error-bg);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* Buttons */

.button {
  display: inline-block;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  color: var(--accent-contrast);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
}

.button:hover {
  color: var(--accent-contrast);
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.button.secondary {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.button.secondary:hover {
  border-color: var(--muted);
}

.button.danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.button.danger:hover {
  background: var(--danger-hover);
  border-color: var(--danger-hover);
}

@media (max-width: 36rem) {
  h1 {
    font-size: 1.6rem;
  }

  .hide-sm {
    display: none;
  }
}
