/* ============================================
   Personweb — Dev Aesthetic
   No polish, no AI, just a site a nerd built
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700;800&display=swap");

:root {
  --bg: #111111;
  --bg-lighter: #1a1a1a;
  --bg-card: #1e1e1e;
  --fg: #d4d0cb;
  --fg-dim: #8a8580;
  --fg-bright: #f0ece8;
  --accent: #c4653a;
  --accent-bright: #d4845a;
  --accent-dim: #8a4a2a;
  --border: #333333;
  --border-light: #444444;
  --olive: #6b7f4e;
  --olive-dim: #4a5a3a;
  --rust: #b85c38;
  --terminal-green: #50fa7b;
  --terminal-yellow: #f1fa8c;
  --terminal-red: #ff5555;
  --terminal-blue: #8be9fd;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  --serif: "Playfair Display", Georgia, serif;
}

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

html { scroll-behavior: auto; }

body {
  font-family: var(--mono);
  background-color: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  -webkit-font-smoothing: none;
}

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-light); }
::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }

/* === Selection === */
::selection { background: var(--accent-dim); color: var(--fg-bright); }

/* === Typography === */
.font-serif { font-family: var(--serif); }
.font-mono { font-family: var(--mono); }

/* === Links === */
a { color: var(--accent-bright); text-decoration: none; }
a:hover { color: var(--terminal-green); }

/* === Layout === */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* === Navbar === */
#navbar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-lighter);
  position: sticky;
  top: 0;
  z-index: 100;
}
#navbar nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3rem;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.navbar-brand .logo-mark {
  width: 1.5rem;
  height: 1.5rem;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 0.8rem;
  border: 1px solid var(--accent-dim);
}
.navbar-brand .logo-text {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--fg-bright);
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.navbar-links a {
  color: var(--fg-dim);
  font-size: 0.85rem;
  font-weight: 400;
}
.navbar-links a:hover { color: var(--accent-bright); }

/* === Footer === */
#footer {
  border-top: 1px solid var(--border);
  margin-top: auto;
  background: var(--bg-lighter);
}
#footer .footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--fg-dim);
}
@media (min-width: 768px) {
  #footer .footer-inner { flex-direction: row; }
}
.footer-links { display: flex; gap: 1rem; }
.footer-links a { color: var(--fg-dim); font-size: 0.75rem; }
.footer-links a:hover { color: var(--accent-bright); }

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.2rem;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--border);
  font-family: var(--mono);
  text-decoration: none;
  line-height: 1.4;
  background: transparent;
  color: var(--fg);
}
.btn:hover { border-color: var(--accent); color: var(--accent-bright); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn-secondary {
  background: transparent;
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--accent-bright); color: var(--accent-bright); }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.btn-w-full { width: 100%; }

/* === Form Elements === */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.5rem;
}
.label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-dim);
  margin-bottom: 0.4rem;
  font-family: var(--mono);
}
.input {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-family: var(--mono);
  background: var(--bg);
  color: var(--fg-bright);
  transition: border-color 0.15s;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
}
.input::placeholder { color: var(--fg-dim); opacity: 0.5; }

/* === Alerts === */
.alert-error {
  background: rgba(255, 85, 85, 0.1);
  border: 1px solid rgba(255, 85, 85, 0.3);
  color: var(--terminal-red);
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}
.alert-success {
  background: rgba(80, 250, 123, 0.1);
  border: 1px solid rgba(80, 250, 123, 0.3);
  color: var(--terminal-green);
  padding: 0.6rem 0.8rem;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}
.hidden { display: none !important; }

/* === Cards === */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem;
}
.card h3 { font-family: var(--serif); font-size: 1rem; margin-bottom: 0.3rem; color: var(--fg-bright); }

/* === Hero === */
.hero {
  padding: 3rem 0;
  text-align: center;
}
.hero h1 {
  font-family: var(--serif);
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--fg-bright);
}
.hero .lead {
  font-size: 0.95rem;
  max-width: 450px;
  margin: 0 auto 1.5rem;
  color: var(--fg-dim);
}
.hero .flex { justify-content: center; }

/* === Error Page === */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 2rem;
}
.error-page h1 { line-height: 1; margin-bottom: 1rem; font-family: var(--serif); color: var(--accent); }
.error-page h2 { margin-bottom: 0.8rem; font-family: var(--serif); }
.error-page p { max-width: 400px; margin-bottom: 1.5rem; color: var(--fg-dim); }

/* === Permission Row === */
.permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.permission-info h3 { font-family: var(--serif); font-size: 0.95rem; color: var(--fg-bright); }
.permission-info p { font-size: 0.75rem; color: var(--fg-dim); }
.permission-btns { display: flex; gap: 0.4rem; }

/* === Admin Table === */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.admin-table th, .admin-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.admin-table th {
  font-weight: 600;
  color: var(--fg-dim);
  font-size: 0.7rem;
  text-transform: uppercase;
}
.admin-table tr:hover td { background: rgba(196, 101, 58, 0.05); }
.matrix-cell { display: flex; gap: 0.2rem; justify-content: center; }
.matrix-btn {
  padding: 0.2rem 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  font-family: var(--mono);
}
.matrix-btn.view { color: var(--olive); border-color: var(--olive-dim); }
.matrix-btn.view:hover, .matrix-btn.view.active { background: var(--olive); color: var(--bg); }
.matrix-btn.edit { color: var(--accent-bright); border-color: var(--accent-dim); }
.matrix-btn.edit:hover, .matrix-btn.edit.active { background: var(--accent); color: #fff; }

/* === Add User Form === */
.add-user-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1rem;
  margin-bottom: 1.5rem;
}
.add-user-form h3 { font-family: var(--serif); font-size: 1rem; margin-bottom: 0.8rem; }
.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.form-row .input { flex: 1; }

/* === Sections === */
.sections { padding: 2rem 0; }

/* === Prose === */
.prose p { margin-bottom: 1rem; }
.prose h2 { margin-top: 1.5rem; margin-bottom: 0.5rem; font-family: var(--serif); }

/* === Content Grid === */
.content-grid { display: flex; flex-direction: column; gap: 0.5rem; }

/* === Responsive === */
@media (max-width: 768px) {
  .hero h1 { font-size: 1.75rem; }
  .permission-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .navbar-links { gap: 0.5rem; }
  .admin-table { font-size: 0.7rem; }
  .admin-table th, .admin-table td { padding: 0.4rem 0.4rem; }
  .form-row { flex-direction: column; }
}

/* === Utilities === */
.mt-4 { margin-top: 0.75rem; }
.mb-8 { margin-bottom: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-4 { gap: 0.75rem; }
.gap-2 { gap: 0.4rem; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.max-w-md { max-width: 26rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.py-16 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.py-20 { padding-top: 3rem; padding-bottom: 3rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.8rem; }
.text-xs { font-size: 0.7rem; }
.font-bold { font-weight: 700; }
.leading-relaxed { line-height: 1.6; }
.text-ink { color: var(--fg-bright); }
.text-muted { color: var(--fg-dim); }
.text-accent { color: var(--accent-bright); }
.text-olive { color: var(--olive); }
.text-rust { color: var(--rust); }

/* === Divider === */
.divider { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }

/* === Loading === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 15vh;
  color: var(--fg-dim);
}
.loading::after {
  content: "";
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  margin-left: 0.5rem;
}

/* === Password Strength === */
.password-strength {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 0.3rem;
  overflow: hidden;
}
.password-strength-bar {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  transition: width 0.3s, background 0.3s;
}
.password-strength-bar.weak { width: 33%; background: var(--terminal-red); }
.password-strength-bar.medium { width: 66%; background: var(--terminal-yellow); }
.password-strength-bar.strong { width: 100%; background: var(--terminal-green); }
.password-strength-text {
  font-size: 0.7rem;
  color: var(--fg-dim);
  margin-top: 0.2rem;
}
.form-field + .form-field { margin-top: 0.8rem; }
