:root {
  --app-font-sans: "Source Sans 3 Variable", "Helvetica Neue", Arial, sans-serif;
  --app-font-serif: "Source Serif 4 Variable", Georgia, serif;
  --app-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --ink: #141413;
  --ink-hover: #3d3d3a;
  --canvas: #faf9f5;
  --surface: #f0eee6;
  --surface-hover: #e8e6dc;
  --line: #e8e6dc;
  --muted: #5e5d59;
  --faint: #87867f;
  --clay: #d97757;
  --clay-strong: #c6613f;
  --radius: 3px;
}

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

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--app-font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
}

main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main > * {
  flex-shrink: 0;
}

main > .site-footer {
  margin-top: auto;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-top {
  position: relative;
  z-index: 2;
  background: #141413;
  box-shadow: 0 2px 10px rgba(20, 20, 19, 0.3);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-grow: 1;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-icon {
  width: 30px;
  height: 30px;
  display: block;
  filter: invert(88%) sepia(22%) saturate(1500%) hue-rotate(338deg) brightness(95%);
}

.brand-name {
  font-family: var(--app-font-serif);
  font-weight: 600;
  font-size: 20px;
  color: #faf9f5;
}

.brand:hover .brand-name {
  color: #d97757;
}

.nav-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  font-size: 14px;
  color: #87867f;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 2px;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

.nav-link:hover {
  background: #2a2a28;
  color: #faf9f5;
}

.nav-link.active {
  font-size: 14px;
  color: #d97757;
  background: rgba(217, 119, 87, 0.12);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 2px;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

.nav-link.active:hover {
  background: rgba(217, 119, 87, 0.2);
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 14px;
}

.user-menu[open] .user-button,
.user-button:hover {
  background: #2a2a28;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #5e5d59;
  color: #faf9f5;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  color: #d1cfc5;
  white-space: nowrap;
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #faf9f5;
  border: 1px solid #e8e6dc;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(20, 20, 19, 0.14);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
  z-index: 3;
}

.user-email {
  font-size: 12px;
  color: #87867f;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-signout {
  font-size: 14px;
  color: #141413;
  text-decoration: none;
}

.user-signout:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.admin-bar {
  position: relative;
  z-index: 1;
  background: #e3dacc;
  border-bottom: 1px solid rgba(20, 20, 19, 0.06);
  box-shadow: 0 2px 6px rgba(20, 20, 19, 0.12);
}

.admin-inner {
  height: 38px;
  justify-content: flex-start;
  gap: 4px;
}

.admin-link {
  font-size: 13px;
  color: #5e5d59;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 2px;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

.admin-link:hover {
  background: #d1cfc5;
  color: #141413;
}

.admin-link.active {
  font-size: 13px;
  color: #c6613f;
  background: rgba(217, 119, 87, 0.16);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 2px;
  white-space: nowrap;
  text-box: trim-both cap alphabetic;
}

.admin-link.active:hover {
  background: rgba(217, 119, 87, 0.24);
  color: #8a4129;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid color-mix(in srgb, currentColor 15%, transparent);
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-text {
  color: inherit;
  opacity: 0.65;
  font-size: 14px;
  margin: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-link {
  color: inherit;
  opacity: 0.65;
  font-size: 14px;
  text-decoration: none;
  transition: opacity 100ms ease;
}

.footer-link:hover {
  opacity: 1;
}

/* ---------- Shared primitives ---------- */

.btn {
  display: inline-block;
  padding: 16px 22px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--ink);
  color: var(--canvas);
  font-family: var(--app-font-sans);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background 100ms ease;
  text-box: trim-both cap alphabetic;
}

.btn:hover {
  background: var(--ink-hover);
}

.btn-md {
  padding: 13px 18px;
  font-size: 14px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--muted);
}

.btn-outline:hover {
  background: var(--surface);
}

.btn-clay {
  background: var(--clay);
  color: var(--ink);
  font-weight: 600;
}

.btn-clay:hover {
  background: #e3967a;
}

.btn-lg {
  padding: 18px 26px;
  font-size: 16px;
}

.btn-paper {
  background: var(--canvas);
  color: var(--ink);
  font-weight: 600;
}

.btn-paper:hover {
  background: #e8e6dc;
}

.eyebrow {
  display: block;
  font-family: var(--app-font-mono);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 16px;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

.container-narrow {
  max-width: 720px;
  margin: 0 auto;
}

.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  color: #3d3d3a;
}

.checklist li {
  position: relative;
  padding: 5px 0 5px 32px;
  font-size: 16px;
  line-height: 1.6;
}

.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 7px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #f3d7cc;
  color: #8a4129;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu {
  display: none;
}

@media (max-width: 700px) {
  .user-name {
    display: none;
  }
}

@media (max-width: 560px) {
  .header-inner {
    padding: 0 12px;
    gap: 12px;
  }

  .header-left {
    gap: 12px;
  }

  .brand-name {
    display: inline;
  }

  .nav-group {
    display: none;
  }

  .admin-bar {
    display: none;
  }

  .mobile-menu {
    display: block;
    position: relative;
  }

  .mobile-menu-btn {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 3px;
    background: #2a2a28;
  }

  .mobile-menu-btn::-webkit-details-marker {
    display: none;
  }

  .mobile-menu-icon,
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    display: block;
    width: 18px;
    height: 2px;
    background: #faf9f5;
    border-radius: 1px;
    transition: transform 0.15s ease;
  }

  .mobile-menu-icon {
    position: relative;
  }

  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
  }

  .mobile-menu-icon::before {
    top: -6px;
  }

  .mobile-menu-icon::after {
    top: 6px;
  }

  .mobile-menu[open] .mobile-menu-icon {
    background: transparent;
  }

  .mobile-menu[open] .mobile-menu-icon::before {
    transform: translateY(6px) rotate(45deg);
  }

  .mobile-menu[open] .mobile-menu-icon::after {
    transform: translateY(-6px) rotate(-45deg);
  }

  .mobile-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: #141413;
    border: 1px solid #2a2a28;
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    padding: 8px 0;
    min-width: 200px;
    z-index: 200;
  }

  .mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 0;
  }

  .mobile-nav-admin {
    border-top: 1px solid #2a2a28;
    margin-top: 4px;
    padding-top: 4px;
  }

  .mobile-nav-heading {
    display: block;
    padding: 8px 16px 4px;
    font-family: var(--app-font-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #d97757;
  }

  .mobile-nav-link {
    display: block;
    padding: 10px 16px;
    font-size: 14px;
    color: #b0aea5;
    text-decoration: none;
    white-space: nowrap;
  }

  .mobile-nav-link:hover {
    background: #2a2a28;
    color: #faf9f5;
  }

  .mobile-nav-link.active {
    color: #d97757;
  }

  .mobile-user-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px 6px;
  }

  .mobile-user-name {
    font-size: 13px;
    color: #d1cfc5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
