/* jasondent.net: one stylesheet for the public page, /apps and /admin.
   Theme: light by default; dark when the OS asks for it, unless the visitor
   picked one with the header toggle (theme.js sets <html data-theme>). */

:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --bg-glow-1: rgba(99, 102, 241, 0.10);
  --bg-glow-2: rgba(20, 184, 166, 0.08);
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --header: rgba(247, 248, 251, 0.78);
  --text: #0f172a;
  --muted: #5b6475;
  --line: #e3e7ef;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: rgba(79, 70, 229, 0.10);
  --accent-text: #ffffff;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #0d9488 100%);
  --ok: #059669;
  --warn: #b45309;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.10);
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Inter", "Inter var", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0a0d14;
    --bg-glow-1: rgba(99, 102, 241, 0.16);
    --bg-glow-2: rgba(20, 184, 166, 0.10);
    --surface: #111622;
    --surface-2: #171d2b;
    --header: rgba(10, 13, 20, 0.72);
    --text: #e6e9f2;
    --muted: #97a0b3;
    --line: #232a3a;
    --accent: #818cf8;
    --accent-hover: #a5b4fc;
    --accent-soft: rgba(129, 140, 248, 0.14);
    --accent-text: #0b0f1a;
    --grad: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #2dd4bf 100%);
    --ok: #34d399;
    --warn: #fbbf24;
    --danger: #f87171;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.25);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0d14;
  --bg-glow-1: rgba(99, 102, 241, 0.16);
  --bg-glow-2: rgba(20, 184, 166, 0.10);
  --surface: #111622;
  --surface-2: #171d2b;
  --header: rgba(10, 13, 20, 0.72);
  --text: #e6e9f2;
  --muted: #97a0b3;
  --line: #232a3a;
  --accent: #818cf8;
  --accent-hover: #a5b4fc;
  --accent-soft: rgba(129, 140, 248, 0.14);
  --accent-text: #0b0f1a;
  --grad: linear-gradient(135deg, #818cf8 0%, #c084fc 50%, #2dd4bf 100%);
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.25);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.4), 0 12px 32px rgba(0, 0, 0, 0.35);
}

/* --- Base ------------------------------------------------------------------ */

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(60rem 40rem at 15% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(50rem 35rem at 100% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.2s, color 0.2s;
}

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 0 20px; }

main { padding-bottom: 48px; }

h1 { font-size: clamp(1.8rem, 1.2rem + 2.2vw, 2.6rem); line-height: 1.15; letter-spacing: -0.025em; margin: 8px 0 12px; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; margin: 40px 0 14px; }
h3 { font-size: 1.05rem; margin: 0 0 6px; }
p.lead { color: var(--muted); font-size: 1.15rem; margin-top: 0; max-width: 42rem; }
.meta { color: var(--muted); font-size: 14px; }

code, .mono { font-family: var(--mono); font-size: 0.9em; overflow-wrap: anywhere; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }

/* --- Header ---------------------------------------------------------------- */

header.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 0;
  margin-bottom: 28px;
  background: var(--header);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  /* Full-width bar while the content stays in .wrap. */
  box-shadow: 0 0 0 100vmax var(--header);
  clip-path: inset(0 -100vmax);
}

header.top .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}
header.top .brand::before {
  content: "JD";
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--grad);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

header.top nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
header.top nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background-color 0.15s, color 0.15s;
}
header.top nav a:hover { color: var(--text); background: var(--surface-2); }
header.top nav a.active { color: var(--text); background: var(--accent-soft); }
header.top nav .who { padding: 0 6px; overflow-wrap: anywhere; }

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
}
.theme-toggle:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.theme-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- Cards and layout ------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
section > .card + .card { margin-top: 16px; }
.card h2 { margin-top: 0; font-size: 1.1rem; }
.card .meta { margin: 0 0 12px; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); }
.grid > .card { transition: transform 0.15s, box-shadow 0.15s; }
.grid > .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.grid > .card h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 1.15rem; }

.step h2 { display: flex; align-items: center; gap: 10px; }
.step-mark {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
}
.step.done .step-mark { background: var(--ok); border-color: var(--ok); color: #fff; }
.step.done { border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }

/* --- Controls -------------------------------------------------------------- */

button, .button {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}
button:hover, .button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-text); }
button:active, .button:active { transform: translateY(1px); }

button.secondary, .button.secondary { background: transparent; color: var(--accent); border-color: var(--line); }
button.secondary:hover, .button.secondary:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-soft); }

button.danger { background: transparent; border-color: var(--line); color: var(--danger); }
button.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: var(--danger); color: var(--danger); }

button:disabled, button:disabled:hover { opacity: 0.5; cursor: default; transform: none; }

input, select {
  font: inherit;
  font-size: 14px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="checkbox"] { accent-color: var(--accent); width: 16px; height: 16px; }

form.inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.checks label {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
  font-size: 13px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
}

/* --- Status ---------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.running { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); border-color: transparent; }
.badge.running::before { animation: pulse 2s infinite; }
.badge.starting { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); border-color: transparent; }
.badge.stopped { color: var(--muted); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 60%, transparent); }
  70% { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.notice {
  display: block;
  padding: 14px 18px;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
}
.notice.error {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--text);
}

/* --- Tables ---------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; background: var(--surface-2); }
tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 60%, transparent); }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Public home page ------------------------------------------------------ */

.hero { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; padding: 40px 0 16px; }
.avatar {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  background: var(--grad);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow-hover);
}
.eyebrow { color: var(--accent); font-weight: 600; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; margin: 0; }
.gradient-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.links { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.link-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.link-card:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.link-card .icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.link-card .icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.link-card strong { display: block; font-size: 15px; }
.link-card span { color: var(--muted); font-size: 13px; }

/* --- Footer and helpers ---------------------------------------------------- */

footer {
  color: var(--muted);
  font-size: 14px;
  padding: 32px 0 40px;
  margin-top: 24px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hidden { display: none !important; }

@media (max-width: 560px) {
  .hero { grid-template-columns: 1fr; gap: 18px; padding-top: 24px; }
  .avatar { width: 84px; height: 84px; font-size: 30px; border-radius: 22px; }
  header.top nav .who { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
