/* ==========================================================
   Konkurs "Zadania z gwiazdką" – winter night theme
   Modelled on the poster (steel-blue night sky, full moon,
   ice-blue snowflakes, stars, pine silhouettes, glowing gold
   lettering) and the logo (slate disc, gold ring, white
   chalk lettering around the big π).
   All colours are sampled directly from plakat.pdf / logo.pdf;
   the header shows the emblem via img/logo.png (rendered from
   logo.pdf). Selectors are unchanged, so no HTML edits are
   needed. Admin pages are neutralised in hotfixes.css.
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Allura&family=Amatic+SC:wght@700&family=Inter:wght@400;600&family=Playfair+Display:wght@700;800&display=swap');

:root {
  /* Palette sampled directly from plakat.pdf / logo.pdf */
  --sky-top:    #14344d;   /* dark night sky at the top of the poster */
  --sky-mid:    #32648b;   /* sky behind the "Konkurs" lettering */
  --sky-bottom: #5891b9;   /* bright dusk sky above the treeline */
  --slate:      #203040;   /* logo disc background */
  --panel:      rgba(24, 43, 61, 0.86);
  --gold:       #d8a878;   /* logo ring / poster lettering */
  --gold-soft:  rgba(216, 168, 120, 0.5);
  --cream:      #f8e0b8;   /* glowing highlights of the poster lettering */
  --ice:        #78d0f8;   /* poster snowflakes */
  --text:       #eef6fd;
  --muted:      #c3d6e8;
  --error:      #ffb0a6;

  --glow-gold:  0 0 8px rgba(255, 224, 160, 0.9), 0 0 26px rgba(250, 200, 120, 0.5);
  --radius:     14px;

  --font-script:  'Allura', cursive;               /* poster "Konkurs" */
  --font-serif:   'Playfair Display', Georgia, serif; /* "DLA KLAS 7 i 8" */
  --font-chalk:   'Amatic SC', 'Segoe Print', cursive; /* logo lettering */
  --font-body:    'Inter', Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100%;
  background-color: var(--sky-bottom);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--sky-bottom);
  background-repeat: repeat-x, repeat, repeat, no-repeat, no-repeat;
  background-position: bottom left, 0 0, 0 0, 50% 0, 0 0;
  background-size: 160px 90px, 220px 220px, 300px 300px, auto, auto;
  background-image:
    /* pine forest along the bottom of the page */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='90' viewBox='0 0 160 90'%3E%3Cpath fill='%23082840' d='M0 90V70l14-18H6l16-22h-9L28 4l15 26h-9l16 22h-8l14 18v20zM100 90V64l12-16h-7l14-20h-8l13-24 13 24h-8l14 20h-7l12 16v26z'/%3E%3C/svg%3E"),
    /* drifting ice-blue snowflakes */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'%3E%3Cg fill='none' stroke='%237fd2f8' stroke-width='2' stroke-linecap='round' opacity='0.55'%3E%3Cg transform='translate(64 64)'%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(60)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(120)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(180)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(240)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(300)'/%3E%3C/g%3E%3Cg transform='translate(168 152) scale(0.6)'%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(60)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(120)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(180)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(240)'/%3E%3Cpath d='M0 0V-20M0 -12L5 -17M0 -12L-5 -17' transform='rotate(300)'/%3E%3C/g%3E%3C/g%3E%3Cg fill='%23cdeafb' opacity='0.7'%3E%3Ccircle cx='36' cy='150' r='2'/%3E%3Ccircle cx='190' cy='58' r='2'/%3E%3Ccircle cx='120' cy='30' r='1.5'/%3E%3C/g%3E%3C/svg%3E"),
    /* scattered stars */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300' viewBox='0 0 300 300'%3E%3Cg fill='%23ffffff'%3E%3Ccircle cx='36' cy='48' r='1.6' opacity='0.9'/%3E%3Ccircle cx='150' cy='120' r='1.2' opacity='0.75'/%3E%3Ccircle cx='240' cy='210' r='1.6' opacity='0.85'/%3E%3Ccircle cx='90' cy='250' r='1.1' opacity='0.6'/%3E%3C/g%3E%3C/svg%3E"),
    /* full-moon glow behind the header */
    radial-gradient(circle at 50% 0, rgba(235, 247, 255, 0.30) 0, rgba(235, 247, 255, 0.10) 12rem, transparent 24rem),
    /* night sky */
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 52%, var(--sky-bottom) 100%);
}

a {
  color: #bde5fb;   /* ice blue, bright enough on the dusk sky */
  text-shadow: 0 1px 2px rgba(10, 30, 48, 0.55);
}

a:visited {
  color: #bcd8ee;
}

a:hover {
  color: #ffffff;
  text-shadow: 0 0 10px rgba(165, 216, 242, 0.8);
}

/* links inside the dark panels don't need the extra halo */
section a,
article a,
td a,
dl a {
  text-shadow: none;
}

/* ---------- Header: the one glowing moment ---------- */

header {
  position: relative;
  border-bottom: 1px solid var(--gold);
  background: rgba(16, 34, 52, 0.45);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

header > h1,
header > nav,
main,
footer {
  width: 80%;
  max-width: 1100px;
  margin-right: auto;
  margin-left: auto;
}

header > h1 {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 1rem;
  padding-bottom: 0.25rem;
  font-family: var(--font-script);
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  font-weight: 400;
  line-height: 1.1;
  text-align: center;
  color: var(--cream);
  text-shadow: var(--glow-gold);
}

header > h1 a,
header > h1 a:visited {
  color: var(--cream);
  text-decoration: none;
}

header > h1 a:hover {
  color: #fff3d6;
  text-shadow: var(--glow-gold);
}

/* the contest emblem as a slate disc above the title (asset: img/logo.png) */
header > h1 a::before {
  content: "";
  display: block;
  width: clamp(5.5rem, 13vw, 7.5rem);
  aspect-ratio: 1;
  margin: 0.75rem auto 0.4rem;
  border-radius: 50%;
  background: var(--slate) url("../img/logo.png") center / cover no-repeat;
  box-shadow: 0 0 0 2px var(--gold-soft), 0 8px 20px rgba(0, 0, 0, 0.35);
}

header > nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  align-items: center;
  justify-content: center;
  padding-top: 0.9rem;
  padding-bottom: 0.85rem;
  font-family: var(--font-chalk);
  font-size: 1.5rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

header > nav a,
header > nav a:visited {
  color: var(--text);
  text-decoration: none;
  padding: 0.1rem 0.25rem;
  border-bottom: 2px solid transparent;
}

header > nav a:hover,
header > nav a:focus {
  color: var(--cream);
  border-bottom-color: var(--gold);
  text-shadow: none;
}

/* the logout form is a control, not a content panel */
nav form {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

/* logout pinned to the top-right corner of the page */
header > nav form {
  position: absolute;
  top: 1.1rem;
  right: 1.25rem;
}

/* readable body-font pill (the chalk uppercase looked off in a button) */
header > nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.3rem 1.2rem;
  line-height: 1.2;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
}

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

main {
  min-height: 70vh;
  padding-top: 1.5rem;
  padding-bottom: 1.5rem;
}

/* panels: slate-blue discs from the logo, outlined in gold */
section,
article,
form,
table,
dl {
  border: 1px solid var(--gold-soft);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

section,
article,
form,
dl {
  padding: 1.25rem;
}

main > section,
main > article,
main > form,
main > table,
main > dl {
  margin-top: 1rem;
  margin-bottom: 1rem;
}

h2,
h3 {
  margin-top: 0;
  font-family: var(--font-serif);
  font-weight: 800;
  line-height: 1.2;
  color: var(--cream);
  text-shadow: 0 0 14px rgba(250, 200, 120, 0.35);
}

main > h2 {
  font-size: 1.9rem;
}

p {
  max-width: 70ch;
}

/* ---------- Controls ---------- */

button,
input,
select {
  min-height: 2.25rem;
  font: inherit;
}

button,
.btn {
  padding: 0.35rem 1.1rem;
  color: var(--cream);
  background: transparent;
  border: 2px solid var(--gold);
  border-radius: 999px;
  font-family: var(--font-serif);
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

button:hover,
button:focus,
.btn:hover,
.btn:focus {
  color: var(--slate);
  background: var(--gold);
}

input,
select {
  padding: 0.3rem 0.6rem;
  color: var(--text);
  background: rgba(16, 32, 48, 0.85);
  border: 1px solid #6f96b8;
  border-radius: 8px;
  color-scheme: dark;
}

input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

input:hover,
select:hover {
  border-color: var(--ice);
}

/* Primary actions: the WTForms submit inputs ("Zgłoś uczestników",
   "Zaloguj się", "Zarejestruj się") glow like the poster lettering. */
input[type="submit"] {
  padding: 0.45rem 1.6rem;
  color: var(--slate);
  font-family: var(--font-serif);
  font-weight: 700;
  background: linear-gradient(180deg, #f2d3ab 0%, var(--gold) 100%);
  border: 1px solid var(--gold);
  border-radius: 999px;
  cursor: pointer;
  transition: filter 0.15s, box-shadow 0.15s, border-color 0.15s;
}

input[type="submit"]:hover,
input[type="submit"]:focus {
  border-color: var(--cream);
  filter: brightness(1.08);
  box-shadow: 0 0 16px rgba(216, 168, 120, 0.55);
}

.btn {
  text-decoration: none;
}

form p {
  display: grid;
  gap: 0.25rem;
  margin-top: 0;
  margin-bottom: 1rem;
}

form p:last-child {
  margin-bottom: 0;
}

form span {
  color: var(--error);
}

label {
  color: var(--cream);
  font-weight: 600;
}

[role="status"] {
  padding: 0.6rem 0.85rem;
  color: var(--text);
  border: 1px solid var(--ice);
  border-radius: 10px;
  background: rgba(165, 216, 242, 0.12);
}

/* ---------- Definition lists ---------- */

dl {
  display: grid;
  grid-template-columns: minmax(10rem, 0.5fr) 1fr;
  gap: 0.5rem 1rem;
}

dt {
  font-weight: 600;
  color: var(--gold);
}

dd {
  margin: 0;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

caption {
  padding: 0.5rem 0;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--cream);
  text-align: left;
}

th,
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(217, 168, 118, 0.25);
  text-align: left;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

th {
  color: var(--cream);
  background: rgba(217, 168, 118, 0.18);
  border-bottom: 1px solid var(--gold-soft);
  font-weight: 600;
}

tbody tr:hover td {
  background: rgba(165, 216, 242, 0.07);
}

td form {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}

/* compact action pills inside table rows (Edytuj / Usuń) */
td .btn,
td form button {
  min-height: 2rem;
  padding: 0.2rem 1rem;
  font-size: 0.95rem;
}

/* ---------- Documents page ---------- */

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.doc-item {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.65rem 0.9rem;
  background: rgba(16, 32, 48, 0.65);
  border: 1px solid var(--gold-soft);
  border-radius: 10px;
}

.doc-item:hover {
  border-color: var(--gold);
}

.doc-badge {
  min-width: 3rem;
  text-align: center;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--cream);
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
}

.doc-info {
  display: grid;
  gap: 0.1rem;
}

.doc-title {
  font-weight: 600;
  color: var(--text);
}

.doc-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.doc-item .btn {
  margin-left: auto;
}

/* ---------- Focus ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--cream);
  outline-offset: 2px;
}

/* ---------- Footer (sits above the pine trees) ---------- */

footer {
  padding-top: 1rem;
  padding-bottom: 6.5rem;
  border-top: 1px solid var(--gold-soft);
  font-size: 0.9rem;
  color: #16344e;   /* tree-silhouette navy: readable on the bright dusk sky */
}

/* ---------- Small screens ---------- */

@media (max-width: 700px) {
  main {
    padding-top: 1rem;
    padding-bottom: 1rem;
  }

  header > nav form {
    top: 0.75rem;
    right: 0.75rem;
  }

  header > nav {
    font-size: 1.35rem;
  }

  table {
    display: block;
    overflow-x: auto;
  }

  dl {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
