/* ==========================================================================
   mati-it.pl — strona startowa
   Ciemny, „szklany” motyw spójny z hub.mati-it.pl. Bez zewnętrznych zależności.
   ========================================================================== */

:root {
  --bg: #06080f;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, .055), rgba(255, 255, 255, .018));
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #eef1fb;
  --muted: #9aa4bb;
  --accent: #8b7bff;
  --accent-2: #4cd7e8;
  --topbar-bg: rgba(6, 8, 15, .74);
  --footer-bg: rgba(0, 0, 0, .16);
  --grid-line: rgba(255, 255, 255, .022);
  --radius: 22px;
  --radius-sm: 13px;
  --shadow: 0 32px 80px -34px rgba(0, 0, 0, .85);
  --font: "Segoe UI", system-ui, -apple-system, "Inter", Roboto, "Helvetica Neue", Arial, sans-serif;
  --maxw: 1120px;
  --header-h: 70px;
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f3f4f9;
  --card-bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #eef0f7;
  --border: rgba(15, 23, 42, .1);
  --border-strong: rgba(15, 23, 42, .18);
  --text: #0e1327;
  --muted: #56607a;
  --accent: #5b4cf0;
  --accent-2: #0891b2;
  --topbar-bg: rgba(243, 244, 249, .86);
  --footer-bg: #eceef6;
  --grid-line: rgba(15, 23, 42, .035);
  --shadow: 0 30px 70px -38px rgba(25, 35, 80, .38);
  color-scheme: light;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(900px 520px at 12% -8%, rgba(139, 123, 255, .2), transparent 62%),
    radial-gradient(820px 480px at 96% 0%, rgba(76, 215, 232, .13), transparent 58%),
    radial-gradient(700px 620px at 48% 112%, rgba(184, 243, 91, .055), transparent 64%);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html[data-theme="light"] body {
  background-image:
    radial-gradient(900px 520px at 10% -10%, rgba(91, 76, 240, .13), transparent 62%),
    radial-gradient(820px 480px at 96% 0%, rgba(8, 145, 178, .09), transparent 58%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(75% 55% at 50% 0%, #000 10%, transparent 100%);
  mask-image: radial-gradient(75% 55% at 50% 0%, #000 10%, transparent 100%);
}

main { flex: 1; }

h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
a { color: var(--text); }
button { font: inherit; }
img, svg { max-width: 100%; }
::selection { background: rgba(139, 123, 255, .4); }

.wrap {
  width: min(var(--maxw), calc(100% - 48px));
  margin-inline: auto;
}

.muted { color: var(--muted); }

.skip-link {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 200;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Nagłówek
   -------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--accent);
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 1px;
  font-size: 17px;
  letter-spacing: .01em;
}
.brand-text strong { font-weight: 700; }
.brand-text span { color: var(--muted); font-weight: 600; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.server-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .02em;
}

.server-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(76, 215, 232, .16);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.theme-toggle:hover { background: var(--surface-2); border-color: var(--border-strong); }

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.theme-toggle .i-moon { display: none; }
html[data-theme="light"] .theme-toggle .i-sun { display: none; }
html[data-theme="light"] .theme-toggle .i-moon { display: block; }

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding: clamp(44px, 7vw, 78px) 0 clamp(22px, 3vw, 34px);
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 123, 255, .18);
}

.hero h1 {
  margin-top: 24px;
  font-size: clamp(32px, 6vw, 60px);
  font-weight: 800;
  letter-spacing: -.02em;
}

.grad {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  margin: 20px auto 0;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(15px, 1.6vw, 17px);
}

/* --------------------------------------------------------------------------
   Grupy kafelków
   -------------------------------------------------------------------------- */

.group { padding-bottom: clamp(30px, 5vw, 46px); }

.group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 16px;
  margin-bottom: 18px;
}

.group-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.group-count {
  padding: 1px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .06em;
}

.group-desc {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.app::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(420px 160px at 15% 0%, rgba(139, 123, 255, .16), transparent 70%);
  transition: opacity .25s ease;
}

.app:hover,
.app:focus-visible {
  transform: translateY(-3px);
  border-color: var(--border-strong);
}
.app:hover::after,
.app:focus-visible::after { opacity: 1; }

.app-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--accent);
}

.app-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: var(--muted);
  transition: color .2s ease, transform .2s ease;
}

.app-arrow svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app:hover .app-arrow,
.app:focus-visible .app-arrow {
  color: var(--accent-2);
  transform: translate(2px, -2px);
}

.app h3 {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.app p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.app-url {
  margin-top: auto;
  padding-top: 12px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  letter-spacing: .01em;
}

/* --------------------------------------------------------------------------
   Stopka
   -------------------------------------------------------------------------- */

.footer {
  margin-top: clamp(24px, 5vw, 48px);
  border-top: 1px solid var(--border);
  background: var(--footer-bg);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 22px 0;
  font-size: 13px;
}

.footer-brand strong { font-weight: 700; }

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  transition: color .18s ease;
}
.footer-links a:hover { color: var(--accent-2); }

.footer-copy { color: var(--muted); }

/* --------------------------------------------------------------------------
   Strona 404
   -------------------------------------------------------------------------- */

.center-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.center-card {
  width: min(520px, 100%);
  padding: 40px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  text-align: center;
}

.center-card .code {
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .22em;
}

.center-card h1 {
  margin-top: 12px;
  font-size: clamp(24px, 5vw, 32px);
  font-weight: 800;
  letter-spacing: -.02em;
}

.center-card .lead { margin-top: 12px; }

.btn {
  display: inline-block;
  margin-top: 24px;
  padding: 11px 22px;
  border-radius: 999px;
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  color: #080b14;
  font-weight: 700;
  text-decoration: none;
  transition: transform .18s ease, filter .18s ease;
}
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); }

/* --------------------------------------------------------------------------
   Responsywność i preferencje
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .wrap { width: calc(100% - 32px); }
  .server-pill { display: none; }
  .hero { text-align: left; }
  .lead { margin-inline: 0; }
  .grid { grid-template-columns: 1fr; }
  .app-url { margin-top: 0; padding-top: 4px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

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