.authOptions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}


/* ---------------------------
   1) CSS Reset + Base Tokens
   --------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html:focus-within { scroll-behavior: smooth; }
html {
  background: var(--bg);
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root {
  /* Surfaces & text */
  --bg: #0b1220;         /* page background */
  --surface: #0f172a;
  --surface-2: #111827;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --border: #1f2937;

  /* Brand & accents */
  --brand: #60a5fa;
  --brand-700: #3b82f6;
  --link: var(--brand);

  /* Semantic */
  --success: #22c55e;
  --danger:  #f87171;
  --warn:    #f59e0b;

  /* Voting accents */
  --upvote:   #22c55e;
  --downvote: #f87171;

  /* Misc */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.40);
  --shadow-md: 0 6px 18px rgba(0,0,0,.55);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.65);
  --focus-ring: 0 0 0 3px rgba(96,165,250,.55);
}

img, svg, video, canvas { display:block; max-width:100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: 8px;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ---------------------------
   2) Layout
   --------------------------- */
.container {
  width: min(100% - 2rem, 1100px);
  margin-inline: auto;
}

main { padding: 1.25rem 0 3rem; }
.section {
  margin-block: 1.25rem 2rem;
}

/* ---------------------------
   3) Header / Top Nav
   --------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.015), var(--shadow-sm);
}
.site-header .bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 0;
  gap: .75rem;
}
.brand {
  font-weight: 800; letter-spacing: .3px;
  color: var(--text);
}
.brand a { text-decoration: none; color: inherit; }
.nav, .user-controls { display:flex; gap:.5rem; align-items:center; }

.nav a, .user-controls a, .user-controls button {
  display:inline-flex; align-items:center; gap:.5rem;
  padding: .5rem .75rem;
  border-radius: 8px;
  color: var(--text);
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }

/* ---------------------------
   4) Flash Messages
   --------------------------- */
.flash {
  border: 1px solid var(--border);
  background: var(--surface);
  padding: .75rem 1rem;
  border-left: 5px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  margin-bottom: 1rem;
}
.flash--success { border-left-color: var(--success); }
.flash--danger  { border-left-color: var(--danger); }
.flash--warn    { border-left-color: var(--warn); }

/* ---------------------------
   5) Buttons
   --------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem .9rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .06s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn:disabled { opacity: .55; pointer-events: none; }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand-700);
  color: #fff;
}
.btn-primary:hover { background: var(--brand-700); }

.btn-warning {
  background: #fff7ed; border-color: #fed7aa; color: #9a3412;
}

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
}

/* ---------------------------
   6) Forms
   --------------------------- */
.form {
  display: grid; gap: .85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.form-row { display: grid; gap: .35rem; }
label { font-weight: 600; color: var(--text); }
input[type="text"],
input[type="password"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: #0f172a;
}
textarea { min-height: 120px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #94a3b8; }
.help { color: var(--muted); font-size: .9rem; }

/* Dev/Prod banner on login (optional) */
.dev-badge {
  display:inline-block; font-size:.75rem; font-weight:700; letter-spacing:.5px;
  padding:.25rem .5rem; border-radius:6px; background:#ecfeff; color:#155e75; border:1px solid #a5f3fc;
}

/* ---------------------------
   7) Auth pages
   --------------------------- */
.auth {
  min-height: calc(100vh - 64px);
  display: grid; place-items: center;
  padding: 2rem 1rem;
}
.auth-card {
  width: min(100%, 460px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 1.25rem;
}
.auth-card h1 { margin: .25rem 0 1rem; font-size: 1.4rem; }
.authOptions {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  flex-wrap: wrap;
}
.authOptions .btn { flex: 1 1 160px; }

/* ---------------------------
   8) Post Lists (home & sub pages)
   --------------------------- */
.post-list {
  display: grid;
  gap: .85rem;
}
.post-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .8rem;
}
@media (max-width: 640px) {
  .post-card { grid-template-columns: 1fr; }
}

.post-body { display: grid; gap: .4rem; align-content: start; }
.post-title a {
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.post-title a:hover { text-decoration: underline; }

.post-meta, .post-actions {
  display:flex; flex-wrap:wrap; gap:.5rem .8rem; align-items:center;
  color: var(--muted); font-size: .92rem;
}
.post-actions a { text-decoration: none; }
.post-actions a:hover { text-decoration: underline; }

.sub-pill {
  display:inline-flex; align-items:center; padding:.2rem .5rem;
  background: var(--surface-2); border:1px solid var(--border);
  border-radius: 999px; color: var(--muted); font-weight:600; font-size:.85rem;
}

/* ---------------------------
   9) Voting (home, sub, and post detail)
   Visible active state is REQUIRED by spec.
   --------------------------- */
.vote-controls {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
}
.vote-controls--vertical { flex-direction: column; min-width: 42px; }

.vote-btn {
  --size: 36px;
  width: var(--size); height: var(--size);
  display: inline-grid; place-items: center;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, transform .06s ease;
  line-height: 1; user-select: none;
}
.vote-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.vote-btn:active { transform: translateY(0); }

.vote-btn--up   { color: var(--upvote);   border-color: color-mix(in oklab, var(--upvote) 35%, var(--border)); }
.vote-btn--down { color: var(--downvote); border-color: color-mix(in oklab, var(--downvote) 35%, var(--border)); }

/* ACTIVE states (two options supported):
   1) Add .is-active to the button
   2) Or set aria-pressed="true" on the button
*/
.vote-btn--up.is-active,
.vote-btn--up[aria-pressed="true"] {
  background: var(--upvote);
  color: #fff;
  border-color: var(--upvote);
}
.vote-btn--down.is-active,
.vote-btn--down[aria-pressed="true"] {
  background: var(--downvote);
  color: #fff;
  border-color: var(--downvote);
}

/* Disabled when user not logged in: add aria-disabled="true" on container */
.vote-controls[aria-disabled="true"] .vote-btn {
  opacity: .45;
  pointer-events: none;
  filter: grayscale(.25);
}

.vote-score {
  min-width: 2.2ch;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}

/* ---------------------------
   10) Subgroup Listing
   --------------------------- */
.sub-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.sub-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .8rem .9rem;
  display: grid; gap: .35rem;
}
.sub-card a { font-weight:700; color: var(--text); text-decoration:none; }
.sub-card a:hover { text-decoration: underline; }
.sub-card .count { color: var(--muted); font-size:.9rem; }

/* ---------------------------
   11) Post Detail + Comments
   --------------------------- */
.post-detail {
  display: grid; gap: 1rem;
}
.post-head {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: grid; gap:.4rem;
}
.post-head h1 { margin:0; font-size: 1.5rem; }
.post-head .meta { color: var(--muted); }

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

.comments {
  display: grid; gap: .85rem;
}
.comment {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: .8rem .9rem;
  display: grid; gap: .35rem;
}
.comment .meta {
  color: var(--muted);
  font-size: .9rem;
  display: flex; gap:.5rem; flex-wrap:wrap; align-items:center;
}
.comment .actions { display:flex; gap:.5rem; }
.comment .actions a { color: var(--muted); }
.comment .actions a:hover { color: var(--text); }

/* Comment form (shown only when logged in) */
.comment-form { margin-top: .25rem; }

/* ---------------------------
   12) Create/Edit/Delete Forms
   --------------------------- */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
}
.form-footer {
  display:flex; gap:.5rem; flex-wrap:wrap; justify-content:flex-end; margin-top:.25rem;
}
.danger-zone {
  border: 1px dashed color-mix(in oklab, var(--danger) 40%, var(--border));
  background: color-mix(in oklab, var(--danger) 6%, var(--surface));
  padding: .9rem; border-radius: var(--radius);
}
.confirm-text { color: var(--muted); }

/* ---------------------------
   13) Pagination (optional)
   --------------------------- */
.pager {
  display:flex; align-items:center; justify-content:center; gap:.5rem; margin-top:1rem;
}
.pager .btn { min-width: 2.25rem; }

/* ---------------------------
   14) Utilities
   --------------------------- */
.stack-xs > * + * { margin-top: .25rem; }
.stack-sm > * + * { margin-top: .5rem; }
.stack-md > * + * { margin-top: .75rem; }
.stack-lg > * + * { margin-top: 1rem; }

.cluster { display:flex; gap:.5rem; align-items:center; flex-wrap:wrap; }
.center { text-align:center; }
.right { text-align:right; }
.muted { color: var(--muted); }
.badge {
  display:inline-flex; align-items:center; gap:.3rem;
  padding:.15rem .5rem; border-radius:999px; background: var(--surface-2); color: var(--muted);
  border:1px solid var(--border); font-size:.8rem; font-weight:600;
}

/* Screen reader only */
.sr-only {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0;
}

/* ---------------------------
   15) Code/Pre (optional)
   --------------------------- */
code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: .95em;
}
pre {
  overflow: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
}

.creator-badge{
  display:inline-flex; align-items:center; gap:.35rem;
  font-size: larger;
  font-weight:700;
  color: var(--brand, #0ea5e9);
  text-transform: capitalize;
}

.individualPost {
  background-color: var(--surface);
  padding-top: 10px;
  padding-bottom: 10px;
  padding-left: 20px;
  padding-right: 20px;
  margin: 5px;
}

.individualPost p, .margin-bottom {
  margin-bottom: 0px;
}

/* h1 has max width of 500px */
h1, h2 {
  max-width: 500px;
  text-transform: capitalize;
}

.span-full-width {
  flex-basis: 100%;   /* Forces this flex item onto its own new row */
  margin-bottom: 0px;
}

/* create a navigation bar for posts and subgroups */
nav li {
  display: flex;
  gap: 15px;
}

nav a {
  color: whitesmoke;
  font-size: larger;
  font-weight: 600;
}

.subgroup-list a {
  text-transform: capitalize;
  font-weight: 600;
}

/* For the last div tag in main tag */
main > div:last-child {
  margin-top: 10px;
  margin-left: 15px;
}

.submit-button {
  /* define the size of the submit button */
  padding: 5px;
  height: 50px;
  /* put it in the center */
  margin: 10px auto;
}
