/* =====================================================================
   Yen Water Co — blog stylesheet for the PHP-rendered blog pages.
   Self-contained: tokens + base + header + footer + blog list + post.
   Assembled from src/styles/global.css and the Astro components so the
   PHP pages look identical to the built site. Keep in sync with those.
   ===================================================================== */

/* ---------- Design tokens (from global.css) ---------- */
:root {
  --ink: #08090b;
  --ink-2: #030404;
  --ink-3: #16181b;
  --ice: #f2f5f8;
  --mist: #adb4ba;
  --frost: #e9edf0;
  --frost-rgb: 233, 237, 240;
  --steel: #c9cfd5;
  --steel-rgb: 201, 207, 213;
  --chrome: linear-gradient(105deg, #b9bec4 0%, #ffffff 28%, #8d949c 52%, #f2f4f6 74%, #aab0b7 100%);
  --font-display: 'Cormorant Garamond', 'Vazirmatn', 'Georgia', serif;
  --font-body: 'Inter', 'Vazirmatn', 'Segoe UI', system-ui, sans-serif;
  --container: 1160px;
  --header-h: 76px;
}

/* ---------- Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  /* Blog pages use the unified near-black ("solid ground"), so the article
     header, body and footer are one continuous colour — no lighter band. */
  background: var(--ink-2);
  color: var(--ice);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
section[id] { scroll-margin-top: var(--header-h); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 1rem;
}
.section-title { font-size: clamp(2rem, 4.5vw, 3.2rem); color: var(--ice); }
.lede { color: var(--mist); max-width: 56ch; }

.container { width: min(var(--container), 100% - 3rem); margin-inline: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 2.1rem;
  border: 1px solid rgba(242, 243, 245, 0.35);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ice);
  transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease;
}
.btn:hover { border-color: var(--frost); color: var(--frost); }

.reveal { transition: opacity 0.8s ease, transform 0.8s ease; }
.reveal--armed { opacity: 0; transform: translateY(28px); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal, .reveal--armed { opacity: 1; transform: none; transition: none; }
}

/* ================= Header (from Header.astro) ================= */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background-color 0.35s ease, border-color 0.35s ease;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(2, 3, 4, 0.92);
  backdrop-filter: blur(14px);
  border-bottom-color: rgba(242, 243, 245, 0.08);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.brand { display: flex; align-items: baseline; gap: 0.55rem; color: var(--ice); }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-rest {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-style: italic;
  letter-spacing: 0.08em;
  color: var(--mist);
}
.site-nav { display: flex; gap: 2.2rem; }
.site-nav a {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mist);
  transition: color 0.25s ease;
}
.site-nav a:hover { color: var(--frost); }
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 7px;
  background: none;
  border: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0.5rem;
  margin-inline-end: -0.5rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle span { width: 26px; height: 1.5px; background: var(--ice); transition: transform 0.3s ease; }

@media (max-width: 780px) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: rgba(2, 3, 4, 0.98);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(242, 243, 245, 0.08);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }
  .site-nav.is-open { max-height: 22rem; }
  .site-nav a { padding: 1.1rem 1.5rem; border-top: 1px solid rgba(242, 243, 245, 0.06); }
  .nav-toggle[aria-expanded='true'] span:first-child { transform: translateY(4.25px) rotate(45deg); }
  .nav-toggle[aria-expanded='true'] span:last-child { transform: translateY(-4.25px) rotate(-45deg); }
}

/* ================= Footer (from Footer.astro) ================= */
.site-footer {
  position: relative;
  background: var(--ink-2);
  border-top: 1px solid rgba(242, 243, 245, 0.07);
  overflow: hidden;
}
.footer-cta {
  padding: clamp(4.5rem, 10vw, 8rem) 0 clamp(3rem, 7vw, 5rem);
  background: radial-gradient(900px 420px at 50% 0%, rgba(var(--frost-rgb), 0.05), transparent 65%);
  text-align: center;
}
.footer-cta h2 { font-size: clamp(2.4rem, 6vw, 4.4rem); color: var(--ice); margin-bottom: 2rem; }
.footer-cta h2 em { font-style: italic; color: var(--frost); }
.cta-phone {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1.25rem, 2.8vw, 1.9rem);
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  color: var(--frost);
  border: 1px solid rgba(var(--frost-rgb), 0.4);
  border-radius: 999px;
  padding: 0.85rem 2.8rem;
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}
.cta-phone:hover { background: var(--frost); border-color: var(--frost); color: var(--ink-2); }
.cta-note { margin-top: 1.1rem; color: var(--mist); font-size: 0.85rem; letter-spacing: 0.06em; }
.socials--cta { justify-content: center; margin-top: 1.8rem; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1.2fr 1.4fr;
  gap: 3rem;
  padding: clamp(2.5rem, 6vw, 4rem) 0;
  border-top: 1px solid rgba(242, 243, 245, 0.07);
}
.footer-logo-img { height: 40px; width: auto; margin-bottom: 1rem; }
.footer-slogan {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: var(--steel);
  margin-bottom: 1rem;
}
.footer-tag { color: var(--mist); font-size: 0.9rem; max-width: 30ch; }
.footer-col h3 {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--steel);
  margin-bottom: 1.2rem;
}
.footer-col ul {
  list-style: none; padding: 0; margin: 0;
  display: grid; gap: 0.7rem;
  color: var(--mist); font-size: 0.92rem;
}
.footer-col ul a { transition: color 0.25s ease; }
.footer-col ul a:hover { color: var(--frost); }
.app-badges { display: grid; gap: 0.8rem; justify-items: start; }
.app-badge {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(242, 243, 245, 0.16);
  border-radius: 10px;
  color: var(--ice);
  transition: border-color 0.25s ease;
  min-width: 175px;
}
.app-badge:hover { border-color: var(--frost); }
.app-badge span { display: grid; line-height: 1.25; font-size: 0.95rem; font-weight: 500; }
.app-badge small {
  font-size: 0.62rem; font-weight: 400; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--mist);
}
.footer-bottom {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 1.2rem;
  padding: 1.6rem 0;
  border-top: 1px solid rgba(242, 243, 245, 0.07);
  color: var(--mist); font-size: 0.8rem;
}
.footer-credit { color: rgba(147, 174, 194, 0.7); }
.socials { display: flex; gap: 0.7rem; }
.socials a {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border: 1px solid rgba(242, 243, 245, 0.16);
  border-radius: 50%;
  color: var(--mist);
  transition: color 0.25s ease, border-color 0.25s ease;
}
.socials a:hover { color: var(--frost); border-color: var(--frost); }

@media (max-width: 900px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2.4rem; }
  .footer-bottom { justify-content: center; text-align: center; }
}

/* ================= Blog list (from blog/index.astro) ================= */
.blog-hero {
  padding: calc(var(--header-h) + 1.8rem) 0 1.8rem;
  background:
    radial-gradient(900px 400px at 70% 0%, rgba(var(--frost-rgb), 0.06), transparent 60%),
    var(--ink-2);
}
.blog-hero-inner {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
}
.blog-hero .section-title { font-size: clamp(1.7rem, 3.5vw, 2.4rem); }
.blog-hero .eyebrow { margin-bottom: 0.4rem; }
.blog-hero .lede { margin: 0; font-size: 0.95rem; }
.blog-list { background: var(--ink-2); padding: 2rem 0 clamp(4rem, 8vw, 6rem); }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8rem; }
.post-card {
  display: block;
  background: rgba(242, 243, 245, 0.025);
  border: 1px solid rgba(242, 243, 245, 0.08);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.35s ease, border-color 0.35s ease;
}
.post-card:hover { transform: translateY(-6px); border-color: rgba(var(--frost-rgb), 0.45); }
.post-thumb { overflow: hidden; }
.post-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; transition: transform 0.6s ease; }
.post-card:hover .post-thumb img { transform: scale(1.05); }
.post-thumb .thumb-fallback {
  object-fit: contain;
  padding: 2.2rem 3.2rem;
  background: radial-gradient(ellipse at center, var(--ink-3), var(--ink-2));
}
.blog-list .post-body { padding: 1.3rem 1.5rem 1.6rem; }
.blog-list .post-body time {
  font-size: 0.66rem; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--steel);
}
.blog-list .post-body h2 {
  font-size: 1.25rem; color: var(--ice); margin: 0.6rem 0 0.6rem;
  line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; transition: color 0.3s ease;
}
.post-card:hover .post-body h2 { color: var(--frost); }
.blog-list .post-body p {
  color: var(--mist); font-size: 0.88rem; margin-bottom: 1rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.read-more {
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--frost);
}
@media (max-width: 980px) { .post-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) {
  .post-grid { grid-template-columns: 1fr; max-width: 420px; margin-inline: auto; }
}

/* ================= Single post (from [slug].astro) ================= */
.post-header {
  padding: calc(var(--header-h) + clamp(2rem, 5vw, 3.5rem)) 0 clamp(1.8rem, 4vw, 3rem);
  background:
    radial-gradient(900px 400px at 70% 0%, rgba(var(--frost-rgb), 0.06), transparent 60%),
    var(--ink-2);
}

/* ---------- Cinematic cover header (posts with a heroImage) ---------- */
.post-header--cover {
  position: relative;
  min-height: clamp(340px, 56vh, 560px);
  display: flex;
  align-items: flex-end;
  padding: calc(var(--header-h) + 2rem) 0 clamp(1.8rem, 4vw, 3rem);
  background: var(--ink-2);
  overflow: hidden;
}
.post-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  animation: post-cover-drift 30s ease-in-out infinite alternate;
}
@keyframes post-cover-drift {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}
.post-cover-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(180deg, rgba(3, 4, 4, 0.5) 0%, rgba(3, 4, 4, 0.15) 32%, rgba(3, 4, 4, 0.72) 78%, var(--ink-2) 100%),
    radial-gradient(ellipse at center, transparent 55%, rgba(2, 3, 4, 0.5) 100%);
}
.post-header--cover .post-container {
  position: relative;
  z-index: 2;
}
.post-header--cover h1 {
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.75);
}
.post-header--cover .lede {
  color: var(--ice);
  text-shadow: 0 1px 18px rgba(0, 0, 0, 0.85);
}
@media (prefers-reduced-motion: reduce) {
  .post-cover { animation: none; }
}

.post-container { max-width: 760px; }
.back-link {
  display: inline-block;
  font-size: 0.75rem; font-weight: 500; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--frost); margin-bottom: 2rem;
}
.post-header time {
  display: block; font-size: 0.72rem; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--steel); margin-bottom: 1rem;
}
.post-header h1 { font-size: clamp(2rem, 5vw, 3.2rem); color: var(--ice); margin-bottom: 1.2rem; }
.post-video { margin: clamp(2rem, 5vw, 3rem) 0 0; }
.post-video video {
  display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover;
  background: #000; border: 1px solid rgba(242, 243, 245, 0.09); border-radius: 18px;
}
.post-body { padding: clamp(2rem, 5vw, 3rem) 0 clamp(4rem, 8vw, 6rem); color: var(--mist); font-size: 1.05rem; }
.post-body h2 { font-size: 1.8rem; color: var(--ice); margin: 2.4rem 0 1rem; }
.post-body h3 { font-size: 1.35rem; color: var(--ice); margin: 2rem 0 0.8rem; }
.post-body p { margin-bottom: 1.3rem; }
.post-body ul, .post-body ol { margin: 0 0 1.3rem; padding-inline-start: 1.4rem; display: grid; gap: 0.5rem; }
.post-body blockquote {
  border-inline-start: 2px solid var(--steel);
  padding-inline-start: 1.4rem; margin: 2rem 0;
  font-family: var(--font-display); font-size: 1.3rem; font-style: italic; color: var(--ice);
}
.post-body a { color: var(--frost); text-decoration: underline; text-underline-offset: 3px; }

/* The one image rule: a wall of picture frames */
.post-body .post-gallery { columns: 2; column-gap: 1.2rem; margin: 2.2rem 0; }
.post-body .post-gallery--single { columns: 1; }
.post-body .post-frame {
  width: fit-content; max-width: 100%; margin: 0 auto 1.2rem;
  padding: 0.55rem;
  background: rgba(242, 243, 245, 0.03);
  border: 1px solid rgba(242, 243, 245, 0.09);
  border-radius: 18px; break-inside: avoid;
}
.post-body .post-frame img { display: block; width: auto; max-width: 100%; height: auto; border-radius: 12px; }
.post-body .post-gallery--single .post-frame img { max-height: 78vh; object-fit: contain; }
@media (max-width: 640px) {
  /* Galleries stay two-up on phones (compact); a lone image stays full-width. */
  .post-body .post-gallery { column-gap: 0.7rem; }
  .post-body .post-gallery--single { columns: 1; }
  .post-body .post-frame { margin-bottom: 0.8rem; padding: 0.4rem; }
}

/* Framed images are tappable → open full-screen (lightbox) */
.post-body .post-frame img { cursor: zoom-in; }

.yen-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3vw;
  background: rgba(2, 3, 4, 0.93);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;        /* fully hidden when closed */
  pointer-events: none;      /* never intercepts clicks when closed */
  transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.yen-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.25s ease;
}
.yen-lightbox img {
  max-width: 94vw;
  max-height: 92vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.yen-lightbox-close {
  position: fixed;
  top: 1rem;
  right: 1.1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(242, 243, 245, 0.12);
  color: var(--ice);
  border: 1px solid rgba(242, 243, 245, 0.25);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.yen-lightbox-close:hover { background: rgba(242, 243, 245, 0.22); }

/* Contact icon row + app badges inside posts */
.post-body .post-contact { display: flex; gap: 0.8rem; margin: 1.6rem 0 2rem; }
.post-body .post-contact a {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid rgba(242, 243, 245, 0.18); border-radius: 50%;
  color: var(--mist); transition: color 0.25s ease, border-color 0.25s ease;
}
.post-body .post-contact a:hover { color: var(--frost); border-color: var(--frost); }
.post-body .post-badges { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.4rem 0 2rem; }
.post-body .post-badges a {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid rgba(242, 243, 245, 0.16); border-radius: 10px;
  color: var(--ice); text-decoration: none; min-width: 175px;
  transition: border-color 0.25s ease;
}
.post-body .post-badges a:hover { border-color: var(--frost); }
.post-body .post-badges span { display: grid; line-height: 1.25; font-size: 0.95rem; font-weight: 500; }
.post-body .post-badges small {
  font-size: 0.62rem; font-weight: 400; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--mist);
}

/* Persian (RTL) posts */
article[dir='rtl'] .post-header h1,
article[dir='rtl'] .post-header .lede,
article[dir='rtl'] .post-body { font-family: 'Vazirmatn', var(--font-body); }
article[dir='rtl'] .post-header h1 { line-height: 1.5; font-size: clamp(1.6rem, 4vw, 2.4rem); }
article[dir='rtl'] .post-header time, article[dir='rtl'] .back-link { letter-spacing: 0.05em; }

/* Mixed-language posts: each paragraph is dir="auto" (set at render time), so
   Persian blocks flow right-to-left and English blocks left-to-right on their
   own. Persian glyphs fall back to Vazirmatn; RTL blocks use it fully. */
.post-body { font-family: 'Inter', 'Vazirmatn', var(--font-body); }
.post-body :dir(rtl) { font-family: 'Vazirmatn', 'Inter', sans-serif; }
