/* ==========================================================================
   MALIK FEST — stylesheet
   Design concept: an illuminated chronicle / village almanac. Warm aged
   paper, deep forest and oxblood ink, a carved-stone gold for accents.
   Structural devices (rules, drop caps, marginal numerals) come from
   manuscript pages, not from generic SaaS card kits.
   ========================================================================== */

:root{
  --paper: #EDE3CE;
  --paper-light: #F6F0E1;
  --paper-deep: #E1D4B4;
  --ink: #241C15;
  --ink-soft: #4A4037;
  --forest: #3E5442;
  --forest-deep: #2B3C31;
  --wine: #6E2A2A;
  --wine-deep: #4F1E1E;
  --gold: #A9863A;
  --gold-bright: #C9A24B;
  --stone: #8C8577;
  --rule: rgba(36, 28, 21, 0.18);

  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --font-label: "Fraunces", Georgia, serif;

  --max-width: 920px;
  --edge: clamp(1.25rem, 4vw, 3rem);
}

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

html{ scroll-behavior: smooth; }

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

body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* subtle paper grain, no imagery required */
body{
  background-image:
    radial-gradient(circle at 20% 10%, rgba(255,255,255,0.35), transparent 40%),
    radial-gradient(circle at 80% 60%, rgba(0,0,0,0.04), transparent 45%);
  background-attachment: fixed;
}

img{ max-width: 100%; display: block; }

a{ color: var(--wine); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover{ color: var(--wine-deep); }

h1, h2, h3, h4{
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.15;
}

.container{
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--edge);
  padding-right: var(--edge);
}

/* ---------- skip link / focus ---------- */
.skip-link{
  position: absolute; left: -999px; top: 0;
  background: var(--ink); color: var(--paper-light);
  padding: 0.75em 1.2em; z-index: 200;
}
.skip-link:focus{ left: var(--edge); top: var(--edge); }

:focus-visible{
  outline: 2px solid var(--wine);
  outline-offset: 3px;
}

img[data-src]{ display: none; }
img[data-src].is-loaded{ display: block; }

.sr-only{
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- header ---------- */
.site-header{
  position: sticky; top: 0; z-index: 100;
  background: rgba(237, 227, 206, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.site-header .container{
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem;
  padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.brand{
  display: flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand:hover{ color: var(--ink); }
.brand img{ height: 40px; width: auto; }
.brand .brand-mark{
  width: 34px; height: 34px; flex: none;
}

.site-nav{
  display: flex; gap: 1.4rem;
  font-family: var(--font-label);
  font-size: 0.95rem;
}
.site-nav a{
  color: var(--ink-soft);
  text-decoration: none;
  padding: 0.2em 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover{ color: var(--wine); border-bottom-color: var(--wine); }

.nav-toggle{
  display: none;
  background: none; border: 1px solid var(--ink); color: var(--ink);
  font-family: var(--font-label); font-size: 0.9rem;
  padding: 0.4em 0.8em; cursor: pointer;
}

@media (max-width: 760px){
  .site-nav{
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; gap: 0;
    background: var(--paper-light);
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem var(--edge) 1rem;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .site-nav.is-open{
    opacity: 1; transform: translateY(0); pointer-events: auto;
  }
  .site-nav a{ padding: 0.7em 0; border-bottom: 1px solid var(--rule); }
  .nav-toggle{ display: inline-block; }
}

/* ---------- hero ---------- */
.hero{
  position: relative;
  min-height: min(92vh, 780px);
  display: flex; align-items: flex-end;
  overflow: hidden;
  color: var(--paper-light);
  background: linear-gradient(180deg, var(--forest-deep) 0%, var(--forest) 55%, var(--wine-deep) 130%);
}

.hero-media{
  position: absolute; inset: 0;
}

.hero-photo{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: center 35%;
  display: none; /* shown via JS only if the photo actually loads */
}

.hero-illustration{
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}

.hero::after{
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,16,11,0.05) 0%, rgba(20,16,11,0.75) 92%);
  pointer-events: none;
}

.hero-content{
  position: relative; z-index: 2;
  width: 100%;
  padding: 3rem var(--edge) 3.5rem;
}

.hero-eyebrow{
  font-family: var(--font-label);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  margin-bottom: 0.8rem;
}

.hero h1{
  color: var(--paper-light);
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  max-width: 14ch;
  margin-bottom: 0.35em;
}

.hero-lede{
  max-width: 46ch;
  font-size: 1.15rem;
  color: rgba(246,240,225,0.92);
  margin-bottom: 1.6rem;
}

.hero-meta{
  display: flex; flex-wrap: wrap; gap: 1.6rem 2.4rem;
  margin-bottom: 2rem;
  font-family: var(--font-label);
}
.hero-meta dt{
  font-size: 0.78rem; letter-spacing: 0.03em;
  color: var(--gold-bright);
  margin-bottom: 0.2em;
}
.hero-meta dd{
  margin: 0; font-size: 1.1rem; color: var(--paper-light);
}

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

@media (max-width: 760px){
  /* Na mobitelu (uspravno) slika i tekst više se ne preklapaju: slika
     dobiva vlastiti prostor u točnom omjeru (bez rezanja), a naslovni
     tekst i gumbi slažu se ispod nje kao normalan sadržaj stranice. */
  .hero{
    flex-direction: column;
    align-items: stretch;
    min-height: 0;
    background: var(--forest-deep);
  }
  .hero-media{
    position: relative;
    inset: auto;
    width: 100%;
    aspect-ratio: 886 / 1575; /* omjer mobilne naslovne slike */
  }
  .hero::after{
    content: none; /* nepotrebno kad tekst više nije preko slike */
  }
  .hero-content{
    position: static;
    padding: 2rem var(--edge) 2.5rem;
  }
}

.btn{
  display: inline-block;
  font-family: var(--font-label);
  font-size: 1rem;
  padding: 0.75em 1.5em;
  border: 1px solid currentColor;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.btn-primary{
  background: var(--gold-bright); color: var(--ink); border-color: var(--gold-bright);
}
.btn-primary:hover{ background: var(--gold); color: var(--ink); }
.btn-ghost{
  color: var(--paper-light); border-color: rgba(246,240,225,0.6);
}
.btn-ghost:hover{ background: rgba(246,240,225,0.12); color: var(--paper-light); }

/* ---------- sections generally ---------- */
section{ padding: clamp(3.5rem, 8vw, 6rem) 0; }

.section-head{
  max-width: 62ch;
  margin-bottom: 2.4rem;
}
.section-number{
  font-family: var(--font-label);
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}
.section-head h2{ font-size: clamp(1.8rem, 3.4vw, 2.5rem); }
.section-head p{ color: var(--ink-soft); }

hr.rule{
  border: none; border-top: 1px solid var(--rule);
  margin: 0;
}

/* drop cap on the intro paragraph */
.lede-drop::first-letter{
  font-family: var(--font-display);
  font-size: 3.6em;
  float: left;
  line-height: 0.8;
  padding-right: 0.08em;
  padding-top: 0.05em;
  color: var(--wine);
}

.prose p + p{ margin-top: 1em; }
.prose{ max-width: 68ch; }

.pull-figures{
  display: flex; flex-wrap: wrap; gap: 2.5rem 3rem;
  margin-top: 2.2rem;
}
.pull-figures div{ min-width: 9rem; }
.pull-figures .num{
  font-family: var(--font-display); font-size: 2.1rem; color: var(--forest);
  display: block;
}
.pull-figures .label{ font-family: var(--font-label); color: var(--ink-soft); font-size: 0.95rem; }

/* alternate section tone */
.section-tinted{
  background: var(--paper-deep);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.section-dark{
  background: var(--forest-deep);
  color: var(--paper-light);
}
.section-dark .section-head p{ color: rgba(246,240,225,0.8); }
.section-dark h2{ color: var(--paper-light); }

.feature-photo{
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  margin: 2.2rem 0 0.6rem;
  border: 1px solid var(--rule);
}
.feature-caption{
  font-size: 0.85rem;
  color: var(--stone);
  margin: 0 0 2rem;
}

/* ---------- legends ---------- */
.legend-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.legend-card{
  background: var(--paper-light);
  padding: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.legend-card .legend-photo{
  width: 100%; aspect-ratio: 4/3; object-fit: cover; display: none;
}
.legend-card .legend-photo.is-loaded{ display: block; }
.legend-card .legend-body{
  padding: 1.9rem 1.7rem;
  display: flex; flex-direction: column; gap: 0.7rem;
}
.legend-card .glyph{
  width: 42px; height: 42px;
  color: var(--wine);
}
.legend-card h3{ font-size: 1.25rem; margin-bottom: 0.1em; }
.legend-card p{ color: var(--ink-soft); font-size: 0.98rem; }

/* ---------- program timeline ---------- */
.day-tabs{
  display: flex; gap: 0.6rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.day-tab{
  font-family: var(--font-label);
  font-size: 1.05rem;
  background: none; border: none;
  padding: 0.7em 0.2em;
  margin-right: 1.6rem;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  position: relative; top: 1px;
}
.day-tab[aria-selected="true"]{
  color: var(--wine);
  border-bottom-color: var(--wine);
}

.timeline{ list-style: none; margin: 0; padding: 0; }
.timeline[hidden]{ display: none; }
.timeline li{
  display: grid;
  grid-template-columns: 5.2rem 1fr;
  gap: 1.2rem;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--rule);
}
.timeline li:first-child{ border-top: 1px solid var(--rule); }
.timeline time{
  font-family: var(--font-label);
  color: var(--wine);
  font-size: 0.98rem;
  padding-top: 0.15em;
}
.timeline .event-title{ font-weight: 600; }
.timeline .event-note{ color: var(--ink-soft); font-size: 0.93rem; margin-top: 0.15em; }

/* ---------- participants ---------- */
.participants{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0 2rem;
}
.participants li{
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-label);
}
.participants .country{
  display: block; color: var(--stone); font-size: 0.82rem;
}

.sponsor-row{
  margin-top: 2.5rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-label);
/*  color: var(--ink-soft);*/
}
.sponsor-row span{ display: block; font-size: 0.85rem; letter-spacing: 0.02em; margin-bottom: 0.5em; color: var(--gold); }

/* ---------- gallery ---------- */
.gallery-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.gallery-grid figure{
  margin: 0;
  aspect-ratio: 4 / 3;
  background: var(--paper-deep);
  overflow: hidden;
  position: relative;
}
.gallery-grid img{
  width: 100%; height: 100%; object-fit: cover;
  display: none;
}
.gallery-grid img.is-loaded{ display: block; }
.gallery-grid figure:not(:has(img.is-loaded))::before{
  content: "";
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(135deg, rgba(36,28,21,0.05) 0 12px, transparent 12px 24px);
}
@media (max-width: 640px){
  .gallery-grid{ grid-template-columns: repeat(2, 1fr); }
}

/* ---------- location ---------- */
.location-wrap{
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 2.5rem;
  align-items: start;
}
@media (max-width: 760px){
  .location-wrap{ grid-template-columns: 1fr; }
}
.map-frame{
  border: 1px solid var(--rule);
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.map-frame iframe{ width: 100%; height: 100%; border: 0; }
.location-list{ list-style: none; margin: 1.5rem 0 0; padding: 0; }
.location-list li{ padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.location-list dt{ font-family: var(--font-label); color: var(--gold); font-size: 0.82rem; }

/* ---------- footer ---------- */
.site-footer{
  background: var(--ink);
  color: rgba(246,240,225,0.85);
  padding: 3rem 0 2rem;
}
.footer-grid{
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}
@media (max-width: 640px){
  .footer-grid{ grid-template-columns: 1fr; }
}
.site-footer h4{
  color: var(--gold-bright);
  font-size: 1rem;
  margin-bottom: 0.7em;
}
.site-footer a{ color: rgba(246,240,225,0.85); }
.site-footer a:hover{ color: var(--gold-bright); }
.footer-logos{ display: flex; gap: 1.2rem; align-items: center; margin-bottom: 1rem; }
.footer-logos img{ height: 34px; width: auto; filter: brightness(0) invert(1); opacity: 0.85; }
.footer-bottom{
  border-top: 1px solid rgba(246,240,225,0.15);
  padding-top: 1.2rem;
  font-size: 0.85rem;
  color: rgba(246,240,225,0.55);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.6rem;
}

/* ---------- language switcher ---------- */
.site-nav a.lang-current{
  color: var(--ink);
  border-bottom-color: var(--gold);
}
