/* ============================================
   LIETUVOS PAUKŠČIŲ TAKAS
   Mobile-first, iPhone Safari optimized
   ============================================ */

:root {
  --bg: #0a1628;
  --bg-elevated: #0f1d33;
  --bg-nav: #0a1628;
  --gold: #c9a961;
  --gold-soft: #a8915350;
  --text: #e8e4d8;
  --text-dim: #9a9588;
  --border: #1f3050;

  /* Nav bar aukštis kaip kintamasis - lengva keisti */
  --nav-height: 56px;
}

* {
  box-sizing: border-box;
}

/* Background dažom ant html (ne body), kad uždengtų visą ekraną
   net jei body apribotas max-width: 1200px */
html {
  background:
    radial-gradient(ellipse at 20% 10%, #15294a 0%, transparent 50%),
    radial-gradient(ellipse at 80% 90%, #1a2b4a 0%, transparent 50%),
    var(--bg);
  background-attachment: fixed;
  /* Apsaugo nuo overscroll bounce iOS */
  overscroll-behavior-y: none;
  /* KRITINĖ APSAUGA: jokio horizontalaus overflow */
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: var(--nav-height) 1rem 2rem;
  /* Body fonas - transparent, kad matytųsi html gradients */
  background: transparent;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.65;
  min-height: 100vh;
  min-height: 100dvh;
  /* Ilgi žodžiai/URL'ai laužiami, kad neperaugtų konteinerio */
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Visi vaikai virš fono, IŠSKYRUS nav bar, galaktiką ir statines žvaigždes */
body > *:not(#nav-bar):not(#galaxy):not(#stars-bg) {
  position: relative;
  z-index: 1;
}

/* ============================================
   NAV BAR - mobile-first, iPhone friendly
   ============================================ */

#nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;

  /* Solid background - jokio backdrop-filter, kuris bug'ina iOS */
  background: var(--bg-nav);
  border-bottom: 1px solid var(--border);

  /* Safari iOS: safe area notch'ui */
  padding-top: env(safe-area-inset-top);

  /* GPU acceleration - laiko ant kompozicijos sluoksnio */
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  will-change: transform;
}

#nav-bar-scroll {
  display: flex;
  height: var(--nav-height);
  overflow-x: auto;
  overflow-y: hidden;

  /* Apsaugo nuo scroll chaining į puslapį */
  overscroll-behavior-x: contain;

  /* iOS momentum scroll */
  -webkit-overflow-scrolling: touch;

  scrollbar-width: none;
}

#nav-bar-scroll::-webkit-scrollbar {
  display: none;
}

/* Mygtukai - padding'as ant jų, ne ant konteinerio */
#nav-bar button {
  flex: 0 0 auto;
  height: 100%;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--gold);
  font-family: "Inter", sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0 1rem;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

#nav-bar button:first-child {
  padding-left: 1.25rem;
}

#nav-bar button:last-child {
  border-right: none;
  padding-right: 1.5rem;
}

#nav-bar button:active {
  background: var(--gold);
  color: var(--bg);
}

#nav-bar button.active {
  background: var(--gold);
  color: var(--bg);
}

/* ============================================
   GLOBAL GALAKTIKOS BACKGROUND
   Fixed, centered, sukasi - per visą puslapį
   ============================================ */

/* Statinės žvaigždės - pilno ekrano fonas */
#stars-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  pointer-events: none;
}

#galaxy {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(80vw, 80vh);
  height: min(80vw, 80vh);
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
  /* Apkarpyti viską, kas eina už SVG ribų sukantis */
  overflow: hidden;
}

/* Galaktikos sukimas - vienas transform vienam group'ui (super pigus)
   transform-origin: 0 0 - sukasi apie SVG koordinatės (0,0),
   kuri yra galaktikos centras (viewBox: -500 -500 1000 1000) */
#galaxy-rotation {
  transform-origin: 0 0;
  transform-box: view-box;
  animation: rotate-galaxy 240s linear infinite;
}

@keyframes rotate-galaxy {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  #galaxy-rotation {
    animation: none;
  }
}

/* ============================================
   HEADER
   ============================================ */

header {
  text-align: center;
  padding: 4rem 1rem 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

header h1 {
  position: relative;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.75rem, 7vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--gold);
  margin: 0 0 1rem;
  line-height: 1.15;
}

header h1::after {
  content: "";
  display: block;
  width: 50px;
  height: 1px;
  background: var(--gold);
  margin: 1rem auto 0;
}

header p {
  max-width: 80ch;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: left;
}

/* ============================================
   KATEGORIJA (section)
   ============================================ */

section {
  margin-bottom: 3rem;
  /* Kai jumpinam į kategoriją, paliekam vietos po nav bar'u */
  scroll-margin-top: calc(var(--nav-height) + env(safe-area-inset-top) + 8px);
}

section > h2 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.4rem, 5vw, 2rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  text-align: center;
  margin: 0 0 1.5rem;
  padding-bottom: 0.75rem;
}

section > h2::after {
  content: "✦";
  display: block;
  color: var(--gold);
  font-size: 0.65em;
  margin-top: 0.5rem;
  opacity: 0.6;
}

/* ============================================
   ASMENS KORTELĖ (article)
   ============================================ */

article {
  background: var(--bg-elevated);
  /* Auksinis border'is - pilnas, paprasta, stabilu */
  border: 1px solid var(--gold-soft);
  padding: 1rem;
  margin-bottom: 1.25rem;
  position: relative;
}

article img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  filter: grayscale(20%) brightness(0.95);
  border: 1px solid var(--border);
  margin: 0 0 1rem;
}

article h3 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--gold);
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

[data-aprasymas] {
  color: var(--text-dim);
  font-style: italic;
  font-size: 0.85rem;
  margin: 0 0 0.85rem;
}

article [data-headline] {
  display: block;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.3;
}

[data-bio] {
  margin: 0.5rem 0 0;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 1.6;
}

article a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dotted var(--gold-soft);
  /* Apsauga - jei link tekstas labai ilgas, laužyti */
  overflow-wrap: anywhere;
}

article a:active {
  color: var(--text);
}

hr {
  display: none;
}

::selection {
  background: var(--gold);
  color: var(--bg);
}

/* ============================================
   DESKTOP - column layout
   ============================================ */

@media (min-width: 700px) {
  :root {
    --nav-height: 60px;
  }

  body {
    padding-left: 2rem;
    padding-right: 2rem;
    max-width: 1200px;
    margin-inline: auto;
  }

  header {
    padding: 5rem 0 4rem;
  }

  header p {
    font-size: 0.95rem;
    text-align: center;
  }

  section {
    column-width: 320px;
    column-gap: 2rem;
  }

  section > h2 {
    column-span: all;
    margin-bottom: 2.5rem;
  }

  article {
    break-inside: avoid;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
  }

  article h3 {
    font-size: 1.4rem;
  }
}

@media (min-width: 1100px) {
  section {
    column-width: 340px;
    column-gap: 2.5rem;
  }
}
