/* ==========================================================================
   DCFFL Design System
   District & Commonwealth Fantasy Football League
   "Official league document" aesthetic — cream paper, oxblood maroon,
   gold rule lines, small-caps serif headers, double-ruled borders.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

html,
body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, dl, dd,
figure, blockquote {
  margin: 0;
  padding: 0;
}

ul, ol {
  list-style: none;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* --------------------------------------------------------------------------
   Color tokens
   -------------------------------------------------------------------------- */

:root {
  --cream:        #F6F1E1;  /* page background */
  --cream-card:   #FBF8EE;  /* card / frame background, slightly lighter */
  --maroon:       #7A1930;  /* primary brand color: headers, rules, links */
  --maroon-dark:  #4E0F1F;  /* hover states, deep borders */
  --gold:         #B9922E;  /* accent rule lines, eyebrows, focus rings */
  --gold-light:   #E9D9A8;  /* subtle fills, badges */
  --ink:          #2B2420;  /* body text */
  --ink-soft:     #6E6255;  /* muted text, datelines, captions */
  --hairline:     #D8CDB0;  /* thin borders/dividers */
  --success:      #2E6B44;  /* vote confirmation, open status */
  --danger:       #8C2C1F;  /* errors, closed status */
  --silver:       #8E8C82;  /* trophy case: runner-up */
  --bronze:       #A2703C;  /* trophy case: third place */
  --shadow: 0 10px 30px rgba(74, 30, 20, 0.12);

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Source Serif 4", Georgia, serif;
}

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

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Meta / labels: nav links, dateline eyebrows, buttons */
.eyebrow,
.site-nav a,
.btn,
.dateline-label {
  font-family: var(--font-body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

.site-header__inner,
.page-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
}

.doc-frame,
article.doc-frame,
.page-content > .doc-frame {
  max-width: 760px;
  margin-left: auto;
  margin-right: auto;
}

/* Tabular content (Trophy Case) reads better with more width than prose
   articles get — cap at the page-shell width instead of the 760px prose
   measure. .trophy-table-wrap's overflow-x:auto is still the real safety
   net for narrow viewports. */
.doc-frame.doc-frame--wide {
  max-width: 960px;
}

/* --------------------------------------------------------------------------
   Site header
   -------------------------------------------------------------------------- */

.site-header {
  background: var(--cream-card);
  border-bottom: 3px double var(--maroon);
  padding: 18px 0;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
  min-width: 0;
}

.brand__seal {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--gold);
  object-fit: cover;
  flex-shrink: 0;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--maroon);
  text-transform: uppercase;
}

.brand__tag {
  font-family: var(--font-body);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* --------------------------------------------------------------------------
   Site nav
   -------------------------------------------------------------------------- */

.site-nav {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.site-nav a {
  position: relative;
  font-size: 13px;
  color: var(--ink);
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--maroon);
  border-bottom-color: var(--gold);
}

.site-nav a.active {
  color: var(--maroon);
  border-bottom-color: var(--gold);
}

/* --------------------------------------------------------------------------
   Identity widget
   -------------------------------------------------------------------------- */

.identity-widget {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 160px;
  position: relative;
}

.identity-widget .btn {
  padding: 10px 16px;
}

.identity-widget__name {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--maroon);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-widget__switch {
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--hairline);
}

.identity-widget__switch:hover {
  color: var(--maroon);
  border-bottom-color: var(--gold);
}

.identity-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  background: var(--cream-card);
  border: 1px solid var(--gold);
  box-shadow: var(--shadow);
  padding: 20px;
  width: 280px;
}

.identity-popover[hidden] {
  display: none;
}

.identity-widget__signed-in {
  display: flex;
  align-items: center;
  gap: 10px;
}

.identity-popover__form {
  display: flex;
  flex-direction: column;
}

.identity-popover__form[hidden] {
  display: none;
}

.identity-popover__error {
  font-size: 12px;
  color: var(--danger);
  margin: -8px 0 14px;
}

.identity-popover__error[hidden] {
  display: none;
}

.identity-popover__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.identity-popover__confirm-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--maroon);
}

.identity-popover__confirm-body {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.identity-popover__confirm-body strong {
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Page title
   -------------------------------------------------------------------------- */

.page-content {
  padding-top: 40px;
  padding-bottom: 64px;
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--maroon);
  text-align: center;
  margin-bottom: 8px;
}

.page-subtitle {
  text-align: center;
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 40px;
}

/* --------------------------------------------------------------------------
   Doc frame — "official document" card
   -------------------------------------------------------------------------- */

.doc-frame {
  background: var(--cream-card);
  border: 1px solid var(--gold);
  outline: 2px solid var(--maroon);
  outline-offset: 6px;
  box-shadow: var(--shadow);
  padding: 40px;
  margin: 0 auto 32px;
}

.doc-frame + .doc-frame {
  margin-top: 32px;
}

@media (max-width: 720px) {
  .doc-frame {
    padding: 20px;
    outline-offset: 4px;
  }
}

/* --------------------------------------------------------------------------
   Eyebrow
   -------------------------------------------------------------------------- */

.eyebrow {
  display: inline-block;
  border: 1px solid var(--gold);
  color: var(--maroon);
  font-size: 11px;
  letter-spacing: 0.14em;
  padding: 4px 10px;
  background: var(--gold-light);
  margin-bottom: 12px;
}

/* --------------------------------------------------------------------------
   Ornament divider
   -------------------------------------------------------------------------- */

.ornament {
  text-align: center;
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 0.6em;
  margin: 32px 0;
}

/* Site-footer variant: three small DMV medallions (D.C., Virginia,
   Maryland) in place of the plain glyph divider — the in-document dividers
   inside bylaws.html (matching the source PDF's plain ornament) are
   untouched. */
.ornament--seals {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  letter-spacing: normal;
}

.ornament-seal {
  width: 26px;
  height: 26px;
  color: var(--gold);
  flex: none;
}

/* --------------------------------------------------------------------------
   Trophy Case
   -------------------------------------------------------------------------- */

.trophy-intro {
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.trophy-table-wrap {
  overflow-x: auto;
}

.trophy-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.trophy-table th,
.trophy-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.trophy-table thead th {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--maroon);
  color: var(--ink-soft);
}

.trophy-table tbody tr:nth-child(even) {
  background: var(--cream-card);
}

.trophy-table tbody tr:hover {
  background: var(--gold-light);
}

.trophy-year {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--maroon);
}

.trophy-medal {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
}

.trophy-rank--gold .trophy-medal { background: var(--gold); }
.trophy-rank--silver .trophy-medal { background: var(--silver); }
.trophy-rank--bronze .trophy-medal { background: var(--bronze); }

@media (max-width: 720px) {
  .trophy-table {
    font-size: 13.5px;
  }
  .trophy-table th,
  .trophy-table td {
    padding: 10px 10px;
  }
}

/* --------------------------------------------------------------------------
   Dateline
   -------------------------------------------------------------------------- */

.dateline {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
  margin-bottom: 6px;
}

.subtitle {
  color: var(--ink-soft);
  font-size: 16px;
  margin: 4px 0 20px;
}

.doc-body {
  margin-top: 20px;
}

/* --------------------------------------------------------------------------
   Article typography inside .doc-frame
   -------------------------------------------------------------------------- */

.doc-frame h1,
.doc-frame h2,
.doc-frame h3 {
  font-family: var(--font-display);
  text-transform: uppercase;
  color: var(--maroon);
  letter-spacing: 0.03em;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--maroon);
  margin-top: 32px;
  margin-bottom: 16px;
}

.doc-frame h1:first-child,
.doc-frame h2:first-child,
.doc-frame h3:first-child {
  margin-top: 0;
}

.doc-frame h1 {
  font-size: 30px;
  font-weight: 700;
}

.doc-frame h2 {
  font-size: 24px;
  font-weight: 600;
}

.doc-frame h3 {
  font-size: 18px;
  font-weight: 600;
}

.doc-frame p {
  margin-bottom: 16px;
}

.doc-frame p:last-child {
  margin-bottom: 0;
}

.doc-frame blockquote {
  border-left: 3px solid var(--gold);
  padding: 4px 0 4px 20px;
  font-style: italic;
  color: var(--ink-soft);
  margin: 20px 0;
}

.doc-frame ul,
.doc-frame ol {
  font-family: var(--font-body);
  margin: 0 0 16px 24px;
}

.doc-frame ul {
  list-style: disc;
}

.doc-frame ol {
  list-style: decimal;
}

.doc-frame li {
  margin-bottom: 8px;
}

.doc-frame li:last-child {
  margin-bottom: 0;
}

.doc-frame a {
  color: var(--maroon);
  border-bottom: 1px solid var(--gold);
}

.doc-frame a:hover {
  color: var(--maroon-dark);
  border-bottom-color: var(--maroon-dark);
}

.doc-frame strong {
  color: var(--maroon-dark);
}

.doc-frame hr {
  border: none;
  border-top: 3px double var(--maroon);
  margin: 32px 0;
}

.clause {
  margin-bottom: 14px;
}

.clause:last-of-type {
  margin-bottom: 0;
}

.callout {
  border-left: 3px solid var(--gold);
  padding: 4px 0 4px 20px;
  font-style: italic;
  color: var(--ink-soft);
  margin: 20px 0;
}

.ratified {
  text-align: center;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--maroon);
  font-weight: 700;
  margin-bottom: 12px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  letter-spacing: 0.12em;
  padding: 11px 24px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--maroon);
  color: var(--cream);
  border-color: var(--maroon);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--maroon-dark);
}

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

.btn-ghost:hover,
.btn-ghost:focus-visible {
  background: var(--maroon);
  color: var(--cream);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* --------------------------------------------------------------------------
   Card
   -------------------------------------------------------------------------- */

.card {
  background: var(--cream-card);
  border: 1px solid var(--hairline);
  padding: 24px;
  margin-bottom: 20px;
}

/* --------------------------------------------------------------------------
   Poll card
   -------------------------------------------------------------------------- */

.poll-card {
  background: var(--cream-card);
  border: 1px solid var(--hairline);
  padding: 24px;
  margin-bottom: 20px;
}

.poll-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.poll-card__title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--maroon);
  text-transform: uppercase;
}

.poll-card__status {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border: 1px solid currentColor;
  white-space: nowrap;
}

.poll-card__status.status-open,
.badge.status-open {
  color: var(--success);
}

.poll-card__status.status-closed,
.badge.status-closed {
  color: var(--ink-soft);
}

.poll-card__options {
  margin: 4px 0 12px;
}

.poll-card__meta {
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.poll-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  cursor: pointer;
}

.poll-option:last-of-type {
  border-bottom: none;
}

.poll-option--readonly {
  cursor: default;
}

.poll-option--yours {
  background: var(--gold-light);
  padding-left: 10px;
  padding-right: 10px;
  margin: 0 -10px;
  border-radius: 2px;
}

.poll-option input[type="radio"],
.poll-option input[type="checkbox"] {
  accent-color: var(--maroon);
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.poll-option__label {
  flex: 1 1 auto;
  min-width: 200px;
}

.poll-option__pct {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 13px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.poll-results-bar {
  display: block;
  position: relative;
  flex: 1 1 100%;
  width: 100%;
  height: 10px;
  background: var(--hairline);
  overflow: hidden;
}

.poll-results-bar__fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  background: var(--maroon);
}

.poll-results-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Badge
   -------------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  background: var(--gold-light);
  color: var(--maroon-dark);
  border: 1px solid var(--gold);
}

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

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  background: var(--cream);
  border: 1px solid var(--hairline);
  color: var(--ink);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 15px;
}

.field input[type="text"]:focus,
.field input[type="email"]:focus,
.field input[type="password"]:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
  border-color: var(--maroon);
}

.field-hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.field-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  max-width: 320px;
  padding: 14px 18px;
  background: var(--cream-card);
  border: 1px solid var(--hairline);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast-success {
  border-left: 4px solid var(--success);
  color: var(--ink);
}

.toast-error {
  border-left: 4px solid var(--danger);
  color: var(--ink);
}

/* --------------------------------------------------------------------------
   Site footer
   -------------------------------------------------------------------------- */

.site-footer {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px 48px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
}

.site-footer a {
  color: var(--maroon);
  border-bottom: 1px solid var(--gold);
}

.site-footer a:hover {
  color: var(--maroon-dark);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (min-width: 900px) {
  .site-header__inner,
  .page-content {
    padding: 0 48px;
  }

  .site-footer {
    padding: 0 48px 48px;
  }
}

@media (max-width: 720px) {
  .site-header__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .brand {
    justify-content: center;
  }

  .site-nav {
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
  }

  .identity-widget {
    width: 100%;
    justify-content: center;
  }

  .page-title {
    font-size: 30px;
  }
}
