/* Elvya — semantic responsive layout */
:root {
  --header: #67563f;
  --header-hover: #7d6a52;
  --hero-wash: #fbbe7d;
  --cream: #faf8f5;
  --text: #212121;
  --text-muted: #5c5348;
  --link: #5a4a38;
  --link-hover: #3d3226;
  --footer-bg: #2c241c;
  --footer-text: #e8e4df;
  --footer-muted: #b5aca2;
  --border: #e0d8cf;
  --max: 1100px;
  --pad: clamp(1rem, 4vw, 2rem);
  /* Sticky header + small gap; matches in-page scroll offset in build-site.ps1 */
  --scroll-anchor-pad: 5.5rem;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: var(--scroll-anchor-pad);
}

body {
  margin: 0;
  font-family: "Open Sans", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text);
  background: #fff;
}

@media (max-width: 900px) {
  :root {
    --scroll-anchor-pad: 4.75rem;
  }
}

img {
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

a {
  color: var(--link);
  text-decoration-color: rgba(90, 74, 56, 0.35);
  text-underline-offset: 0.15em;
}

a:visited {
  color: var(--link);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  padding: 0.75rem 1.25rem;
  background: var(--header);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-family: "Ubuntu", system-ui, sans-serif;
}

.skip-link:focus {
  left: var(--pad);
  top: 0.5rem;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
  font-family: "Ubuntu", system-ui, sans-serif;
}

.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.65rem var(--pad) 0.65rem 10%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  line-height: 0;
}

.site-logo img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  display: block;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #fff;
}

.nav-toggle span {
  display: block;
  height: 2px;
  width: 24px;
  background: currentColor;
  border-radius: 1px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.15rem 0.5rem;
}

.site-nav a {
  color: #fff !important;
  text-decoration: none;
  padding: 0.4rem 0.55rem;
  font-size: 0.95rem;
  border-radius: 4px;
  white-space: nowrap;
}

.site-nav a:hover,
.site-nav a:focus {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.site-nav .nav-sep {
  color: rgba(255, 255, 255, 0.35);
  padding: 0 0.15rem;
  user-select: none;
}

.site-nav .nav-lang.lang-active {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.nav-lang {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-lang__flag {
  display: inline-flex;
  line-height: 0;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

.nav-lang__flag svg {
  display: block;
  width: 22px;
  height: 15px;
  border-radius: 2px;
}

.nav-lang__code {
  font-weight: 500;
  letter-spacing: 0.04em;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--header);
    padding: 0.75rem var(--pad) 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    gap: 0;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 0.65rem 0.5rem;
    border-radius: 6px;
  }

  .site-nav .nav-sep {
    display: none;
  }
}

/* Hero */
.hero {
  position: relative;
  min-height: min(88vh, 820px);
  background: #1a1510;
}

.hero__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.hero__bg picture {
  display: block;
  width: 100%;
  height: 100%;
}

/* Stretch hero image to the hero area (no letterboxing) — desktop uses hero.png, narrow portrait uses hero-mobile.png via <picture>. */
.hero__bg img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  object-position: center center;
}

@media (orientation: portrait) and (max-width: 767px) {
  .hero {
    min-height: min(62svh, 520px);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__bg img {
    animation: heroImageFadeIn 1.05s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  }
}

@keyframes heroImageFadeIn {
  from {
    opacity: 0.88;
  }
  to {
    opacity: 1;
  }
}

/* Scroll / load reveals — keyframes so first paint animates reliably */
@keyframes elvya-reveal-in {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes elvya-child-in {
  from {
    opacity: 0;
    transform: translate3d(0, 22px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.reveal {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
}

.reveal.is-inview {
  animation: elvya-reveal-in 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Staggered children inside each section (after section enters view) */
.section.reveal .reveal-child {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
}

.section.reveal.is-inview .reveal-child {
  animation: elvya-child-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.section.reveal.is-inview > .section__inner > .section__title.reveal-child {
  animation-delay: 0.06s;
}

.section.reveal.is-inview .about-grid .about-grid__media.reveal-child {
  animation-delay: 0.14s;
}

.section.reveal.is-inview .about-grid .prose.reveal-child {
  animation-delay: 0.24s;
}

.section.reveal.is-inview .section__inner.prose > .reveal-child:first-of-type {
  animation-delay: 0.06s;
}

.section.reveal.is-inview .section__inner.prose .article-body.reveal-child {
  animation-delay: 0.18s;
}

.section.reveal.is-inview .figures-grid .figure-card.reveal-child:nth-child(1) {
  animation-delay: 0.08s;
}

.section.reveal.is-inview .figures-grid .figure-card.reveal-child:nth-child(2) {
  animation-delay: 0.14s;
}

.section.reveal.is-inview .figures-grid .figure-card.reveal-child:nth-child(3) {
  animation-delay: 0.2s;
}

.section.reveal.is-inview .figures-grid .figure-card.reveal-child:nth-child(4) {
  animation-delay: 0.26s;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.is-inview {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .section.reveal .reveal-child,
  .section.reveal.is-inview .reveal-child {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  .hero__bg img {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Sections */
.section {
  padding: clamp(2.5rem, 6vw, 4rem) var(--pad);
}

.section.section--first {
  padding-top: clamp(1.75rem, 4vw, 2.75rem);
}

/* In-page targets: keep titles clear of sticky header (with native hash / focus) */
#about-us,
#contact,
#appleCiderVinegar {
  scroll-margin-top: var(--scroll-anchor-pad);
}

.section--cream {
  background: var(--cream);
}

.section__inner {
  max-width: var(--max);
  margin: 0 auto;
}

.section__title {
  font-family: "Yeseva One", Georgia, serif;
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 400;
  text-align: center;
  margin: 0 0 1.75rem;
  color: var(--text);
}

/* About grid */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

.about-grid__media {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(44, 36, 28, 0.12);
  max-width: min(360px, 92vw);
  margin-inline: auto;
}

.about-grid__media img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
}

@media (min-width: 768px) {
  /* Flex keeps image + prose centered as a pair (no stray space on one side) */
  .about-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: clamp(1.75rem, 4vw, 3rem);
  }

  .about-grid__media {
    flex: 0 1 auto;
    width: min(380px, 100%);
    max-width: 380px;
    margin-inline: 0;
  }

  /* Narrower measure → more line breaks / taller block */
  .about-grid .prose {
    flex: 0 1 34rem;
    max-width: 34rem;
    width: min(34rem, 100%);
    margin-left: 0;
    margin-right: 0;
  }
}

/* Prose / article */
.prose {
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.prose h2,
.prose h3 {
  font-family: "Yeseva One", Georgia, serif;
  font-weight: 400;
  line-height: 1.3;
  margin: 2rem 0 1rem;
  color: var(--text);
}

.prose h2 {
  font-size: 1.65rem;
  text-align: center;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose .reveal-child > h2:first-child {
  margin-top: 0;
}

.prose h3 {
  font-size: 1.25rem;
  text-align: center;
}

.prose p {
  margin: 0 0 1rem;
  text-align: justify;
  hyphens: auto;
}

.prose ul {
  margin: 0 0 1.25rem;
  padding-left: 1.35rem;
}

.prose li {
  margin-bottom: 0.65rem;
}

.prose li p {
  margin: 0;
}

/* Legacy extract wraps list items in <span>; unwrap for normal list layout */
.prose .article-body li > span {
  display: contents;
}

.prose strong {
  font-weight: 700;
  color: var(--text);
}

.prose em {
  font-style: italic;
}

.prose a {
  color: var(--link);
}

/* Strip legacy junk inside extracted fragments */
.article-body br + br {
  display: none;
}

/* Figures */
.figures-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 640px) {
  .figures-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2rem 2.5rem;
  }
}

.figure-card {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 1rem;
  padding: 1.25rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(44, 36, 28, 0.06);
}

.figure-card img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.figure-card h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.figure-card .role {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

.figure-card p {
  margin: 0;
  font-size: 0.95rem;
  text-align: justify;
  color: var(--text);
}

/* Footer */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-text);
  padding: clamp(2.5rem, 5vw, 3.5rem) var(--pad)
    calc(1.75rem + env(safe-area-inset-bottom, 0px));
  font-family: "Ubuntu", system-ui, sans-serif;
}

.site-footer a {
  color: #f0ebe4;
  text-decoration: none;
}

.site-footer a:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.footer-grid {
  max-width: var(--max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .footer-grid {
    grid-template-columns: 1.1fr 1fr 1fr 1.1fr;
    gap: 2rem;
  }
}

.footer-col h3 {
  margin: 0 0 0.85rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--footer-muted);
}

.footer-col p,
.footer-col address {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  font-style: normal;
  color: var(--footer-text);
}

/* Site-specific names (elvya-footlinks, n1–n5) avoid common adblock cosmetic filters
   that hide .footer-social, [class*="fb"], "Social" widgets, etc. */
.elvya-footlinks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.elvya-footlinks li {
  margin: 0;
}

.elvya-footlinks__a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 12px;
  border: 1px solid transparent;
  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease,
    box-shadow 0.25s ease;
}

.elvya-footlinks__a--n1 {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}

.elvya-footlinks__a--n2 {
  background: rgba(24, 119, 242, 0.22);
  border-color: rgba(24, 119, 242, 0.45);
}

.elvya-footlinks__a--n3 {
  background: rgba(225, 48, 108, 0.18);
  border-color: rgba(193, 53, 132, 0.4);
}

.elvya-footlinks__a--n4 {
  background: rgba(10, 102, 194, 0.22);
  border-color: rgba(10, 102, 194, 0.45);
}

.elvya-footlinks__a--n5 {
  background: rgba(37, 211, 102, 0.2);
  border-color: rgba(37, 211, 102, 0.45);
}

.site-footer .elvya-footlinks__a:hover,
.site-footer .elvya-footlinks__a:focus {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
  text-decoration: none;
}

.site-footer .elvya-footlinks__a--n1:hover,
.site-footer .elvya-footlinks__a--n1:focus {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.28);
}

.site-footer .elvya-footlinks__a--n2:hover,
.site-footer .elvya-footlinks__a--n2:focus {
  background: rgba(24, 119, 242, 0.35);
  border-color: rgba(24, 119, 242, 0.65);
}

.site-footer .elvya-footlinks__a--n3:hover,
.site-footer .elvya-footlinks__a--n3:focus {
  background: rgba(225, 48, 108, 0.3);
  border-color: rgba(193, 53, 132, 0.55);
}

.site-footer .elvya-footlinks__a--n4:hover,
.site-footer .elvya-footlinks__a--n4:focus {
  background: rgba(10, 102, 194, 0.38);
  border-color: rgba(10, 102, 194, 0.65);
}

.site-footer .elvya-footlinks__a--n5:hover,
.site-footer .elvya-footlinks__a--n5:focus {
  background: rgba(37, 211, 102, 0.38);
  border-color: rgba(37, 211, 102, 0.65);
}

.elvya-footlinks__a:focus-visible {
  outline: 2px solid rgba(251, 190, 125, 0.7);
  outline-offset: 2px;
}

.elvya-footlinks__svg {
  display: block;
  flex-shrink: 0;
}

.footer-bottom {
  max-width: var(--max);
  margin: 2.5rem auto 0;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.875rem;
  color: var(--footer-muted);
  font-family: "Ubuntu", system-ui, sans-serif;
}
