---
import { SITE_TITLE, SITE_TAGLINE, MAIN_NAV } from '../consts';
---

<header class="site-header">
  <div class="hero">
    <div class="hero-overlay"></div>
    <div class="container hero-inner">
      <a class="brand" href="/">
        <h1 class="site-title">{SITE_TITLE}</h1>
        <p class="site-tagline">{SITE_TAGLINE}</p>
      </a>
      <a class="rss-link" href="/feed.xml" title="RSS-фид">RSS</a>
    </div>
  </div>
  <nav class="site-nav">
    <div class="container nav-inner">
      {MAIN_NAV.map((item) => (
        <a
          href={item.href}
          target={item.external ? '_blank' : undefined}
          rel={item.external ? 'noopener noreferrer' : undefined}
          class="nav-link"
          data-active={(Astro.url.pathname === item.href || (item.href !== '/' && Astro.url.pathname.startsWith(item.href)))}
        >{item.label}</a>
      ))}
    </div>
  </nav>
</header>

<style>
  .site-header {
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
  }
  .hero {
    position: relative;
    isolation: isolate;
    background-image: url('/uploads/IMG_2156.jpg');
    background-size: cover;
    background-position: center 60%;
    background-color: var(--paper-deep);
    overflow: hidden;
  }
  .hero-overlay {
    position: absolute;
    inset: 0;
    background:
      linear-gradient(180deg, rgba(244,236,219,0.55) 0%, rgba(244,236,219,0.7) 80%, rgba(244,236,219,0.85) 100%),
      linear-gradient(0deg, rgba(74, 53, 25, 0.3), rgba(74, 53, 25, 0.15));
    z-index: -1;
  }
  .hero-inner {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 3rem;
    padding-bottom: 3rem;
    min-height: 180px;
  }
  @media (max-width: 600px) {
    .hero-inner { padding-top: 2rem; padding-bottom: 2rem; min-height: 140px; }
  }
  .brand { color: var(--ink); text-decoration: none; }
  .brand:hover { text-decoration: none; }
  .site-title {
    font-family: var(--font-serif);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    line-height: 1.1;
    color: var(--ink);
    letter-spacing: -0.01em;
    text-shadow: 0 1px 0 rgba(244, 236, 219, 0.7);
  }
  .site-tagline {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(0.9rem, 1.5vw, 1.05rem);
    color: var(--ink-soft);
    margin: 0.3rem 0 0;
    text-shadow: 0 1px 0 rgba(244, 236, 219, 0.6);
  }
  .rss-link {
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ink-soft);
    text-decoration: none;
    padding: 0.3rem 0.5rem;
    border: 1px solid var(--rule-strong);
    background: rgba(244,236,219,0.7);
  }
  .rss-link:hover { color: var(--accent); border-color: var(--accent); }
  .site-nav { border-top: 1px solid var(--rule); background: var(--paper); }
  .nav-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 2.25rem;
    padding-top: 0.7rem;
    padding-bottom: 0.7rem;
  }
  @media (max-width: 600px) {
    .nav-inner { gap: 0.5rem 1.25rem; }
  }
  .nav-link {
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
  }
  .nav-link:hover { color: var(--accent); border-bottom-color: var(--accent-soft); }
  .nav-link[data-active="true"] {
    color: var(--accent);
    border-bottom-color: var(--accent);
  }
</style>
