/* ==========================================================================
   Quark 2 Design System — Tokens, Base, Layout, Header, Typography
   Based on Grav 2.0 Quark 2 Theme (Cal.com-inspired, Blades CSS foundation)
   ========================================================================== */

/* ---------- 1. TYPOGRAPHY & WEBFONTS ---------- */
@font-face {
  font-family: 'Cal Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/cal-sans/cal-sans-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Cal Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/cal-sans/cal-sans-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter/inter-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/inter/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- 2. DESIGN TOKENS (LIGHT & DARK) ---------- */
:root,
:root[data-theme="light"] {
  --q2-bg: #fbfbfc;
  --q2-bg-elev: #ffffff;
  --q2-bg-muted: #f2f2f4;
  --q2-bg-inverse: #111111;

  --q2-text: #242424;
  --q2-text-strong: #111111;
  --q2-text-muted: #898989;
  --q2-text-inverse: #ffffff;

  --q2-border-ring: rgba(34, 42, 53, 0.08);
  --q2-border-strong: rgba(34, 42, 53, 0.14);
  --q2-divider: rgba(34, 42, 53, 0.08);

  --q2-shadow-card:
    rgba(19, 19, 22, 0.06) 0 1px 5px -4px, rgba(34, 42, 53, 0.08) 0 0 0 1px,
    rgba(34, 42, 53, 0.04) 0 4px 8px 0;
  --q2-shadow-raised:
    rgba(19, 19, 22, 0.07) 0 1px 5px -4px, rgba(34, 42, 53, 0.1) 0 0 0 1px,
    rgba(34, 42, 53, 0.08) 0 12px 28px -8px;
  --q2-shadow-dropdown:
    rgba(19, 19, 22, 0.07) 0 1px 5px -4px, rgba(34, 42, 53, 0.1) 0 0 0 1px,
    rgba(34, 42, 53, 0.12) 0 16px 32px -12px;
  --q2-shadow-inset: inset 0 1px 1.9px rgba(0, 0, 0, 0.08);

  --q2-radius-xs: 4px;
  --q2-radius-sm: 6px;
  --q2-radius: 8px;
  --q2-radius-md: 12px;
  --q2-radius-lg: 16px;
  --q2-radius-pill: 9999px;

  --q2-nav-bg: rgba(255, 255, 255, 0.82);
  --q2-nav-border: rgba(34, 42, 53, 0.08);
  --q2-header-height: 72px;

  --q2-accent: #3b82f6;
  --q2-focus-ring: rgba(59, 130, 246, 0.35);

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Cal Sans", "Inter", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  --q2-bg: #08090b;
  --q2-bg-elev: #16181d;
  --q2-bg-muted: #22252c;
  --q2-bg-inverse: #f5f5f5;

  --q2-text: #f2f2f3;
  --q2-text-strong: #ffffff;
  --q2-text-muted: #9a9aa0;
  --q2-text-inverse: #111111;

  --q2-border-ring: rgba(255, 255, 255, 0.1);
  --q2-border-strong: rgba(255, 255, 255, 0.18);
  --q2-divider: rgba(255, 255, 255, 0.08);

  --q2-shadow-card:
    rgba(0, 0, 0, 0.85) 0 1px 5px -4px, rgba(255, 255, 255, 0.1) 0 0 0 1px,
    rgba(0, 0, 0, 0.55) 0 4px 12px 0;
  --q2-shadow-raised:
    rgba(0, 0, 0, 0.85) 0 1px 5px -4px, rgba(255, 255, 255, 0.14) 0 0 0 1px,
    rgba(0, 0, 0, 0.65) 0 14px 32px -8px;
  --q2-shadow-dropdown:
    rgba(0, 0, 0, 0.85) 0 1px 5px -4px, rgba(255, 255, 255, 0.14) 0 0 0 1px,
    rgba(0, 0, 0, 0.75) 0 16px 32px -12px;
  --q2-shadow-inset: inset 0 1px 1.9px rgba(0, 0, 0, 0.5);

  --q2-nav-bg: rgba(8, 9, 11, 0.82);
  --q2-nav-border: rgba(255, 255, 255, 0.08);
  --q2-focus-ring: rgba(96, 165, 250, 0.45);
}

/* ---------- 3. BASE RESET ---------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  background-color: var(--q2-bg);
  color: var(--q2-text);
  color-scheme: light dark;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-weight: 400;
  color: var(--q2-text);
  background-color: var(--q2-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#page-wrapper {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

/* ---------- 4. CONTAINER ---------- */
.container {
  max-width: 1250px;
  width: 100%;
  margin-inline: auto;
  padding-inline: clamp(1rem, 3.5vw, 2.5rem);
}

/* ---------- 5. HEADER & NAVBAR ---------- */
#header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--q2-nav-bg);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--q2-nav-border);
  transition: background 0.25s ease, border-color 0.25s ease;
}

#header .navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--q2-header-height);
  gap: 1.5rem;
}

.navbar-section {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.navbar-section.logo {
  flex: 0 0 auto;
}

.navbar-section.nav-center {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.25rem;
}

.navbar-section.actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--q2-text-strong);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  transition: opacity 0.2s ease;
}

.navbar-brand:hover {
  opacity: 0.85;
}

.navbar-brand svg,
.navbar-brand img {
  height: 28px;
  width: auto;
  display: block;
}

.navbar-brand svg,
.navbar-brand svg * {
  fill: var(--q2-text-strong);
  transition: fill 0.25s ease;
}

/* Przycisk powrotu do poprzedniej strony w nagłówku */
.btn-back-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 1.15rem;
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-border-strong);
  border-radius: var(--q2-radius-pill);
  color: var(--q2-text-strong);
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: var(--q2-shadow-card);
  transition: all 0.2s ease;
  cursor: pointer;
  user-select: none;
}

.btn-back-nav:hover {
  background: var(--q2-bg-muted);
  color: var(--q2-text-strong);
  border-color: var(--q2-text-muted);
  transform: translateX(-2px);
  box-shadow: var(--q2-shadow-raised);
}

.btn-back-nav svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2.2;
  transition: transform 0.2s ease;
}

.btn-back-nav:hover svg {
  transform: translateX(-3px);
}

/* Theme Toggle */
button.theme-toggle,
.theme-toggle {
  --size: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size);
  height: var(--size);
  border: 1px solid var(--q2-border-ring);
  border-radius: var(--q2-radius-pill);
  background: var(--q2-bg-elev);
  color: var(--q2-text-strong);
  cursor: pointer;
  box-shadow: var(--q2-shadow-card);
  transition: all 0.2s ease;
  padding: 0;
  margin: 0;
}

button.theme-toggle:hover,
.theme-toggle:hover {
  background: var(--q2-bg-muted);
  border-color: var(--q2-border-strong);
  transform: scale(1.05);
}

button.theme-toggle:focus-visible,
.theme-toggle:focus-visible {
  outline: 2px solid var(--q2-focus-ring);
  outline-offset: 2px;
}

.theme-toggle .icon {
  width: 18px;
  height: 18px;
  display: none;
  font-size: 16px;
  line-height: 1;
}

:root[data-theme-preference="light"] .theme-toggle .icon-sun,
:root:not([data-theme-preference]) .theme-toggle .icon-auto,
:root[data-theme-preference="auto"] .theme-toggle .icon-auto {
  display: block;
}

:root[data-theme-preference="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- 6. TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5, h6, .display {
  font-family: var(--font-display);
  color: var(--q2-text-strong);
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin-top: 0;
}

h1 {
  font-size: clamp(2.2rem, 4vw + 1rem, 3.4rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.5rem, 2.5vw, 2.1rem);
  font-weight: 700;
  position: relative;
}

h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 2px;
  background: var(--q2-text-strong);
  margin-bottom: 0.65rem;
  opacity: 0.9;
}

h3 {
  font-size: clamp(1.25rem, 1.8vw, 1.55rem);
  font-weight: 600;
}

h4 {
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--q2-text-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: opacity 0.2s ease, color 0.2s ease;
}

a:hover {
  color: var(--q2-accent);
}

/* ---------- 7. FOOTER ---------- */
#footer {
  border-top: 1px solid var(--q2-divider);
  padding: 2rem 0;
  margin-top: 4rem;
  background: var(--q2-bg);
  color: var(--q2-text-muted);
  font-size: 0.88rem;
  text-align: center;
}

#footer p {
  margin: 0;
}

/* ---------- 8. FORMS, BUTTONS & CARDS (QUARK 2) ---------- */
input[type="text"],
input[type="password"],
select,
textarea {
  width: 100%;
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-border-strong);
  color: var(--q2-text);
  border-radius: var(--q2-radius);
  padding: 0.65rem 0.95rem;
  font-family: var(--font-sans);
  font-size: 0.92rem;
  outline: none;
  box-shadow: var(--q2-shadow-inset);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--q2-accent);
  box-shadow: 0 0 0 3px var(--q2-focus-ring);
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--q2-text-muted);
  margin-bottom: 0.35rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

button,
.btn,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  background: var(--q2-text-strong);
  color: var(--q2-text-inverse);
  border: 1px solid var(--q2-text-strong);
  border-radius: var(--q2-radius);
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s ease, transform 0.15s ease, background 0.2s ease;
  box-shadow: var(--q2-shadow-card);
}

button:hover,
.btn:hover,
input[type="submit"]:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-toggle {
  background: transparent;
  color: var(--q2-text-strong);
  border: 1px solid var(--q2-border-strong);
}

.btn-toggle:hover {
  background: var(--q2-bg-muted);
}

.admin-form {
  background: var(--q2-bg-elev);
  border: 1px solid var(--q2-border-ring);
  border-radius: var(--q2-radius-lg);
  box-shadow: var(--q2-shadow-card);
  padding: 2rem;
  margin-bottom: 2rem;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--q2-divider);
}



