/* What now? — warm "notebook paper" theme. See CLAUDE.md section 6. */

:root {
  --bg:          #FBF3E4;  /* cream paper */
  --surface:     #FFF9EF;  /* card background */
  --ink:         #3D2C2E;  /* dark brown text */
  --ink-soft:    #7A6563;  /* secondary text */
  --primary:     #C8553D;  /* terracotta */
  --primary-dk:  #A4412D;  /* hover */
  --accent:      #E0A458;  /* mustard */
  --olive:       #6B705C;  /* badges */
  --line:        #E6D5BC;  /* borders */

  --radius: 14px;
  --shadow: 3px 3px 0 var(--line);
  --font-heading: "Fraunces", Georgia, serif;
  --font-body: "Nunito", system-ui, sans-serif;
}

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

html {
  font-size: 17px;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: var(--font-body);
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
  background-image: url("../img/pattern.048625a9b685.svg");
  background-repeat: repeat;
  background-size: 200px 200px;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.25rem; }

p { margin: 0 0 1rem; }

a {
  color: var(--primary-dk);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

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

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .container { max-width: 720px; }
  h1 { font-size: 2rem; }
}

main.container {
  padding-top: 1.5rem;
  padding-bottom: 3rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.page-head h1 { margin: 0; }

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

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

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.brand span { color: var(--primary); }
.brand:hover { color: var(--ink); }

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  font-weight: 600;
}

.nav a { text-decoration: none; }
.nav a:hover { text-decoration: underline; }

.nav-user {
  color: var(--ink-soft);
}

.nav form { margin: 0; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  color: #fff;
  background: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.btn:hover {
  color: #fff;
  background: var(--primary-dk);
  border-color: var(--primary-dk);
  transform: translateY(-1px);
}

.btn-ghost {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line);
}

.btn-ghost:hover {
  color: var(--ink);
  background: var(--bg);
  border-color: var(--ink-soft);
}

.btn-small {
  padding: 0.35rem 0.8rem;
  font-size: 0.9rem;
}

.btn:disabled,
.btn:disabled:hover {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-block {
  display: block;
  width: 100%;
}

.link-button {
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--primary-dk);
  background: none;
  border: 0;
  cursor: pointer;
}

.link-button:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ---------- Cards ---------- */

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

.poll-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.poll-card {
  position: relative;
  transition: transform 0.12s ease;
}

.poll-card:hover { transform: translateY(-1px); }

.poll-card h2 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
}

/* Whole card is clickable through the title link. */
.poll-card h2 a {
  color: var(--ink);
  text-decoration: none;
}

.poll-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.6rem;
  margin: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.badge {
  display: inline-block;
  padding: 0.05rem 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--surface);
  background: var(--olive);
  border-radius: 999px;
}

.empty {
  text-align: center;
  padding: 2.5rem 1.25rem;
}

.empty p {
  font-family: var(--font-heading);
  font-size: 1.2rem;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 1.5rem;
  font-weight: 600;
}

.pager span { color: var(--ink-soft); }

/* ---------- Profile ---------- */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  margin: 0;
  text-align: center;
}

.stat-number {
  display: block;
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label { color: var(--ink-soft); }

/* Sits above the card-wide title link so it stays clickable. */
.card-action {
  position: relative;
  z-index: 1;
  margin-left: auto;
  font-weight: 600;
}

.delete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* ---------- Messages ---------- */

.messages {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
}

.messages li {
  padding: 0.6rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-left: 5px solid var(--olive);
  border-radius: 10px;
  font-weight: 600;
}

.messages li.error { border-left-color: var(--primary); }
.messages li.success { border-left-color: var(--accent); }

/* ---------- Forms ---------- */

.form-card {
  padding: 1.5rem 1.25rem;
}

.form-card p { margin-bottom: 1.1rem; }

label {
  display: block;
  margin-bottom: 0.3rem;
  font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 85, 61, 0.15);
}

input::placeholder { color: var(--ink-soft); opacity: 0.7; }

.helptext,
.form-card ul:not(.errorlist) {
  display: block;
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.form-card ul:not(.errorlist) { padding-left: 1.2rem; }

.errorlist {
  list-style: none;
  margin: 0 0 0.6rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--primary-dk);
  background: rgba(200, 85, 61, 0.08);
  border-radius: 10px;
}

fieldset {
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 0.4rem;
  padding: 0;
  font-weight: 700;
}

.option-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.6rem;
}

.option-row input { flex: 1; min-width: 0; }
.option-row .btn { flex-shrink: 0; }

.form-footer {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--ink-soft);
}

/* ---------- Poll detail ---------- */

.poll-question {
  font-size: 1.6rem;
  margin-bottom: 0.4rem;
}

.poll-head { margin-bottom: 1.25rem; }

.choice {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.6rem;
  padding: 0.75rem 1rem;
  font-weight: 600;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}

.choice:hover { border-color: var(--accent); }

.choice:has(input:checked) {
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--line);
}

.choice input {
  width: 1.1rem;
  height: 1.1rem;
  margin: 0;
  accent-color: var(--primary);
  flex-shrink: 0;
}

.note {
  margin: 0.9rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.results { list-style: none; margin: 0; padding: 0; }

.result { margin-bottom: 1.1rem; }

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.result-label { font-weight: 700; }

.result-numbers {
  flex-shrink: 0;
  font-size: 0.9rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.result-numbers strong { color: var(--ink); }

.tag {
  display: inline-block;
  margin-left: 0.3rem;
  padding: 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  vertical-align: middle;
  border-radius: 999px;
  color: var(--surface);
  background: var(--olive);
}

.tag-winner { background: var(--primary); }

.bar {
  height: 12px;
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.result.is-winner .bar-fill { background: var(--primary); }

.voters {
  margin: 0.3rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.back-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-weight: 600;
}
