/* --------------------------------------------------------------------------
   Fonts
   Newsreader is stored in /fonts, so the site makes no external font request.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}

@font-face {
  font-family: "Newsreader";
  src: url("fonts/Newsreader-Italic-Variable.ttf") format("truetype");
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
}

:root {
  /* These three colours control almost the entire visual system. */
  --paper: #fbfaf7;
  --ink: #171713;
  --muted: #65645f;
  color-scheme: light;
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

/* Make element widths predictable when padding or borders are added. */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   Page defaults
   -------------------------------------------------------------------------- */

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.52;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

/* Hidden until focused: lets keyboard users jump directly to the main area. */
.skip-link {
  position: fixed;
  z-index: 10;
  top: 1rem;
  left: 1rem;
  padding: 0.55rem 0.8rem;
  transform: translateY(-180%);
  border: 1px solid var(--ink);
  background: var(--paper);
}

.skip-link:focus {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   Full-screen archival background
   The pseudo-element keeps the image decorative and out of the HTML reading
   order. Change opacity here to make the drawing lighter or darker.
   -------------------------------------------------------------------------- */

.site-grid {
  position: relative;
  display: flow-root;
  min-height: 100svh;
  isolation: isolate;
}

.site-grid::before {
  position: fixed;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(rgba(251, 250, 247, 0.12), rgba(251, 250, 247, 0.12)), url("assets/viaduct-original.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  content: "";
  filter: grayscale(1) contrast(0.92) brightness(1.06);
  opacity: 0.68;
}

/* --------------------------------------------------------------------------
   Floating content panel
   This is the only box on the page. Its translucent fill and blur separate it
   from the drawing without a border.
   -------------------------------------------------------------------------- */

.content-column {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 3rem), 22.5rem);
  margin: clamp(1.5rem, 7vh, 4.5rem) 0 clamp(1.5rem, 7vh, 4.5rem) clamp(1.5rem, 7vw, 7rem);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  background: rgba(246, 244, 238, 0.92);
  box-shadow: 0 1.75rem 5rem rgba(23, 23, 19, 0.08);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

/* --------------------------------------------------------------------------
   Primary navigation
   JavaScript sets aria-current="page" on the active hash route.
   -------------------------------------------------------------------------- */

.site-header {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--ink);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.7rem 1.15rem;
}

.site-nav a {
  padding: 0.15rem 0 0.08rem;
  border-bottom: 1px solid transparent;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.115em;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
  border-bottom-color: currentColor;
}

/* --------------------------------------------------------------------------
   Shared content typography
   Both Nominate and About use the same heading and body scale.
   -------------------------------------------------------------------------- */

.content-area {
  width: 100%;
  padding-top: clamp(2.5rem, 7vh, 4rem);
}

h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.4vw, 2.1rem);
  font-weight: 520;
  letter-spacing: -0.035em;
  line-height: 1;
}

.intro-copy,
.success-state > p {
  margin: 1.25rem 0 0;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   Nomination form
   -------------------------------------------------------------------------- */

#nomination-form {
  position: relative;
  margin-top: clamp(2.25rem, 5vh, 3rem);
}

.field-group + .field-group {
  margin-top: 2.1rem;
}

.field-group label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-group input {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.15rem 0 0.25rem;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.92rem;
}

.field-group input:focus {
  border-bottom-width: 2px;
}

.field-group input[aria-invalid="true"] {
  /* Only invalid fields use colour; errors are also written below the form. */
  border-bottom-color: #8a271d;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.7rem;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--ink);
}

.submit-button,
.text-button {
  border-radius: 0;
  color: var(--ink);
  cursor: pointer;
}

.submit-button {
  display: block;
  min-width: 7.25rem;
  margin-top: 2rem;
  padding: 0.72rem 1.25rem 0.62rem;
  border: 1px solid var(--ink);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.submit-button:hover,
.submit-button:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.submit-button:disabled {
  /* Disabled only while the browser is sending a nomination. */
  cursor: wait;
  opacity: 0.55;
}

.text-button {
  margin-top: 2rem;
  padding: 0.15rem 0 0.08rem;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.form-message {
  /* The fixed minimum height prevents the panel jumping when a message shows. */
  min-height: 1.5em;
  margin: 1rem 0 0;
  color: #8a271d;
  font-size: 0.9rem;
}

.honeypot {
  /* Spam trap: humans never see or focus this field. */
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(1px, 1px, 1px, 1px) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

/* --------------------------------------------------------------------------
   Confirmation and About views
   -------------------------------------------------------------------------- */

.success-state {
  /* This state receives programmatic focus after a successful submission. */
  outline: none;
}

.about-panel {
  padding-bottom: 1rem;
}

.about-copy {
  margin-top: 2rem;
}

.about-copy p {
  margin: 0;
}

.about-copy p + p {
  margin-top: 1.25rem;
}

.placeholder-copy {
  color: var(--muted);
  font-style: italic;
}

.about-footer {
  margin-top: 4.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.about-footer p {
  margin: 0;
}

.about-footer p + p {
  margin-top: 1rem;
}

.archive-credit a {
  text-underline-offset: 0.15em;
}

/* --------------------------------------------------------------------------
   Top 20 view
   Each row has a fixed-width rank, a flexible name and a right-aligned count.
   -------------------------------------------------------------------------- */

.top-heroes-status {
  margin: 1.25rem 0 0;
  color: var(--muted);
}

.top-heroes-status:empty {
  display: none;
}

.top-heroes-list {
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.top-heroes-list:empty {
  display: none;
}

.top-heroes-list li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.68rem 0;
  border-top: 1px solid rgba(23, 23, 19, 0.24);
}

.top-heroes-list li:last-child {
  border-bottom: 1px solid rgba(23, 23, 19, 0.24);
}

.top-heroes-rank,
.top-heroes-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.top-heroes-name {
  overflow-wrap: anywhere;
}

.top-heroes-count {
  text-align: right;
}

.noscript-message {
  margin-top: 2rem;
  color: #8a271d;
  font-size: 0.9rem;
}

/* JavaScript uses the native hidden attribute to switch between views. */
[hidden] {
  display: none !important;
}

/* One consistent keyboard focus treatment for links, buttons and controls. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

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

@media (max-width: 920px) {
  /* Keep the bridge's central span visible on narrower screens. */
  .site-grid::before {
    background-position: 54% center;
  }
}

@media (max-width: 560px) {
  /* On phones the panel keeps a simple one-rem gutter around the viewport. */
  .content-column {
    width: calc(100% - 2rem);
    margin: 1rem;
    padding: 1.4rem;
  }

  .content-area {
    padding-top: 2.75rem;
  }

  #nomination-form {
    margin-top: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Respect the user's operating-system motion preference. */
  html {
    scroll-behavior: auto;
  }
}
