/* ============================================================
   hapit.pl - wizytówka · estetyka technicznego "blueprintu"
   ============================================================ */

:root {
  --ink:        #0B1B2B;  /* tło atrament */
  --panel:      #0E2236;  /* panel / karta */
  --panel-2:    #0c1f31;
  --grid:       #173651;  /* linia siatki */
  --line:       #1d3e5a;  /* cienkie linie / obrysy */
  --text:       #E6EDF3;  /* tekst główny */
  --muted:      #8AA2B8;  /* tekst przygaszony */
  --accent:     #3DD6D0;  /* akcent cyan */
  --accent-dim: rgba(61, 214, 208, 0.14);

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body:    "Inter", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "Courier New", monospace;

  --maxw: 1080px;
  --pad: clamp(1.25rem, 5vw, 4rem);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0;
}

::selection {
  background: var(--accent);
  color: var(--ink);
}

/* ---------- siatka blueprintu w tle ---------- */
.blueprint-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-color: var(--ink);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 35%, transparent 100%);
}

/* ---------- layout helpers ---------- */
.site-header,
.hero,
.section,
.rule,
.site-footer {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--pad);
}

/* ---------- header ---------- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.4rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(11, 27, 43, 0.92), rgba(11, 27, 43, 0.0));
  backdrop-filter: blur(4px);
}

.brand {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
}
.brand-mark { color: var(--text); }
.brand-tld  { color: var(--accent); }

.site-nav {
  display: flex;
  gap: clamp(0.9rem, 3vw, 2rem);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}
.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}
.site-nav a:hover,
.site-nav a:focus-visible { color: var(--text); border-color: var(--accent); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(3rem, 12vh, 8rem);
  padding-bottom: clamp(2.5rem, 8vh, 5rem);
}

/* Generatywne "latent flow" - canvas pod treścią hero, maskowany ku krawędziom. */
.hero-flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 1;
  /* Mózg po prawej; miękkie wygaszenie ku lewej (pod tekstem) i ku krawędziom. */
  -webkit-mask-image: radial-gradient(ellipse 78% 96% at 64% 50%, #000 66%, transparent 100%);
          mask-image: radial-gradient(ellipse 78% 96% at 64% 50%, #000 66%, transparent 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.4rem;
}
.eyebrow-sep { color: var(--muted); margin-inline: 0.4em; }

.hero-title {
  font-size: clamp(2.75rem, 8vw, 5.75rem);
  font-weight: 700;
  max-width: 14ch;
  margin-bottom: 1.6rem;
}
.hero-accent {
  display: block;
  color: var(--accent);
}

.hero-sub {
  max-width: 52ch;
  color: var(--muted);
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.3rem);
  margin: 0 0 1.6rem;
}

.hero-prompt {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  color: var(--text);
  margin: 0 0 2.4rem;
  display: flex;
  align-items: center;
  min-height: 1.4em;            /* stała wysokość, by typing nie przesuwał layoutu */
}
.prompt-sign { color: var(--accent); margin-right: 0.6em; flex: none; }
.prompt-text { white-space: pre; }
.caret {
  display: inline-block;
  width: 0.6em;
  height: 1.05em;
  margin-left: 0.15em;
  background: var(--accent);
  transform: translateY(2px);
  animation: blink 1.1s steps(1) infinite;
  flex: none;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  padding: 0.85em 1.4em;
  border: 1px solid var(--line);
  border-radius: 2px;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn-primary {
  background: var(--accent);
  color: var(--ink);
  border-color: var(--accent);
  font-weight: 500;
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: transparent;
  color: var(--accent);
  transform: translateY(-2px);
}
.btn-ghost {
  color: var(--muted);
  background: transparent;
}
.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* ---------- znacznik pomiarowy (rule) ---------- */
.rule {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding-block: clamp(2.5rem, 8vh, 5rem);
}
.rule-tick {
  width: 1px;
  height: 14px;
  background: var(--accent);
  flex: none;
}
.rule-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.rule-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--line), transparent);
}

/* ---------- sections ---------- */
.section { padding-block: clamp(0.5rem, 2vh, 1.5rem); }

/* Kotwice nawigacji nie chowają tytułów pod sticky-headerem. */
:where(#zakres, #realizacje, #kontakt) { scroll-margin-top: 5rem; }

.section-head { max-width: 60ch; margin-bottom: clamp(2rem, 5vh, 3rem); }
.section-title {
  font-size: clamp(1.85rem, 4vw, 3rem);
  margin-bottom: 1rem;
}
.section-lead {
  color: var(--muted);
  margin: 0;
}

/* ---------- scope list ---------- */
.scope-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  border-top: 1px solid var(--line);
}
.scope-list li {
  display: flex;
  gap: clamp(1rem, 4vw, 2.5rem);
  align-items: baseline;
  padding-block: 1.4rem;
  border-bottom: 1px solid var(--line);
  transition: padding-left 0.25s ease;
}
.scope-list li:hover { padding-left: 0.5rem; }
.scope-key {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  flex: none;
  min-width: 3ch;
}
.scope-text { color: var(--text); }

/* ---------- cards ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--line);          /* tworzy hairline-y między kartami */
  border: 1px solid var(--line);
}
.card {
  background: var(--panel);
  padding: clamp(1.5rem, 3vw, 2.2rem);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  position: relative;
  transition: background 0.25s ease, transform 0.25s ease;
}
.card:hover {
  background: var(--panel-2);
}
.card::before {
  /* znacznik narożny jak na rysunku technicznym */
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 12px; height: 12px;
  border-top: 1px solid var(--accent);
  border-left: 1px solid var(--accent);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.card:hover::before { opacity: 1; }
.card-tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.card-title {
  font-size: clamp(1.2rem, 2.2vw, 1.5rem);
  font-weight: 600;
}
.card-desc {
  color: var(--muted);
  font-size: 0.98rem;
  margin: 0;
}

/* ---------- kontakt ---------- */
.section-kontakt {
  padding-block: clamp(3rem, 9vh, 6rem);
  text-align: left;
}
.kontakt-title {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 700;
  margin-bottom: 1.2rem;
}
.kontakt-sub {
  color: var(--muted);
  margin: 0 0 2rem;
  max-width: 46ch;
}
.contact-mail {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: clamp(1.1rem, 3.5vw, 1.9rem);
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-dim);
  padding-bottom: 0.15em;
  transition: border-color 0.2s ease, letter-spacing 0.3s ease;
}
.contact-mail:hover,
.contact-mail:focus-visible {
  border-color: var(--accent);
  letter-spacing: 0.01em;
}

/* ---------- footer ---------- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 2.5rem;
  margin-top: clamp(2rem, 6vh, 4rem);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.footer-brand { color: var(--text); }
.footer-meta { flex: 1; min-width: 14ch; }
.footer-year { color: var(--accent); }

/* ---------- focus visibility ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- reveal (scroll-in) ----------
   Progresywne ulepszanie: ukrywamy elementy TYLKO gdy JS działa
   (klasa .js na <html>). Bez JS / przy błędzie treść jest widoczna. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- responsive ---------- */
@media (max-width: 680px) {
  .cards { grid-template-columns: 1fr; }
  .site-nav { gap: 1rem; }
  .footer-meta { order: 3; flex-basis: 100%; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
  .caret { animation: none; }
}
