.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  border-bottom: 1px solid #e9e6dd;
  background: rgba(247, 246, 242, 0.96);
  backdrop-filter: blur(10px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(var(--content-wide), calc(100% - 48px));
  margin: 0 auto;
  padding: 16px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: max-content;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 18px;
  font-weight: 800;
}

.brand-name,
.footer-brand {
  color: var(--color-ink);
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 22px;
  font-weight: 800;
}

.brand-name span,
.footer-brand span {
  color: var(--color-primary);
}

.site-nav,
.footer-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-weight: 800;
}

.nav-link {
  color: var(--color-text);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--color-primary);
}

.nav-link-muted {
  color: var(--color-muted);
  font-size: 13px;
}

.login-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--color-primary);
  border-radius: 999px;
  color: var(--color-primary);
  padding: 7px 18px;
}

.login-pill:hover,
.login-pill.is-active {
  background: var(--color-primary);
  color: #fff;
}

.account-link {
  white-space: nowrap;
}

.site-footer {
  border-top: 1px solid #e9e6dd;
}

.site-footer-inner {
  width: min(var(--content-wide), calc(100% - 48px));
  margin: 0 auto;
  padding: 44px 0 26px;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 32px 56px;
}

.footer-brand-block {
  max-width: 320px;
}

.footer-tagline {
  margin: 10px 0 0;
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.footer-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 32px 56px;
}

.footer-col {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

.footer-col h3 {
  margin: 0 0 2px;
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-col a {
  color: var(--color-primary);
  font-size: 14px;
  font-weight: 800;
}

.footer-col a:hover {
  text-decoration: underline;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 24px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid #e9e6dd;
  color: var(--color-muted);
  font-size: 13px;
  font-weight: 700;
}

.search-panel {
  display: grid;
  grid-template-columns: 1.05fr 1.5fr 1fr auto;
  gap: 12px;
  align-items: stretch;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-lifted);
  padding: 16px;
}

.field-shell {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-control);
  background: #fff;
  padding: 11px 14px;
}

.field-shell span,
.dashboard-edit span {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

/* Pakollinen kenttä korostetaan punaisella ääriviivalla vasta, kun käyttäjä
   yrittää lähettää lomakkeen se tyhjänä (:user-invalid ei osu sivun
   latautuessa, vaan vasta vuorovaikutuksen tai lähetysyrityksen jälkeen). */
.field-shell:has(:user-invalid) {
  border-color: var(--color-danger);
}

.field-shell input,
.field-shell select,
.field-shell textarea,
.dashboard-edit input,
.dashboard-edit select,
.status-field textarea {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--color-ink);
  font: inherit;
  font-weight: 800;
}

.field-shell select,
.dashboard-edit select {
  cursor: pointer;
}

.field-shell input[readonly] {
  color: #5c6678;
  cursor: default;
}

.field-shell textarea {
  resize: none;
  line-height: 1.45;
  overflow: hidden;
}

.field-shell textarea[rows="1"],
.status-field textarea[rows="1"] {
  min-height: 25px;
}

.listing-summary-field textarea {
  min-height: 880px;
}

.listing-audience-field textarea {
  min-height: 880px;
}

.field-shell.is-limit-glowing,
.status-field.is-limit-glowing {
  animation: field-limit-glow 520ms ease-out;
}

@keyframes field-limit-glow {
  0% {
    border-color: #db2f2f;
    box-shadow: 0 0 0 0 rgba(219, 47, 47, 0.42);
  }

  45% {
    border-color: #db2f2f;
    box-shadow: 0 0 0 4px rgba(219, 47, 47, 0.18);
  }

  100% {
    border-color: var(--color-border);
    box-shadow: 0 0 0 0 rgba(219, 47, 47, 0);
  }
}

.chip {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 1.5px solid var(--color-border);
  border-radius: 999px;
  background: #fff;
  color: var(--color-text);
  padding: 7px 16px;
  font-weight: 800;
}

.chip:hover,
.chip.is-active {
  border-color: var(--color-ink);
  background: var(--color-ink);
  color: #fff;
}

.listing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.listing-card {
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.listing-card-link {
  display: block;
  height: 100%;
}

.listing-card:hover {
  box-shadow: var(--shadow-lifted);
}

.listing-media,
.detail-media {
  background: repeating-linear-gradient(45deg, var(--image-a), var(--image-a) 10px, var(--image-b) 10px, var(--image-b) 20px);
}

.listing-media {
  position: relative;
  display: grid;
  height: 140px;
  place-items: center;
  color: #66728a;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
}

.new-ribbon {
  position: absolute;
  top: 12px;
  right: 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--color-primary);
  padding: 5px 10px;
  font-family: "Nunito Sans", sans-serif;
  font-weight: 800;
}

.listing-card-body {
  position: relative;
  display: flex;
  min-height: 214px;
  flex-direction: column;
  gap: 9px;
  padding: 20px 22px 22px;
}

.listing-card-topline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

/* Kategoria typistyy tarvittaessa, jotta tyyppi mahtuu oikealle kokonaisena. */
.listing-card-topline > .eyebrow {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.listing-organization-type {
  flex: none;
  color: var(--color-green);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
}

.new-inline {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  background: #eef3fd;
  color: var(--color-primary);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
}

.listing-card-body h2 {
  margin: 0;
  color: var(--color-ink);
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 21px;
  line-height: 1.2;
}

.listing-card-body p {
  margin: 0;
  color: #5c6678;
  font-size: 14px;
  line-height: 1.5;
}

.status-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: flex-start;
  gap: 7px;
  color: var(--status-fg);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.status-badge .status-dot {
  margin-top: 5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
}

.status-course {
  --status-bg: #eef3fd;
  --status-fg: #1d4ed8;
}

.status-open {
  --status-bg: #e5f3ea;
  --status-fg: #177245;
}

.status-full {
  --status-bg: #f5e9e2;
  --status-fg: #a8491f;
}

.listing-card-footer {
  display: flex;
  margin-top: auto;
  flex-direction: column;
  gap: 7px;
}

.listing-audience-line {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 7px;
  color: #7b8493;
  font-size: 13px;
  line-height: 1.35;
}

.listing-audience-line span:first-child {
  flex: 0 0 auto;
  font-weight: 800;
}

.listing-audience-line strong {
  min-width: 0;
  color: #4f596b;
  font-weight: 800;
}

.meta-dot {
  width: 4px;
  height: 4px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #aab1bf;
}

.pending-chip,
.hidden-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

.pending-chip {
  background: #fff3d6;
  color: #9a6413;
}

.hidden-chip {
  background: #f2f1ec;
  color: #5c6678;
}

.note-box,
.dashboard-note {
  border-radius: var(--radius-card);
  background: var(--color-surface-muted);
  color: #5c6678;
  font-weight: 700;
  line-height: 1.5;
  padding: 16px 18px;
}

.note-box a,
.dashboard-note a {
  color: var(--color-primary);
  font-weight: 800;
  text-decoration: underline;
}

.note-box a:hover,
.dashboard-note a:hover {
  color: var(--color-primary-dark);
}

@media (max-width: 980px) {
  .site-header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-panel {
    grid-template-columns: 1fr 1fr;
  }

  .search-panel .button {
    grid-column: span 2;
  }

  .listing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .site-nav,
  .footer-links,
  .site-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .search-panel,
  .listing-grid {
    grid-template-columns: 1fr;
  }

  .search-panel .button {
    grid-column: auto;
  }

  .brand-name {
    font-size: 20px;
  }
}
