/* ==========================================================================
   KCh3W – Konkurs Chemiczny Trzech Wydziałów Politechniki Łódzkiej
   Jasna paleta, jeden akcent (czerwień PŁ), geometryczna typografia bezszeryfowa, zwarty rytm.
   ========================================================================== */

:root {
  --red: #a6192e;
  --red-dark: #84111f;
  --red-tint: #fbeff1;
  --navy: #1b2a41;
  --ink: #1f2b3d;
  --ink-2: #44526a;
  --muted: #5b6980;
  --bg: #ffffff;
  --bg-alt: #f5f7fa;
  --line: #e3e8ef;
  --line-2: #cdd5e1;

  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 60px;
  --gap: 16px;

  --display: "Montserrat", "Avenir Next", "Segoe UI", Arial, sans-serif;
  --sans: "Montserrat", "Avenir Next", "Segoe UI", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font: 400 0.96rem/1.55 var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; color: var(--navy); line-height: 1.15; text-wrap: balance; }
h1, h2 { font-family: var(--display); font-weight: 600; letter-spacing: 0.01em; }
h3 { font-size: 1rem; font-weight: 700; }

p { margin: 0 0 0.8em; }
p:last-child { margin-bottom: 0; }

a { color: var(--red); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { color: var(--red-dark); }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 4px; }

img { max-width: 100%; }

.wrap { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }

.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 200;
  background: var(--navy); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
}
.skip-link:focus { top: 12px; color: #fff; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 0 0 12px; padding: 4px 12px 4px 10px;
  border-radius: 99px; background: #fff; border: 1px solid var(--line);
  font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--red);
}
.eyebrow::before { content: ""; width: 7px; height: 8px; background: currentColor; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

.label { margin: 0 0 10px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }

/* ---------- Nagłówek strony ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav { min-height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 20px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--navy); text-decoration: none; }
.brand:hover { color: var(--navy); }

.brand-mark {
  display: grid; place-items: center; flex: none; width: 34px; height: 38px;
  background: var(--red); color: #fff;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  font: 700 1rem/1 var(--display);
}
.brand-text { font-weight: 700; font-size: 0.93rem; line-height: 1.2; }
.brand-text small { display: block; font-weight: 500; font-size: 0.76rem; color: var(--muted); }

.menu { display: flex; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.menu a {
  display: block; padding: 7px 12px; border-radius: var(--radius-sm);
  color: var(--ink-2); font-size: 1.2rem; font-weight: 700; text-decoration: none;
  transition: background-color 0.15s, color 0.15s;
}
.menu a:hover { background: var(--bg-alt); color: var(--navy); }
.menu a.nav-cta { background: var(--red); color: #fff; margin-left: 8px; padding-inline: 16px; }
.menu a.nav-cta:hover { background: var(--red-dark); color: #fff; }

.menu-button {
  display: none; min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: #fff; color: var(--navy); font: 600 0.88rem var(--sans); cursor: pointer;
}

/* ---------- Przyciski ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px;
  border: 1px solid var(--red); border-radius: var(--radius-sm);
  background: var(--red); color: #fff;
  font-size: 0.92rem; font-weight: 650; text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.button:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.button.ghost { background: #fff; border-color: var(--line-2); color: var(--navy); }
.button.ghost:hover { background: #fff; border-color: var(--red); color: var(--red); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Start ---------- */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  padding: clamp(28px, 4.5vw, 52px) 0;
  background:
    radial-gradient(560px 280px at 96% 0, rgba(166, 25, 46, 0.09), transparent 70%),
    radial-gradient(640px 320px at 0 100%, rgba(60, 100, 170, 0.09), transparent 70%),
    linear-gradient(180deg, #fbfcfe, #f0f3f8);
  border-bottom: 1px solid var(--line);
}

/* Siatka heksagonalna – motyw pierścieni aromatycznych, zanikająca ku tekstowi */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='27.71' height='48' viewBox='0 0 27.71 48'%3E%3Cpath d='M13.86 8L27.71 16V32L13.86 40L0 32V16ZM13.86 0V8M13.86 40V48' fill='none' stroke='%231b2a41' stroke-opacity='.09' stroke-width='.6'/%3E%3C/svg%3E");
  background-size: 56px 97px;
  -webkit-mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
  mask-image: linear-gradient(100deg, transparent 35%, #000 100%);
}

.hero-grid {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
  gap: clamp(24px, 5vw, 56px); align-items: center;
}

.hero h1 { font-size: clamp(1.9rem, 4.2vw, 3rem); line-height: 1.08; margin-bottom: 14px; }
.hero h1 span { display: block; color: var(--red); }
.hero-lead { max-width: 52ch; margin-bottom: 20px; font-size: 1.04rem; color: var(--ink-2); }

.next {
  padding: 20px 24px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--line); border-top: 3px solid var(--red);
  box-shadow: 0 14px 32px -18px rgba(27, 42, 65, 0.28);
}
.next-kicker { margin: 0 0 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.next-date { margin: 0 0 10px; font: 600 clamp(1.35rem, 2.4vw, 1.75rem)/1.15 var(--display); color: var(--navy); }
.next-status { display: flex; align-items: center; flex-wrap: nowrap; gap: 9px; min-width: 0; }
.next-count { display: inline-flex; flex: 0 0 auto; align-items: center; margin: 0; padding: 3px 11px; border-radius: 99px; background: var(--red-tint); color: var(--red-dark); font-size: 0.82rem; font-weight: 700; white-space: nowrap; }
.next-count[hidden] { display: none; }
.next-text { min-width: 0; margin: 0; color: var(--navy); font-size: 0.9rem; font-weight: 700; line-height: 1.25; white-space: nowrap; }

/* ---------- Logo konkursu i organizatorów ---------- */
.hero-branding { min-width: 0; }
.contest-logo { display: block; width: 100%; max-width: 720px; height: auto; }
.institution-logos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center; gap: clamp(12px, 2.2vw, 26px); width: 100%; max-width: 720px; margin-top: 20px; }
.institution-logos a { display: flex; align-items: center; justify-content: center; min-width: 0; color: inherit; text-decoration: none; opacity: 0.9; transition: opacity 0.15s, transform 0.15s; }
.institution-logos a:hover { opacity: 1; transform: translateY(-2px); }
.institution-logos img { display: block; width: auto; max-width: 100%; height: clamp(100px, 5vw, 100px); object-fit: contain; }
.hero-branding > .actions:not(:empty) { margin-top: 22px; }
/* ---------- Sekcje ---------- */
.section { padding: clamp(28px, 4vw, 44px) 0; }
.section.alt { background: var(--bg-alt); border-block: 1px solid var(--line); }

.section-head { max-width: 1024px; margin-bottom: 18px;}
.section-head h2 { display: flex; align-items: center; gap: 12px; font-size: clamp(1.4rem, 2.4vw, 1.8rem); }
.section-head h2::before {
  content: ""; flex: none; width: 13px; height: 15px; background: var(--red);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.section-head p { margin-top: 8px; color: var(--ink-2); }

.empty {
  grid-column: 1 / -1; margin: 0; padding: 14px 18px;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--muted); font-size: 0.9rem; background: #fff;
}

/* ---------- Harmonogram ---------- */
.timeline {
  --tl-gap: 24px;
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 var(--tl-gap);
}

.timeline li { position: relative; padding-top: 26px; }
.timeline li::before {
  content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px;
  border-radius: 50%; background: #fff; border: 2px solid var(--line-2);
}
.timeline li::after {
  content: ""; position: absolute; top: 6px; left: 24px; right: calc(var(--tl-gap) * -1);
  height: 2px; background: var(--line);
}
.timeline li:last-child::after { display: none; }
.timeline li.is-past::before { background: var(--line-2); }
.timeline li.is-next::before { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 5px var(--red-tint); }

.timeline .tag { display: block; margin-bottom: 4px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.timeline li.is-next .tag { color: var(--red); }
.timeline h3 { margin-bottom: 2px; }
.timeline time { display: block; margin-bottom: 8px; font: 600 1.2rem/1.25 var(--display); color: var(--navy); }
.timeline li.is-next time { color: var(--red); }
.timeline p { color: var(--ink-2); font-size: 0.88rem; }
.timeline li.is-past h3, .timeline li.is-past time, .timeline li.is-past p { color: var(--muted); }

/* ---------- O konkursie ---------- */
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }

.stage { padding: 20px 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.stage-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.stage-num {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: var(--red-tint); color: var(--red); font: 700 0.95rem/1 var(--display);
}
.stage p { color: var(--ink-2); font-size: 0.92rem; }
.stage.benefit { background: var(--red-tint); border-color: rgba(166, 25, 46, 0.2); }
.stage.benefit .stage-num { background: var(--red); color: #fff; }

/* ---------- Zadania i wyniki ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.docs:empty { display: none; }

.doc {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 20px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.doc:hover { border-color: var(--red); box-shadow: 0 8px 22px -12px rgba(27, 42, 65, 0.28); color: var(--ink); }
.doc-title { font-weight: 700; color: var(--navy); }
.doc-desc { color: var(--muted); font-size: 0.88rem; }
.doc-cta { margin-top: 6px; color: var(--red); font-size: 0.85rem; font-weight: 700; }

.archive { margin-top: var(--gap); }
.docs:empty + .archive, .docs:empty + noscript + .archive { margin-top: 0; }

.archive-list { list-style: none; margin: 0; padding: 0; }
.archive-list li { display: grid; grid-template-columns: 130px 1fr; gap: 4px 20px; padding: 9px 0; border-top: 1px solid var(--line); }
.archive-list li:first-child { border-top: 0; padding-top: 0; }
.archive-list li:last-child { padding-bottom: 0; }
.ed strong { color: var(--navy); }
.ed small { margin-left: 8px; color: var(--muted); }
.ed-links { display: flex; flex-wrap: wrap; gap: 4px 24px; align-items: baseline; font-size: 0.9rem; }
.grp { display: inline-flex; flex-wrap: wrap; gap: 2px 10px; }
.grp-name { font-weight: 600; color: var(--ink-2); }

/* ---------- Panele rozwijane ---------- */
.panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }

.panel > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 20px; list-style: none; cursor: pointer; font-weight: 700; color: var(--navy);
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::after {
  content: ""; flex: none; width: 8px; height: 8px;
  border-right: 2px solid var(--red); border-bottom: 2px solid var(--red);
  transform: rotate(45deg) translateY(-2px); transition: transform 0.2s;
}
.panel[open] > summary { border-bottom: 1px solid var(--line); }
.panel[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.panel-body { padding: 16px 20px 20px; }

.prose { color: var(--ink-2); font-size: 0.92rem; line-height: 1.6; }
.prose ol, .prose ul { margin: 0; padding-left: 1.4em; }
.prose li { margin-bottom: 0.5em; padding-left: 0.2em; }
.prose li::marker { color: var(--red); font-weight: 700; }
.prose ul { margin-top: 0.4em; }
.prose strong { color: var(--navy); }
.prose .literature { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Sponsorzy ---------- */
.sponsors { display: flex; flex-direction: column; justify-content: center; gap: 14px; max-width: 480px; padding: 14px 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin: 0 auto}
.sponsor { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 48px; }
.sponsor p { margin: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.sponsor img { display: block; height: 38px; width: auto; }
.logo-fallback { font-weight: 700; color: var(--navy); }

/* ---------- Kontakt ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.2fr; gap: clamp(24px, 5vw, 64px); }

.facts { margin: 0; }
.facts > div { display: grid; grid-template-columns: 72px 1fr; gap: 14px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.facts > div:last-child { border-bottom: 1px solid var(--line-2); }
.facts dt { padding-top: 3px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.facts dd { margin: 0; }

.chair { margin-bottom: 8px; }
.members { columns: 2; column-gap: 28px; margin: 0; padding-left: 1.2em; color: var(--ink-2); font-size: 0.92rem; }
.members li { break-inside: avoid; margin-bottom: 2px; }
.members li::marker { color: var(--red); }

/* ---------- Stopka ---------- */
.site-footer { background: var(--bg-alt); border-top: 1px solid var(--line); color: var(--muted); padding: 16px 0; font-size: 0.84rem; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.site-footer a { font-weight: 600; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---------- Tablet i telefon ---------- */
@media (max-width: 1000px) {
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px var(--tl-gap); }
  .timeline li:nth-child(2n)::after { display: none; }
  .stages { grid-template-columns: 1fr 1fr; }
  .stages .benefit { grid-column: 1 / -1; }
}

@media (max-width: 860px) {
  .nav { flex-wrap: wrap; padding-block: 8px; }
  .menu { width: 100%; flex-wrap: wrap; }
  .menu a.nav-cta { margin-left: 0; }

  /* Menu zwijane tylko gdy działa JavaScript; bez niego linki po prostu się zawijają */
  .js .menu-button { display: block; }
  .js .nav { flex-wrap: nowrap; padding-block: 0; }
  .js .menu {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px;
    padding: 10px 20px 16px; background: #fff; border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 24px -16px rgba(27, 42, 65, 0.25);
  }
  .js .menu.open { display: flex; }
  .js .menu a { padding: 11px 12px; }
  .js .menu a.nav-cta { text-align: center; margin-top: 6px; }

  .hero-grid, .contact, .panels { grid-template-columns: 1fr; }

  .timeline { grid-template-columns: 1fr; gap: 0; }
  .timeline li { padding: 0 0 22px 34px; }
  .timeline li:last-child { padding-bottom: 0; }
  .timeline li::before { top: 3px; }
  .timeline li::after, .timeline li:nth-child(2n)::after { display: block; top: 22px; bottom: -2px; left: 6px; right: auto; width: 2px; height: auto; }
  .timeline li:last-child::after { display: none; }

  .archive-list li { grid-template-columns: 1fr; }
  .footer { flex-direction: column; text-align: center; }
}

@media (max-width: 600px) {
  .wrap { width: calc(100% - 32px); }
  .stages { grid-template-columns: 1fr; }
  .institution-logos { grid-template-columns: repeat(4, minmax(52px, 1fr)); gap: 9px; }
  .institution-logos img { height: clamp(32px, 10vw, 46px); }
  .next-status { flex-wrap: wrap; gap: 7px; }
  .next-text { white-space: normal; }
  .actions .button { width: 100%; }
  .members { columns: 1; }
  .panel > summary, .panel-body { padding-inline: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
