/* ============================================================
   janol.pl — dziennik inżynierski
   Motyw: ciepła, ciemna typografia edytorska
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,400;0,9..144,600;0,9..144,900;1,9..144,500;1,9..144,900&family=Spectral:ital,wght@0,300;0,400;0,500;0,600;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg:        #17140f;
  --bg-raised: #201b14;
  --bg-code:   #100d09;
  --ink:       #ece4d4;
  --ink-dim:   #a2957e;
  --ink-faint: #6b6252;
  --accent:    #e8a13c;
  --accent-2:  #86a897;
  --danger:    #d9765a;
  --rule:      rgba(236, 228, 212, 0.12);
  --rule-soft: rgba(236, 228, 212, 0.06);

  --display: 'Fraunces', Georgia, serif;
  --body:    'Spectral', Georgia, serif;
  --mono:    'IBM Plex Mono', ui-monospace, monospace;

  --measure: 68ch;
  --gutter: clamp(1.25rem, 5vw, 4rem);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-weight: 400;
  font-size: clamp(1.02rem, 0.6vw + 0.9rem, 1.16rem);
  line-height: 1.7;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* grain + atmosferyczny blask */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.4'/%3E%3C/svg%3E");
  opacity: 0.035;
  mix-blend-mode: screen;
}
body::after {
  content: "";
  position: fixed;
  top: -20vh; left: 50%;
  width: 120vw; height: 80vh;
  transform: translateX(-50%);
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(60% 60% at 50% 0%, rgba(232,161,60,0.10), transparent 70%);
}

.wrap { position: relative; z-index: 1; }

::selection { background: var(--accent); color: #17140f; }

/* ---------- Typografia ---------- */
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.08; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }

/* ---------- Nagłówek strony ---------- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1.6rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.2);
  z-index: 20;
}
.brand {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 0.5ch;
}
.brand .blink { color: var(--accent); animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.nav { display: flex; gap: 1.6rem; font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em; text-transform: uppercase; }
.nav a { color: var(--ink-dim); position: relative; padding-bottom: 2px; transition: color 0.25s; }
.nav a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 1px; width: 0;
  background: var(--accent); transition: width 0.3s ease;
}
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav a:hover::after, .nav a[aria-current="page"]::after { width: 100%; }

/* ---------- Hero ---------- */
.hero { padding: clamp(4rem, 14vh, 9rem) var(--gutter) clamp(3rem, 8vh, 5rem); max-width: 1180px; }
.hero .eyebrow {
  font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 1.5rem;
}
.hero h1 {
  font-weight: 900;
  font-size: clamp(2.9rem, 9vw, 7.5rem);
  line-height: 0.95;
  max-width: 15ch;
  font-optical-sizing: auto;
}
.hero h1 em { font-style: italic; font-weight: 500; color: var(--accent); }
.hero .lede {
  margin-top: 2rem; max-width: 46ch; font-size: clamp(1.1rem, 1.4vw, 1.35rem);
  color: var(--ink-dim); font-weight: 300;
}

/* wjazd */
.rise { opacity: 0; transform: translateY(18px); animation: rise 0.9s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }
.d1 { animation-delay: .05s } .d2 { animation-delay: .16s } .d3 { animation-delay: .28s } .d4 { animation-delay: .40s }

/* ---------- Indeks wpisów ---------- */
.section-label {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--ink-faint); padding: 0 var(--gutter); margin-bottom: 0.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.index { max-width: 1180px; padding: 0 var(--gutter) 5rem; }
.entry {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: clamp(1rem, 4vw, 3rem);
  padding: 2.4rem 0;
  border-bottom: 1px solid var(--rule);
  align-items: start;
  transition: background 0.3s;
}
.entry:hover { background: var(--rule-soft); }
.entry .idx { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); padding-top: 0.6rem; }
.entry .meta { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.06em; color: var(--ink-faint); text-transform: uppercase; margin-bottom: 0.7rem; display: flex; gap: 1rem; flex-wrap: wrap; }
.entry h2 { font-size: clamp(1.7rem, 3.6vw, 2.9rem); font-weight: 600; letter-spacing: -0.015em; transition: color 0.25s; }
.entry:hover h2 { color: var(--accent); }
.entry .excerpt { margin-top: 0.8rem; color: var(--ink-dim); max-width: 60ch; font-weight: 300; }
.entry .tags { margin-top: 1.1rem; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.tag {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--accent-2); border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent);
  padding: 0.2rem 0.6rem; border-radius: 2px;
}
.entry .arrow { color: var(--accent); transition: transform 0.3s; display: inline-block; }
.entry:hover .arrow { transform: translateX(6px); }

/* ---------- Artykuł ---------- */
.article { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 9vh, 6rem) var(--gutter) 2rem; }
.article-head { margin-bottom: 3rem; }
.article-head .kicker { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.article-head h1 { font-size: clamp(2.2rem, 6vw, 4.2rem); font-weight: 900; margin: 1.2rem 0 1.4rem; line-height: 1; }
.article-head .byline { font-family: var(--mono); font-size: 0.8rem; color: var(--ink-faint); display: flex; gap: 1.2rem; flex-wrap: wrap; letter-spacing: 0.04em; }

.prose { font-size: 1.14rem; }
.prose > p, .prose > ul, .prose > ol, .prose > blockquote, .prose > figure, .prose > pre, .prose > h2, .prose > h3 { margin-bottom: 1.5rem; }
.prose h2 { font-size: 1.9rem; margin-top: 3rem; margin-bottom: 1rem; }
.prose h3 { font-size: 1.4rem; margin-top: 2.2rem; margin-bottom: 0.8rem; color: var(--ink); }
.prose p { color: #ded6c6; }
.prose a[href] { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); transition: text-decoration-color 0.2s; }
.prose a[href]:hover { text-decoration-color: var(--accent); }

/* inicjał */
.prose > p:first-of-type::first-letter {
  font-family: var(--display); font-weight: 900; font-size: 4.2rem;
  float: left; line-height: 0.78; padding: 0.35rem 0.7rem 0 0; color: var(--accent);
}

.prose ul, .prose ol { padding-left: 1.4rem; color: #ded6c6; }
.prose li { margin-bottom: 0.5rem; }
.prose li::marker { color: var(--accent); }

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.5rem;
  font-style: italic; font-size: 1.25rem; color: var(--ink);
  font-family: var(--display); font-weight: 400;
}

.prose code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--bg-code); border: 1px solid var(--rule);
  padding: 0.12em 0.42em; border-radius: 3px; color: var(--accent);
}
.prose pre {
  background: var(--bg-code); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1.3rem 1.4rem; overflow-x: auto; font-size: 0.86rem; line-height: 1.6;
  position: relative;
}
.prose pre code { background: none; border: none; padding: 0; color: #d6cdbb; font-size: inherit; }
.prose pre::before {
  content: attr(data-lang);
  position: absolute; top: 0; right: 0;
  font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-faint); background: var(--rule-soft);
  padding: 0.25rem 0.7rem; border-bottom-left-radius: 6px;
}
/* podświetlenie składni (klasy) */
.tok-c { color: var(--ink-faint); font-style: italic; }
.tok-k { color: var(--accent); }
.tok-s { color: var(--accent-2); }
.tok-n { color: #cbbf74; }

.callout {
  background: var(--bg-raised); border: 1px solid var(--rule); border-left: 3px solid var(--accent-2);
  border-radius: 6px; padding: 1.1rem 1.3rem; margin-bottom: 1.5rem;
  font-size: 1rem; color: var(--ink-dim);
}
.callout strong { color: var(--accent-2); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 0.4rem; }

hr.divider { border: none; height: 1px; background: var(--rule); margin: 3rem 0; }

/* podpis / stopka artykułu */
.article-foot { max-width: var(--measure); margin: 3rem auto 0; padding: 2rem var(--gutter) 0; border-top: 1px solid var(--rule); }
.article-foot .back { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-dim); transition: color 0.2s; }
.article-foot .back:hover { color: var(--accent); }

/* ---------- Sekcja "o mnie" ---------- */
.page { max-width: var(--measure); margin: 0 auto; padding: clamp(3rem, 9vh, 6rem) var(--gutter) 4rem; }
.page h1 { font-size: clamp(2.4rem, 7vw, 4.5rem); font-weight: 900; margin-bottom: 2rem; }
.page .prose { font-size: 1.14rem; }
.stack { display: flex; flex-wrap: wrap; gap: 0.6rem; margin: 1.5rem 0 2.5rem; }
.stack .chip { font-family: var(--mono); font-size: 0.76rem; padding: 0.35rem 0.75rem; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink-dim); background: var(--bg-raised); }

/* ---------- Stopka ---------- */
.site-foot {
  border-top: 1px solid var(--rule);
  padding: 3rem var(--gutter);
  display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 0.78rem; color: var(--ink-faint); letter-spacing: 0.04em;
}
.site-foot a { color: var(--ink-dim); transition: color 0.2s; }
.site-foot a:hover { color: var(--accent); }
.site-foot .dot { color: var(--accent); }

/* ---------- Responsywność ---------- */
@media (max-width: 620px) {
  .entry { grid-template-columns: 1fr; gap: 0.4rem; }
  .entry .idx { padding-top: 0; }
  .masthead { position: static; }
  .prose > p:first-of-type::first-letter { font-size: 3.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .rise { opacity: 1; transform: none; }
}
