/* ===== UltraLuki.pl ===== */
:root {
  --navy: #002544;
  --navy-2: #0A3A63;
  --deep: #001A30;
  --white: #FFFFFF;
  --mist: #EEF2F5;
  --text: #0F2236;
  --muted: #5B6B7A;
  --line: rgba(0, 37, 68, 0.12);
  --line-dark: rgba(255, 255, 255, 0.16);
  --yellow: #F5EC0C;
  --cyan: #68C8DF;
  --red: #EC1B1E;

  --display: "Big Shoulders Display", "Arial Narrow", Impact, sans-serif;
  --body: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;

  --hero-img: url("../img/bg-hero.webp");
  --wrap: 1200px;
  --gutter: clamp(20px, 4vw, 48px);
  --radius: 18px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0; background: var(--white); color: var(--text);
  font-family: var(--body); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: .95; margin: 0; color: var(--navy); }
h2 { font-size: clamp(42px, 6vw, 76px); }
h3 { font-size: 30px; line-height: 1.05; }

/* ===== Header (przezroczysty nad zdjęciem, biały po przewinięciu) ===== */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  transition: background .25s, box-shadow .25s;
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 80px; }
.brand { position: relative; display: block; height: 54px; }
.brand img { height: 54px; width: auto; transition: opacity .25s; }
.brand .logo-dark { position: absolute; inset: 0; opacity: 0; }
.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  text-decoration: none; font-weight: 600; font-size: 15px;
  padding: 9px 16px; border-radius: 999px; color: rgba(255,255,255,.86);
  transition: color .15s, background .15s;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.12); }
.nav a[aria-current="page"] { color: var(--navy); background: var(--yellow); }
.nav-toggle {
  display: none; background: rgba(255,255,255,.12); border: 0; color: #fff;
  border-radius: 999px; padding: 10px 16px; font: 700 15px var(--body); cursor: pointer;
}
.site-header.scrolled { background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--line); }
.site-header.scrolled .logo-light { opacity: 0; }
.site-header.scrolled .logo-dark { opacity: 1; }
.site-header.scrolled .nav a { color: var(--text); }
.site-header.scrolled .nav a:hover { background: var(--mist); }
.site-header.scrolled .nav a[aria-current="page"] { color: var(--navy); background: var(--yellow); }
.site-header.scrolled .nav-toggle { background: var(--mist); color: var(--navy); }

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .nav {
    position: absolute; top: 80px; left: 12px; right: 12px;
    flex-direction: column; align-items: stretch; gap: 2px;
    background: #fff; border-radius: 16px; padding: 10px;
    box-shadow: 0 18px 40px rgba(0, 26, 48, .25);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a, .site-header .nav a { color: var(--text); padding: 12px 14px; font-size: 17px; border-radius: 10px; }
  .brand, .brand img { height: 46px; }
}

/* ===== Zdjęcie w tle (hero) ===== */
.photo-bg {
  position: relative; color: #fff; overflow: hidden;
  background-color: var(--deep);
  background-image:
    linear-gradient(100deg, rgba(0, 26, 48, .92) 0%, rgba(0, 37, 68, .62) 42%, rgba(0, 37, 68, .18) 75%, rgba(0, 37, 68, .35) 100%),
    var(--hero-img);
  background-size: cover; background-position: center 40%;
}
.photo-bg h1, .photo-bg h2 { color: #fff; }

.hero { min-height: min(94vh, 880px); display: flex; flex-direction: column; }
.hero-copy { position: relative; z-index: 2; padding-top: clamp(150px, 22vh, 220px); }
.hero h1 { font-size: clamp(66px, 12vw, 172px); line-height: .86; }
.hero h1 .line { display: block; }
.hero h1 .line:nth-child(2) { color: var(--yellow); }
.hero-lead { max-width: 36ch; margin: 28px 0 0; font-size: clamp(18px, 2vw, 21px); color: rgba(255,255,255,.88); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.hero-trail { position: relative; z-index: 1; margin-top: auto; line-height: 0; }
.hero-trail svg { width: 100%; height: auto; display: block; }
.hero-trail .trail { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 2.6s cubic-bezier(.6,.1,.2,1) .4s forwards; }
.hero-trail .km { opacity: 0; animation: fade .4s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }
@media (max-width: 760px) { .hero-trail svg { height: 170px; } }
@media (prefers-reduced-motion: reduce) {
  .hero-trail .trail { animation: none; stroke-dashoffset: 0; }
  .hero-trail .km { animation: none; opacity: 1; }
  html { scroll-behavior: auto; }
}

.btn {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 700; font-size: 16px; padding: 14px 24px; border-radius: 999px;
  border: 2px solid var(--yellow); background: var(--yellow); color: var(--navy); cursor: pointer;
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(245, 236, 12, .3); }
.btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.55); }
.btn.ghost:hover { border-color: #fff; box-shadow: none; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.outline { background: transparent; color: var(--navy); border-color: var(--line); }
.btn.outline:hover { border-color: var(--navy); box-shadow: none; }

/* ===== Sekcje ===== */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.section.mist { background: var(--mist); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 44px; flex-wrap: wrap; }
.section-head p { max-width: 46ch; color: var(--muted); margin: 0; }
.link-more { color: var(--navy); font-weight: 700; text-decoration: none; border-bottom: 3px solid var(--yellow); padding-bottom: 2px; }

/* O mnie */
.about { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 6vw, 88px); align-items: center; }
.about-text p { font-size: 18px; color: var(--muted); margin: 0 0 18px; max-width: 58ch; }
.about-text p.lead { font-size: 24px; color: var(--text); line-height: 1.45; }
.about-photo {
  position: relative; margin: 0; aspect-ratio: 4 / 5; border-radius: 24px; overflow: hidden;
  background-color: var(--navy); background-image: var(--hero-img); background-size: cover; background-position: 55% center;
}
.about-photo::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, rgba(0,26,48,.85)); }
.about-photo img { width: 100%; height: 100%; object-fit: cover; }
.about-photo figcaption { position: absolute; left: 22px; right: 22px; bottom: 20px; z-index: 1; color: #fff; font-size: 14px; }
.about-photo figcaption code { color: var(--yellow); }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } .about-photo { max-width: 440px; } }

/* Tereny */
.terrains { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; }
.terrain { background: #fff; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.terrain-art { background: var(--navy); height: 110px; padding: 22px 0 0; }
.terrain-art svg { width: 100%; height: 88px; display: block; }
.terrain-body { padding: 22px 22px 26px; }
.terrain h3 { margin-bottom: 8px; }
.terrain p { color: var(--muted); margin: 0; font-size: 16px; }
@media (max-width: 1100px) { .terrains { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .terrains { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .terrains { grid-template-columns: 1fr; } }

/* ===== Karty wpisów ===== */
.posts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; }
@media (max-width: 960px) { .posts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .posts { grid-template-columns: 1fr; } }

.card {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  transition: transform .2s, box-shadow .2s;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 37, 68, .12); }
.card:hover h3 { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 5px; }
.card-art { aspect-ratio: 16 / 9; position: relative; background: var(--navy); overflow: hidden; }
.card-art img { width: 100%; height: 100%; object-fit: cover; }
.card-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card-meta { display: flex; gap: 12px; align-items: center; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.tag { display: inline-block; font-size: 13px; font-weight: 700; padding: 4px 11px; border-radius: 999px; color: var(--navy); background: var(--c, var(--yellow)); text-decoration: none; }
.card h3 { font-size: 30px; }
.card p { margin: 0; color: var(--muted); font-size: 16px; }
.stats { display: flex; flex-wrap: wrap; gap: 20px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--display); font-size: 26px; font-weight: 700; line-height: 1; color: var(--navy); }
.stat span { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* wyróżniony (najnowszy) wpis */
.card.featured { flex-direction: row; grid-column: 1 / -1; }
.card.featured .card-art { aspect-ratio: auto; flex: 1.15; min-height: 380px; }
.card.featured .card-body { flex: 1; padding: clamp(24px, 4vw, 48px); justify-content: center; gap: 16px; }
.card.featured h3 { font-size: clamp(36px, 4vw, 52px); }
.card.featured p { font-size: 18px; }
.card.featured .stats { margin-top: 12px; }
@media (max-width: 820px) { .card.featured { flex-direction: column; } .card.featured .card-art { min-height: 0; aspect-ratio: 16/10; } }

/* ===== Kontakt ===== */
.contact-sec { background: var(--navy); color: #fff; }
.contact { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: end; }
.contact h2 { color: #fff; font-size: clamp(50px, 8vw, 108px); }
.contact-lead { color: rgba(255,255,255,.8); max-width: 44ch; margin: 20px 0 0; font-size: 19px; }
.contact-mail {
  display: inline-block; margin-top: 26px; font-family: var(--display); font-weight: 700;
  font-size: clamp(28px, 4vw, 46px); color: var(--yellow); text-decoration: none;
  border-bottom: 3px solid var(--yellow); word-break: break-all;
}
.socials { display: flex; flex-direction: column; gap: 12px; }
.social {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 22px;
  border: 1px solid var(--line-dark); border-radius: 16px; text-decoration: none; font-weight: 700; font-size: 18px;
  transition: background .15s, border-color .15s;
}
.social:hover { background: rgba(255,255,255,.08); border-color: #fff; }
.social svg { width: 22px; height: 22px; }
@media (max-width: 820px) { .contact { grid-template-columns: 1fr; } }

/* ===== Stopka ===== */
.site-footer { padding: 30px 0 38px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.site-footer img { height: 42px; width: auto; }
.site-footer a { color: var(--muted); }

/* ===== Nagłówek podstron ===== */
.page-head { padding: clamp(140px, 18vw, 200px) 0 clamp(48px, 6vw, 72px); }
.page-head h1 { font-size: clamp(66px, 10vw, 132px); }
.page-head p { color: rgba(255,255,255,.86); max-width: 52ch; margin: 16px 0 0; font-size: 19px; }

/* Blog: filtry */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 36px; }
.chip { text-decoration: none; display: inline-block; font: 600 15px var(--body); color: var(--text); background: #fff; border: 1px solid var(--line); padding: 9px 16px; border-radius: 999px; cursor: pointer; }
.chip:hover { border-color: var(--navy); }
.chip[aria-current="true"] { background: var(--navy); color: #fff; border-color: var(--navy); }
.search { margin-left: auto; min-width: 240px; font: 500 15px var(--body); color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 11px 18px; }
.search:focus { outline: none; border-color: var(--navy); }
@media (max-width: 620px) { .search { margin-left: 0; width: 100%; } }
.empty { color: var(--muted); padding: 48px 0; font-size: 18px; }

/* ===== Pojedynczy wpis ===== */
.post-head { padding: clamp(140px, 17vw, 190px) 0 clamp(40px, 5vw, 64px); }
.post-head.has-cover { background-position: center 30%; }
.post-head .back { color: rgba(255,255,255,.8); text-decoration: none; font-weight: 600; font-size: 15px; }
.post-head .back:hover { color: #fff; }
.post-head h1 { font-size: clamp(48px, 7.5vw, 100px); max-width: 15ch; margin: 22px 0 18px; }
.post-head .card-meta { color: rgba(255,255,255,.8); font-size: 15px; }
.post-stats { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.post-stats .stat { background: rgba(255,255,255,.1); border: 1px solid var(--line-dark); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 14px 18px; border-radius: 14px; }
.post-stats .stat b { color: #fff; font-size: 36px; }
.post-stats .stat span { color: rgba(255,255,255,.75); }
.post-profile { background: var(--navy); line-height: 0; }
.post-profile svg { width: 100%; height: auto; display: block; }

.prose { max-width: 70ch; margin: 0 auto; padding: 60px 0 24px; font-size: 19px; line-height: 1.75; color: #22374B; }
.prose h2 { font-size: 44px; margin: 52px 0 14px; }
.prose h3 { margin: 32px 0 12px; }
.prose p { margin: 0 0 20px; }
.prose a { color: var(--navy-2); text-decoration-color: var(--yellow); text-decoration-thickness: 2px; }
.prose strong { color: var(--navy); }
.prose ul, .prose ol { padding-left: 24px; margin: 0 0 22px; }
.prose li { margin-bottom: 6px; }
.prose li::marker { color: var(--navy); }
.prose img { border-radius: 14px; margin: 0; width: 100%; height: auto; }
.prose p:has(> img) { margin: 32px 0; }
.prose p:has(> img + img) { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.prose p:has(> img + img) img { aspect-ratio: 3 / 4; object-fit: cover; }
.prose blockquote { margin: 0 0 28px; padding: 16px 22px; border-left: 4px solid var(--yellow); background: var(--mist); color: var(--navy); border-radius: 0 12px 12px 0; font-size: 20px; }
.prose blockquote p { margin: 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 40px 0; }
.img-missing {
  display: grid; place-items: center; text-align: center; aspect-ratio: 3 / 2;
  border: 2px dashed var(--line); border-radius: 14px; background: var(--mist);
  color: var(--muted); font-size: 14px; padding: 16px;
}
.img-missing code { color: var(--navy); }

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 78ch; margin: 24px auto 0; padding-bottom: 96px; }
.post-nav a { text-decoration: none; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.post-nav a:hover { border-color: var(--navy); }
.post-nav small { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.post-nav strong { font-family: var(--display); font-size: 24px; line-height: 1.05; display: block; color: var(--navy); }
.post-nav .next { text-align: right; grid-column: 2; }
@media (max-width: 620px) { .post-nav { grid-template-columns: 1fr; } .post-nav .next { grid-column: 1; } }

/* ===== Edytor ===== */
.editor { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding-bottom: 96px; }
@media (max-width: 960px) { .editor { grid-template-columns: 1fr; } }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label { font-weight: 700; font-size: 15px; color: var(--navy); }
.field small { color: var(--muted); font-size: 13px; }
.field input, .field select, .field textarea { font: 500 16px var(--body); color: var(--text); background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.field textarea { min-height: 280px; resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--navy); outline: none; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.output { white-space: pre-wrap; word-break: break-word; background: var(--mist); border: 1px solid var(--line); border-radius: 12px; padding: 16px; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--text); max-height: 340px; overflow: auto; }
.steps { color: var(--muted); padding-left: 20px; }
.steps li { margin-bottom: 6px; }
.steps code { color: var(--navy); background: var(--mist); padding: 1px 5px; border-radius: 4px; }
.toast { color: var(--navy-2); font-weight: 700; margin-left: 12px; }

.prose figure { margin: 32px 0; }
.prose figcaption { margin-top: 10px; font-size: 14px; color: var(--muted); }
/* drzewo po prawej stronie, tekst po lewej */
@media (min-width: 900px) {
  .photo-bg:not(.has-cover):not(.has-banner) { background-size: 100% 100%, 150% auto; background-position: 0 0, 0% 46%; }
}
.post-cover { line-height: 0; max-width: 1100px; margin: 40px auto 0; padding: 0 var(--gutter); }
.post-cover img { display: block; width: auto; max-width: 100%; height: auto; max-height: 80vh; margin: 0 auto; border-radius: 18px; }
@media (max-width: 899px) {
  .photo-bg { background-image: linear-gradient(180deg, rgba(0, 26, 48, .85) 0%, rgba(0, 37, 68, .72) 60%, rgba(0, 37, 68, .45) 100%), var(--hero-img); background-position: center, 62% 40%; }
}

/* ===== Nowoczesne dodatki ===== */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .25s; }

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--yellow); color: var(--navy); padding: 10px 16px; border-radius: 10px; font-weight: 700; }
.skip-link:focus { top: 12px; }

.terrain { text-decoration: none; color: inherit; transition: transform .2s, box-shadow .2s; }
.terrain:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 37, 68, .12); }

.card-art-fallback { position: absolute; inset: 0; }
.card-art-fallback svg { width: 100%; height: 100%; }

.search-form { margin-left: auto; }
.search-form .search { margin-left: 0; }
@media (max-width: 620px) { .search-form { margin-left: 0; width: 100%; } }
.result-info { color: var(--muted); margin: -16px 0 24px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 48px; }
.pagination a { min-width: 44px; height: 44px; display: grid; place-items: center; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; font-weight: 700; }
.pagination a[aria-current="page"] { background: var(--navy); color: #fff; border-color: var(--navy); }

.draft-badge { display: inline-block; margin: 18px 0 0; background: var(--yellow); color: var(--navy); font-weight: 700; padding: 6px 14px; border-radius: 999px; font-size: 14px; }
.reading-time::before { content: "·"; margin-right: 12px; }

.prose .gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 32px 0; }
.prose .gallery img { aspect-ratio: 3 / 4; object-fit: cover; }

.share { max-width: 70ch; margin: 8px auto 0; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 15px; }
.share a, .share button { font: 700 14px var(--body); color: var(--navy); background: var(--mist); border: 0; border-radius: 999px; padding: 8px 16px; text-decoration: none; cursor: pointer; }
.share a:hover, .share button:hover { background: #dfe6ec; }

/* sekcje pojawiają się przy przewijaniu (tylko w przeglądarkach, które to wspierają) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal, .posts > .card, .terrain {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 40%;
    }
    @keyframes rise { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
  }
}

/* baner na górze wpisu (własne zdjęcie zamiast drzewa) */
.post-head.has-banner {
  background-image: linear-gradient(100deg, rgba(0, 26, 48, .88) 0%, rgba(0, 37, 68, .55) 45%, rgba(0, 37, 68, .15) 100%), var(--hero-img);
  background-position: center, center;
  background-size: cover, cover;
  min-height: min(78vh, 720px);
  display: flex; align-items: flex-end;
}
.post-head.has-banner .wrap { width: 100%; }
@media (max-width: 899px) {
  .post-head.has-banner { background-image: linear-gradient(180deg, rgba(0, 26, 48, .55) 0%, rgba(0, 37, 68, .8) 70%, rgba(0, 26, 48, .92) 100%), var(--hero-img); }
}
.prose figure img { max-height: 82vh; width: auto; max-width: 100%; margin: 0 auto; }
.prose figure figcaption { text-align: center; }
.inline-link { color: var(--navy); font-weight: 600; text-decoration-color: var(--yellow); text-decoration-thickness: 3px; text-underline-offset: 3px; }
