/* =====================================================
   Sydney Latvian Society — redesign
   Palette: Latvian crimson #A4343A + white + warm cream
   Type: Playfair Display (display) + Inter (body)
   ===================================================== */

:root {
  /* Spec §4 colour palette (Oct 2026) */
  --c-red: #7A1F2B;          /* tumši bordo — primary */
  --c-red-dark: #5C1620;     /* darker bordeaux for hover/depth */
  --c-red-soft: #B86B72;     /* soft bordeaux tint */
  --c-paper: #FFFFFF;        /* white */
  --c-cream: #F5F5F5;        /* gaiši pelēka — light grey */
  --c-cream-2: #FAFAFA;      /* a touch warmer for alt surfaces */
  --c-ink: #1A1A1A;          /* near-black */
  --c-ink-soft: #333333;     /* tumši pelēka — dark grey */
  --c-ink-mute: #6B6B6B;     /* secondary text */
  --c-line: #E0E0E0;         /* dividers */
  --c-line-soft: #EEEEEE;    /* hairlines */
  --c-amber: #D4A017;        /* dzintara — accent */
  --c-amber-soft: #E8C36A;   /* lighter amber for hover */

  --shadow-card: 0 1px 2px rgba(20,20,20,0.04), 0 8px 24px rgba(20,20,20,0.04);
  --shadow-hover: 0 2px 6px rgba(20,20,20,0.06), 0 24px 48px rgba(20,20,20,0.08);

  --serif: 'Playfair Display', 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --content-max: 1240px;
  --gutter: 32px;
}

/* =====================================================
   ENGLISH MODE — Latvian × Australian blend
   Crimson stays the lead color; eucalyptus + gold join
   as accents so the page breathes "Australia" without
   losing Latvian identity. Toggle via :root[data-lang].
   ===================================================== */
:root[data-lang="en"] {
  /* warmer cream — like dry eucalypt light */
  --c-cream: #FBF6EC;
  --c-line: #E6DFCE;
  /* eucalyptus accents — used sparingly on cards + dividers */
  --c-eucalyptus: #6B8E6F;
  --c-eucalyptus-soft: #A8BFA8;
  --c-eucalyptus-dark: #4A6B4E;
  /* warm gold for the active language pill */
  --c-gold: #B8893A;
  --c-gold-soft: #D4B26A;
  /* crimson unchanged — Latvian identity stays lead */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Defensive: prevent any element from causing a horizontal scrollbar.
     Slb has decorative chrome (flag ribbon, watermark pseudo-elements)
     that occasionally exceed viewport width on very narrow screens. */
  overflow-x: hidden;
}
body {
  font-family: var(--sans);
  color: var(--c-ink);
  background: var(--c-cream);
  line-height: 1.6;
  font-size: 16px;
  font-weight: 400;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: 0; background: none; }

/* ===== Top flag ribbon ===== */
.flag-ribbon {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  z-index: 100;
  display: flex;
  /* Belt-and-braces: prevent this fixed element from causing horizontal
     overflow on narrow viewports when the body's scrollbar reserves space. */
  max-width: 100vw;
  overflow: hidden;
}
.ribbon-red { flex: 1; background: var(--c-red); }
.ribbon-white { flex: 1; background: var(--c-paper); }

/* ===== Navigation ===== */
.nav {
  position: fixed;
  top: 4px;
  left: 0; right: 0;
  z-index: 90;
  padding: 14px 0;
  background: rgba(250, 247, 242, 0.78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, padding 0.3s, background 0.3s;
}
.nav.is-scrolled {
  border-bottom-color: var(--c-line);
  padding: 10px 0;
  background: rgba(250, 247, 242, 0.92);
}
.nav-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-brand { display: flex; align-items: center; gap: 14px; }
.nav-logo { width: 48px; height: 48px; object-fit: contain; transition: transform 0.3s ease; }
.nav-brand:hover .nav-logo { transform: rotate(-3deg); }
.nav-brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.nav-brand-en {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.01em;
}
.nav-brand-lv {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--c-red);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-links {
  display: flex;
  gap: 30px;
  align-items: center;
}
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-ink-soft);
  position: relative;
  padding: 6px 0;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--c-red); }
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 0; height: 1.5px;
  background: var(--c-red);
  transition: width 0.3s ease;
}
.nav-links a:hover::after { width: 100%; }
.nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 12px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s;
}
.nav-burger:hover { background: var(--c-cream); }
.nav-burger:active { background: var(--c-line); }
.nav-burger span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--c-ink);
  transition: transform 0.3s, opacity 0.3s;
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 92vh;
  /* Top padding tuned so the Latvian ornament-strip sits close under the
     fixed nav (~5-10px below it). Previously 180px top padding left a big
     empty band between the nav and the ornament. */
  padding: 80px 0 120px;
  background: var(--c-cream);
  overflow: hidden;
}
/* The ornament strip is the first child of .hero, so its top sits at the
   hero's padding-top edge. Keep it tight under the nav with no extra
   top padding. */
.hero-ornament-strip {
  padding-top: 0;
}
.hero-photo {
  position: absolute;
  top: 0; right: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}
.hero-photo img {
  width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.8) contrast(1.02);
}
.hero-photo-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--c-cream) 0%, transparent 35%, rgba(158, 27, 50, 0.12) 100%);
}
.hero-crimson-band {
  position: absolute;
  left: 0; top: 18%;
  width: 4px;
  height: 64%;
  background: var(--c-red);
  z-index: 2;
}
.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-grain {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(ellipse 80% 60% at 80% 20%, rgba(158, 27, 50, 0.06), transparent 60%),
    radial-gradient(ellipse 60% 40% at 10% 80%, rgba(158, 27, 50, 0.04), transparent 70%);
}
.hero-ornament {
  position: absolute;
  color: var(--c-red);
  opacity: 0.18;
}
.hero-ornament-left {
  top: 12%;
  left: 6%;
  width: 84px;
  height: 84px;
  transform: rotate(-12deg);
}
.hero-ornament-right {
  bottom: 14%;
  right: 6%;
  width: 110px;
  height: 140px;
  opacity: 0.12;
}
.hero-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  position: relative;
  z-index: 2;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-red);
  margin-bottom: 28px;
}
.hero-eyebrow .dot {
  width: 6px; height: 6px;
  background: var(--c-red);
  border-radius: 50%;
  display: inline-block;
}
.hero-title {
  font-family: var(--serif);
  font-size: clamp(48px, 7vw, 96px);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.025em;
  color: var(--c-ink);
  max-width: 14ch;
  margin-bottom: 32px;
}
.hero-title-italic {
  font-style: italic;
  font-weight: 400;
  color: var(--c-red);
}
.hero-title-accent {
  display: block;
  font-weight: 600;
  color: var(--c-ink);
}
.hero-sub {
  font-size: 19px;
  line-height: 1.55;
  color: var(--c-ink-soft);
  max-width: 56ch;
  margin-bottom: 44px;
  font-weight: 400;
}
.hero-cta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 80px;
}
.hero-stats {
  display: flex;
  gap: 64px;
  padding-top: 36px;
  border-top: 1px solid var(--c-line);
  max-width: 720px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-num {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 700;
  color: var(--c-red);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-ink-soft);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 15px 28px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border-radius: 100px;
  transition: all 0.25s ease;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--c-red);
  color: var(--c-paper);
  box-shadow: 0 1px 2px rgba(158, 27, 50, 0.2);
}
.btn-primary:hover {
  background: var(--c-red-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(158, 27, 50, 0.25);
}
.btn-ghost {
  background: transparent;
  color: var(--c-ink);
  border-color: var(--c-line);
}
.btn-ghost:hover {
  border-color: var(--c-ink);
  background: var(--c-paper);
}

/* ===== Ornament strip ===== */
.ornament-strip {
  background: var(--c-red);
  padding: 36px 0;
  border-top: 1px solid var(--c-red-dark);
  border-bottom: 1px solid var(--c-red-dark);
  position: relative;
  overflow: hidden;
}
.ornament-strip::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 80px;
  background: var(--c-cream);
  opacity: 0.08;
  background-image: linear-gradient(135deg, transparent 45%, rgba(255,255,255,0.15) 50%, transparent 55%);
}
.ornament-strip-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  color: var(--c-cream);
}
.ornament-strip svg { width: 200px; height: 28px; opacity: 0.85; color: var(--c-paper); }
.ornament-strip-quote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 21px;
  color: var(--c-paper);
  font-weight: 400;
  letter-spacing: 0.005em;
}

/* ===== Section primitives ===== */
.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.section-eyebrow {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-red);
  margin-bottom: 18px;
}
.section-title {
  font-family: var(--serif);
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--c-ink);
  margin-bottom: 24px;
  max-width: 18ch;
}
.section-title em {
  font-style: italic;
  font-weight: 400;
  color: var(--c-red);
}
.section-sub {
  font-size: 17px;
  color: var(--c-ink-soft);
  max-width: 56ch;
  margin-bottom: 24px;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 40px;
  margin-bottom: 56px;
  flex-wrap: wrap;
}
.section-head-center {
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 64px;
}
.section-head-center .section-title { max-width: 24ch; margin-inline: auto; margin-bottom: 16px; }
.section-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-red);
  white-space: nowrap;
  border-bottom: 1.5px solid var(--c-red);
  padding-bottom: 4px;
  transition: gap 0.3s;
}
.section-link:hover { color: var(--c-red-dark); border-color: var(--c-red-dark); }

/* ===== About ===== */
.about {
  padding: 120px 0;
  background: var(--c-cream);
}
.about-crimson-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--c-red);
  color: var(--c-paper);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  padding: 14px 24px;
  margin: 0 calc(var(--gutter) * -1) 80px;
  width: calc(100% + var(--gutter) * 2);
  position: relative;
  overflow: hidden;
}
.about-crimson-bar::before,
.about-crimson-bar::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  background: rgba(255,255,255,0.08);
}
.about-crimson-bar::before { left: 0; }
.about-crimson-bar::after { right: 0; }
.about-crimson-bar-flag {
  color: var(--c-paper);
  font-size: 10px;
  opacity: 0.85;
}
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  align-items: start;
}
.about-text .lead {
  font-size: 19px;
  line-height: 1.6;
  color: var(--c-ink);
  margin-bottom: 20px;
  font-weight: 400;
}
.about-text p {
  font-size: 16px;
  color: var(--c-ink-soft);
  margin-bottom: 20px;
}
.about-text em { color: var(--c-red); font-style: italic; }
.about-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding-top: 32px;
  margin-top: 16px;
  border-top: 1px solid var(--c-line);
}
.about-meta-key {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
  margin-bottom: 8px;
}
.about-meta-val {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-ink);
}
.about-visual {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.about-card {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: 4px;
  padding: 48px 40px;
  position: relative;
  box-shadow: var(--shadow-card);
}
.about-card-orn {
  width: 56px;
  height: 56px;
  color: var(--c-red);
  margin-bottom: 24px;
  opacity: 0.85;
}
.about-card-text {
  font-family: var(--serif);
  font-style: italic;
  font-size: 24px;
  line-height: 1.4;
  color: var(--c-ink);
  margin-bottom: 16px;
  font-weight: 400;
}
.about-card-author {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-ink-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.about-strip {
  height: 6px;
  border-radius: 1px;
  overflow: hidden;
  display: flex;
}
.about-strip-flag { width: 100%; background: var(--c-red); position: relative; }
.about-strip-flag::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 30%;
  height: 100%;
  background: var(--c-paper);
}

/* ===== News ===== */
.news {
  padding: 120px 0;
  background: var(--c-paper);
  border-top: 1px solid var(--c-line);
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.news-card {
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: 4px;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.news-card:hover {
  transform: translateY(-2px);
  border-color: var(--c-red);
  box-shadow: var(--shadow-hover);
}
.news-card-feature {
  grid-column: span 2;
  grid-row: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.news-card-feature .news-img { aspect-ratio: auto; }
.news-img {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--c-line-soft);
}
.news-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}
.news-card:hover img { transform: scale(1.05); }
.news-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.news-card-feature .news-body { padding: 40px; justify-content: center; }
.news-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-red);
  margin-bottom: 14px;
}
.news-card h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--c-red);
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  transition: color 0.2s;
}
.news-card:hover h3 { color: var(--c-red-dark); }
.news-card-feature h3 { font-size: 32px; margin-bottom: 16px; color: var(--c-red); }
.news-card p {
  font-size: 14.5px;
  color: var(--c-ink-soft);
  margin-bottom: 18px;
  line-height: 1.55;
}
.news-card-feature p { font-size: 16px; }
.news-meta {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-ink-soft);
  letter-spacing: 0.05em;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--c-line);
}

/* ===== Branches ===== */
.branches {
  padding: 120px 0;
  background: var(--c-cream);
}
.branches-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--c-line);
  border: 1px solid var(--c-line);
}
.branch-card {
  background: var(--c-cream);
  padding: 44px 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  transition: background 0.3s ease;
  min-height: 200px;
}
.branch-card:hover {
  background: var(--c-paper);
}
.branch-num {
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-red);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.branch-card h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  color: var(--c-ink);
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.branch-card p {
  font-size: 14px;
  color: var(--c-ink-soft);
  line-height: 1.5;
}
.ornament-row {
  margin-top: 56px;
  display: flex;
  justify-content: center;
  color: var(--c-red);
}
.ornament-row svg { width: 120px; height: 36px; opacity: 0.55; }

/* ===== Library ===== */
.library {
  padding: 120px 0;
  background: var(--c-paper);
  border-top: 1px solid var(--c-line);
  position: relative;
  overflow: hidden;
}
.library::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 280px;
  height: 280px;
  background: var(--c-red);
  opacity: 0.04;
  border-radius: 50%;
  transform: translate(40%, -40%);
  pointer-events: none;
}
.library-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
  position: relative;
}
.library-img {
  aspect-ratio: 4/5;
  overflow: hidden;
  border-radius: 4px;
  background: var(--c-line-soft);
  box-shadow: var(--shadow-card);
  position: relative;
}
.library-img::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 4px;
  background: var(--c-red);
}
.library-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}

/* ===== Info ===== */
.info {
  padding: 120px 0;
  background: var(--c-cream);
}
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
}
.info-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 22px 0;
  border-bottom: 1px solid var(--c-line);
  align-items: baseline;
}
.info-key {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}
.info-val {
  font-size: 17px;
  color: var(--c-ink);
  font-weight: 500;
}
.info-links {
  list-style: none;
  margin-top: 8px;
}
.info-links li {
  border-bottom: 1px solid var(--c-line);
}
.info-links a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--c-ink);
  transition: color 0.2s, padding 0.2s;
}
.info-links a:hover {
  color: var(--c-red);
  padding-left: 8px;
}

/* ===== Contact ===== */
.contact {
  padding: 120px 0;
  background: var(--c-paper);
  border-top: 1px solid var(--c-line);
}
.contact-card {
  background: var(--c-cream);
  border: 1px solid var(--c-line);
  border-radius: 6px;
  padding: 80px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}
.contact-text p { font-size: 16px; color: var(--c-ink-soft); margin-bottom: 32px; }
.contact-meta {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 24px;
}
.contact-meta > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.contact-key {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}
.contact-meta a {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--c-red);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
  align-self: flex-start;
}
.contact-meta a:hover { border-color: var(--c-red); }
.contact-meta span:not(.contact-key) {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  color: var(--c-ink);
}
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.contact-form label {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.contact-form span {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-ink-soft);
}
.contact-form input,
.contact-form textarea {
  font-family: var(--sans);
  font-size: 15px;
  padding: 14px 16px;
  background: var(--c-paper);
  border: 1px solid var(--c-line);
  border-radius: 4px;
  color: var(--c-ink);
  transition: border-color 0.2s;
  outline: none;
  resize: vertical;
}
.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--c-red);
}
.contact-form button {
  align-self: flex-start;
  margin-top: 8px;
}
.contact-form button:disabled { opacity: 0.7; cursor: default; }

/* ===== Footer ===== */
.footer {
  background: var(--c-ink);
  color: var(--c-cream);
  padding: 64px 0 32px;
}
.footer-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 48px;
  align-items: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.footer-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  /* emblem keeps its colors against the dark footer */
  border-radius: 50%;
  background: var(--c-paper);
  padding: 2px;
}
.footer-brand div {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.footer-brand strong {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  color: var(--c-paper);
}
.footer-brand span {
  font-size: 11.5px;
  color: var(--c-red-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
}
.footer-links {
  display: flex;
  justify-content: center;
  gap: 28px;
}
.footer-links a {
  font-size: 13.5px;
  color: var(--c-cream);
  opacity: 0.7;
  transition: opacity 0.2s, color 0.2s;
}
.footer-links a:hover { opacity: 1; color: var(--c-red-soft); }
.footer-flag {
  width: 50px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.2);
  display: flex;
  border-radius: 2px;
  overflow: hidden;
}
.footer-flag-red { flex: 1; background: var(--c-red); }
.footer-flag-white { width: 18px; background: var(--c-paper); }
.footer-fine {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 12px;
  color: var(--c-cream);
  opacity: 0.5;
  padding-top: 32px;
  border-top: 1px solid rgba(255,255,255,0.08);
  margin-top: 16px;
  letter-spacing: 0.02em;
}

/* Right-hand cluster for desktop controls (lang + version switcher)
   Mobile rules below move these into the overlay drawer. */
.nav-desktop-right {
  display: flex;
  align-items: center;
  gap: 0;          /* each pill already has its own margin-right */
}

/* ===== Responsive ===== */
@media (max-width: 960px) {
  .nav-links { display: none; }
  .nav-desktop-right { display: none; }  /* desktop right cluster — moves into overlay */
  .nav-burger { display: flex; }
  /* On mobile the drawer fills the full viewport; on tablet+ it's a 420px side-sheet */
  .nav-overlay-inner {
    width: 100vw;
    border-left: 0;
  }
  .hero { padding: 70px 0 60px; min-height: auto; }
  .hero-stats { gap: 32px; flex-wrap: wrap; }
  .about-grid,
  .library-grid,
  .info-grid,
  .contact-card { grid-template-columns: 1fr; gap: 48px; }
  .about-visual { position: static; }
  .news-grid { grid-template-columns: 1fr; }
  .news-card-feature { grid-column: auto; grid-row: auto; grid-template-columns: 1fr; }
  .branches-grid { grid-template-columns: 1fr; }
  .contact-card { padding: 48px 32px; }
  .footer-inner { grid-template-columns: 1fr; text-align: center; gap: 32px; }
  .footer-brand { justify-content: center; }
  .footer-links { flex-wrap: wrap; }
  .footer-flag { margin: 0 auto; }
  .section-head { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  /* Tighter mobile nav: less vertical chrome, smaller logo, keep tap targets */
  .nav { top: 0; padding: 8px 0; }
  .nav.is-scrolled { padding: 6px 0; }
  .nav-logo { width: 38px; height: 38px; }
  .nav-inner { gap: 12px; }
  .nav-brand { gap: 10px; }
  /* Compact brand text on mobile (smaller serif label) */
  .nav-brand-en { font-size: 14px; }
  .nav-brand-lv { font-size: 11px; }
}
@media (max-width: 560px) {
  :root { --gutter: 20px; }
  .hero-title { font-size: 44px; }
  .stat-num { font-size: 32px; }
  .stat-label { font-size: 11px; }
  .branch-card { padding: 32px 24px; }
  .info-row { grid-template-columns: 1fr; gap: 6px; }
  .contact-card { padding: 32px 24px; }
  .news-card-feature .news-body { padding: 24px; }
  .news-card-feature h3 { font-size: 24px; }
  .about-card { padding: 32px 24px; }
  .about-card-text { font-size: 19px; }
  .ornament-strip-inner { flex-direction: column; gap: 16px; }
  .ornament-strip svg { width: 140px; }
  /* Tighter brand text on very small screens so it never wraps */
  .nav-brand-en { font-size: 15px; }
  .nav-brand-lv { font-size: 10.5px; letter-spacing: 0.03em; }
}

/* Full-screen mobile overlay drawer */
.nav-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  visibility: hidden;
}
.nav-overlay.is-open {
  pointer-events: auto;
  visibility: visible;
}
.nav-overlay-bg {
  position: absolute;
  inset: 0;
  background: rgba(20, 16, 12, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease;
}
.nav-overlay.is-open .nav-overlay-bg { opacity: 1; }

.nav-overlay-inner {
  position: absolute;
  top: 0;
  right: 0;
  height: 100dvh;
  height: 100vh;
  width: min(420px, 100vw);
  background: var(--c-paper);
  border-left: 1px solid var(--c-line);
  box-shadow: -24px 0 60px rgba(0,0,0,0.18);
  padding: calc(76px + 18px) 28px 24px;  /* 76px ≈ nav height incl. flag ribbon */
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  transform: translateX(100%);
  transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.nav-overlay.is-open .nav-overlay-inner { transform: translateX(0); }

/* Close (×) button pinned to the top-right of the drawer */
.nav-overlay-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: transparent;
  border: 1px solid var(--c-line);
  border-radius: 50%;
  color: var(--c-ink);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
  z-index: 1;
  flex-shrink: 0;
}
.nav-overlay-close svg {
  width: 18px;
  height: 18px;
  display: block;
}
.nav-overlay-close:hover,
.nav-overlay-close:active {
  background: var(--c-ink);
  color: var(--c-paper);
  border-color: var(--c-ink);
  transform: rotate(90deg);
}
.nav-overlay-close:focus-visible {
  outline: 2px solid var(--c-red);
  outline-offset: 2px;
}

/* Slim crimson accent at the top edge instead of a full-height bar */
.nav-overlay-inner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--c-red);
}

.nav-overlay-links {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
}
.nav-overlay-links a {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--c-ink);
  padding: 12px 0;
  border-bottom: 1px solid var(--c-line);
  text-decoration: none;
  display: block;
  transition: color 0.2s;
}
.nav-overlay-links a:hover,
.nav-overlay-links a:active {
  color: var(--c-red);
}

/* Compact controls row — lang + version share one line inside the drawer */
.nav-overlay-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
}
.nav-overlay-controls .lang-switch,
.nav-overlay-controls .version-switch {
  margin: 0;
  padding: 3px;
}
.nav-overlay-controls .lang-opt,
.nav-overlay-controls .version-opt {
  padding: 6px 10px;
  font-size: 11.5px;
}

/* Body lock when overlay is open */
body.nav-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
}

/* =====================================================
   LANGUAGE SWITCHER (LV / EN) — top-right pill
   Active pill goes gold when English is selected
   ===================================================== */
.lang-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--c-line);
  border-radius: 100px;
  padding: 4px;
  gap: 2px;
  margin-right: 10px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: relative;
}
.lang-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-family: var(--sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-ink-soft);
  border-radius: 100px;
  transition: background 0.25s, color 0.25s;
  cursor: pointer;
  white-space: nowrap;
  border: 0;
  background: transparent;
  text-decoration: none;
}
.lang-opt:hover {
  color: var(--c-paper);
  background: var(--c-ink);
}
.lang-opt:hover::before { background: var(--c-paper); }
.lang-opt.is-active {
  background: var(--c-ink);
  color: var(--c-paper);
}
/* Gold pill when English mode is active */
:root[data-lang="en"] .lang-opt.is-active[data-lang-opt="en"] {
  background: var(--c-gold);
  color: var(--c-paper);
}
/* Subtle dot before the label, colored to match mode */
.lang-opt::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-line);
  display: inline-block;
  transition: background 0.25s;
}
.lang-opt[data-lang-opt="en"]::before { background: var(--c-gold); }
.lang-opt[data-lang-opt="lv"]::before { background: var(--c-red); }
.lang-opt.is-active::before { background: var(--c-paper); }

/* =====================================================
   VERSION SWITCHER (slb → slb2) — sits next to lang
   Smaller, secondary — not the main control
   ===================================================== */
.version-switch {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--c-line);
  border-radius: 100px;
  padding: 4px;
  gap: 2px;
  margin-right: 12px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.version-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--c-ink-soft);
  border-radius: 100px;
  transition: background 0.2s, color 0.2s;
  text-decoration: none;
}
.version-opt:hover {
  color: var(--c-paper);
  background: var(--c-ink);
}
.version-opt:hover .version-dot { background: var(--c-paper); }
.version-opt.active {
  background: var(--c-ink);
  color: var(--c-paper);
}
.version-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-ink-soft);
  display: inline-block;
}
.version-opt[data-version="v2"] .version-dot { background: var(--c-red); }
.version-opt.active .version-dot {
  background: var(--c-paper);
  box-shadow: 0 0 0 2px var(--c-amber);
}

/* =====================================================
   LANGUAGE-VISIBLE RULES
   Body starts in LV (default). data-lang on <html>
   decides what's visible: 'en' / 'lv' / 'both'.
   ===================================================== */
/* LV default: hide [data-en] elements. EN mode: hide [data-lv]. */
html:not([data-lang="en"]) [data-en]:not([data-en-always]) { display: none; }
html:not([data-lang="lv"]) [data-lv]:not([data-lv-always]) { display: none; }
/* Belt-and-braces in case any element misses the :not() guard */
html[data-lang="lv"] [data-en] { display: none; }
html[data-lang="en"] [data-lv] { display: none; }

/* Inline EN/LV stacks: keep collapsed (display:inline) when active lang visible */
.bilingual { display: inline-flex; flex-direction: column; gap: 2px; }

@media (max-width: 768px) {
  /* Desktop nav-controls are hidden at mobile — their compact variants
     live inside .nav-overlay-controls with their own sizing. */
  .nav-desktop-right { display: none !important; }
  .nav-burger { display: flex; }
}

/* =====================================================
   EN mode accent — eucalyptus/gold subtly surface on
   cards, section dividers, and CTA hover. Latvian
   crimson stays the lead — this is a blend, not a swap.
   ===================================================== */
:root[data-lang="en"] .section-divider,
:root[data-lang="en"] hr {
  border-color: var(--c-eucalyptus-soft);
}
:root[data-lang="en"] .card:hover,
:root[data-lang="en"] .news-card:hover {
  border-color: var(--c-eucalyptus);
}
:root[data-lang="en"] .cta-primary:hover {
  background: var(--c-eucalyptus-dark);
}
