/* ==========================================================================
   Sabai v3: galleria/, blogi/ (+ postaukset), tietosuojaseloste/, 404.html
   Ladataan style.css:n jälkeen. Käyttää style.css:n tokeneita ja komponentteja;
   tässä vain näiden sivujen omat osat. Lightboxin JS: js/page-media.js.
   ========================================================================== */

/* ---------- aktiivinen sivu alavalikoissa (Galleria, Blogi, Tietosuojaseloste) ---------- */
.mpanel__sub a[aria-current] { color: var(--gold-2); }
.footer__links a[aria-current] {
  color: var(--cream);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 6px;
  text-decoration-color: var(--gold);
}
.footer__bottom a[aria-current] { color: var(--cream); text-decoration-color: var(--gold); }

/* ---------- sivun pää: kiinteän headerin alta ---------- */
.page-head { padding-top: calc(var(--header-h) + clamp(56px, 7vw, 112px)); }

/* ---------- galleria ---------- */
.gallery-head { align-items: end; margin-bottom: clamp(48px, 5vw, 72px); }
.gallery-head h1 { max-width: none; }
.gallery-head__aside { padding-bottom: .55em; }
@media (max-width: 899px) {
  .gallery-head__aside { padding-bottom: 0; margin-top: 20px; }
}

.masonry { columns: 3; column-gap: 16px; }
@media (max-width: 1023px) { .masonry { columns: 2; } }
@media (max-width: 599px) { .masonry { columns: 1; } }
.masonry__item { break-inside: avoid; margin-bottom: 16px; }
/* JS: rivijärjestyksinen masonry (page-media.js laskee jokaiselle kuvalle rivispanin) */
.masonry.is-grid {
  columns: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 2px;
  column-gap: 16px;
}
@media (max-width: 1023px) { .masonry.is-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .masonry.is-grid { grid-template-columns: minmax(0, 1fr); } }
.masonry.is-grid .masonry__item { margin: 0; align-self: start; }
.masonry__link { display: block; cursor: zoom-in; }
.masonry__link > img { width: 100%; height: auto; transition: transform var(--dur-img) var(--ease-out); }
.masonry__link:hover > img { transform: scale(1.03); }
.masonry__link::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px transparent;
  transition: box-shadow var(--dur-micro) var(--ease-out);
  pointer-events: none;
}
.masonry__link:hover::after { box-shadow: inset 0 0 0 1px var(--line-gold); }
.masonry__link:focus-visible { outline-offset: 4px; border-radius: var(--radius); }

/* ---------- lightbox: <dialog>, verho-avaus ---------- */
.lb {
  --lb-side: 96px;
  --lb-bar: 76px;
  --lb-cap: 96px;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0 var(--gutter);
  border: 0;
  background: rgba(20, 13, 8, .97);
  color: var(--cream);
  overflow: hidden;
  overscroll-behavior: contain;
}
.lb[open] {
  display: grid;
  grid-template-columns: var(--lb-side) minmax(0, 1fr) var(--lb-side);
  grid-template-rows: var(--lb-bar) minmax(0, 1fr) minmax(var(--lb-cap), auto);
  grid-template-areas:
    "bar  bar   bar"
    "prev stage next"
    ".    cap   .";
  animation: lb-fade 260ms var(--ease-out) both;
}
.lb::backdrop { background: transparent; }
.lb.is-closing { animation: lb-fade-out 280ms var(--ease-out) both; }
@keyframes lb-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lb-fade-out { from { opacity: 1; } to { opacity: 0; } }

.lb__bar { grid-area: bar; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lb__count { font-family: var(--f-display); font-size: 1.375rem; line-height: 1; color: var(--cream-70); font-variant-numeric: lining-nums tabular-nums; }
.lb__count [data-lb-current] { color: var(--gold-2); }
.lb__stage {
  grid-area: stage;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}
.lb__pic { position: relative; line-height: 0; }
.lb__img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 2 * var(--gutter) - 2 * var(--lb-side));
  max-height: calc(100vh - var(--lb-bar) - var(--lb-cap) - 16px);
  max-height: calc(100dvh - var(--lb-bar) - var(--lb-cap) - 16px);
  border-radius: var(--radius);
  transition: opacity 220ms var(--ease-out);
}
.lb__img.is-swapping { opacity: 0; }
/* verho: kuva aukeaa keskeltä sivuille, kultaiset reunaviivat kulkevat mukana */
.lb__pic::before, .lb__pic::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: var(--gold-2);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
/* avaus: pehmeä häivytys + kevyt skaalaus (Alex 16.10.: ei verhoa) */
.lb.is-opening .lb__img { animation: lb-in 520ms var(--ease-out) both; }
.lb.is-closing .lb__img { animation: lb-out 240ms var(--ease-out) both; }
@keyframes lb-in { from { opacity: 0; scale: .96; } to { opacity: 1; scale: 1; } }
@keyframes lb-out { from { opacity: 1; scale: 1; } to { opacity: 0; scale: .98; } }
@keyframes lb-edge-l { 0% { left: 50%; opacity: .9; } 80% { opacity: .7; } 100% { left: 0; opacity: 0; } }
@keyframes lb-edge-r { 0% { left: 50%; opacity: .9; } 80% { opacity: .7; } 100% { left: calc(100% - 1px); opacity: 0; } }

.lb__cap {
  grid-area: cap;
  align-self: start;
  justify-self: center;
  max-width: 62ch;
  padding: 18px 0 24px;
  text-align: center;
  font-size: 15px;
  line-height: 1.5;
  color: var(--cream-70);
  text-wrap: balance;
}
.lb__btn {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line-gold);
  color: var(--cream);
  transition: border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out);
}
.lb__btn svg { width: 20px; height: 20px; }
.lb__btn:hover { border-color: var(--gold-2); color: var(--gold-2); background: rgba(201, 162, 74, .06); }
.lb__close { margin-right: -4px; }
.lb__nav { align-self: center; }
.lb__prev { grid-area: prev; justify-self: start; }
.lb__next { grid-area: next; justify-self: end; }
.lb__prev svg { transition: transform var(--dur-micro) var(--ease-out); }
.lb__next svg { transition: transform var(--dur-micro) var(--ease-out); }
.lb__prev:hover svg { transform: translateX(-3px); }
.lb__next:hover svg { transform: translateX(3px); }

@media (max-width: 767px) {
  .lb {
    --lb-side: 0px;
    --lb-bar: 64px;
    --lb-cap: 112px;
  }
  .lb[open] {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-areas:
      "bar   bar   bar"
      "stage stage stage"
      "prev  cap   next";
    column-gap: 12px;
  }
  .lb__nav { align-self: start; margin-top: 14px; }
  .lb__cap { padding-top: 16px; font-size: 14px; }
}

/* ---------- blogi: listaus ---------- */
.blog-head { margin-bottom: clamp(48px, 5vw, 72px); }
.blog-grid { row-gap: 64px; align-items: start; }
/* epäsymmetria: toinen kirjoitus nousee otsikon viereen (kuten etusivun avauslauseen kuva) */
@media (min-width: 900px) {
  .blog-grid > .blog-card:nth-child(2) { margin-top: calc(-1 * (22px + clamp(3rem, 7.5vw, 7.25rem) + clamp(48px, 5vw, 72px))); }
}
.blog-card { position: relative; display: flex; flex-direction: column; }
.blog-card__media--native { max-width: 700px; }
.blog-card__body { padding-top: 28px; display: flex; flex-direction: column; flex: 1; }
.blog-card__date { margin-top: 14px; font-size: 14px; line-height: 1.4; color: var(--cream-70); }
.blog-card__title {
  font-size: clamp(1.625rem, 1.1rem + 1.4vw, 2.125rem);
  line-height: 1.12;
  font-weight: 400;
  max-width: 30ch;
}
.blog-card__title a { transition: color var(--dur-micro) var(--ease-out); }
.blog-card__title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.blog-card__title a:focus-visible { outline: none; }
.blog-card:has(a:focus-visible) { outline: 2px solid var(--gold); outline-offset: 8px; border-radius: var(--radius); }
@media (hover: hover) {
  .blog-card:hover .blog-card__title a { color: var(--gold-2); }
  .blog-card:hover .blog-card__more { color: var(--gold-2); text-decoration-color: var(--gold-2); }
  .blog-card:hover .blog-card__more svg { transform: translateX(4px); }
  .blog-card:hover .media--zoom > img { transform: scale(1.03); }
}
.blog-card__ingress { margin-top: 18px; max-width: 54ch; }
.blog-card__more { margin-top: auto; padding-top: 28px; align-self: flex-start; }

/* ---------- blogi: postaus ---------- */
.post__col { max-width: 64ch; margin-inline: auto; }
.post__head h1 {
  font-size: clamp(1.8rem, 1.2rem + 2.6vw, 3.25rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  max-width: none;
}
.post__date { margin-top: 20px; font-size: 14px; line-height: 1.4; color: var(--cream-70); }
.post__figure { margin-top: clamp(40px, 5vw, 56px); }
.post__figure--native { max-width: 700px; }
.post__body { margin-top: clamp(40px, 5vw, 56px); }
.post__body > p + p { margin-top: 1.1em; }
.post__body > p:first-child {
  font-family: var(--f-display);
  font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  line-height: 1.38;
  color: var(--cream);
}
.post__body > p:first-child + p { margin-top: 1.4em; }
.post__body > .lotus { margin-top: clamp(48px, 5vw, 64px); }
.post__body h2 { font-size: clamp(1.875rem, 2.8vw, 2.5rem); line-height: 1.1; max-width: none; }
.post__list { margin-top: 24px; margin-bottom: clamp(40px, 5vw, 56px); border-bottom: 1px solid var(--line); }
.post__list li { padding: 18px 0; border-top: 1px solid var(--line); color: var(--cream-70); }
.post__list strong { display: block; margin-bottom: 4px; font-weight: 500; color: var(--cream); }
.post__back { margin-top: clamp(48px, 5vw, 64px); }
.link-arrow--back { flex-direction: row-reverse; }
.link-arrow--back svg { transform: scaleX(-1); }
.link-arrow--back:hover svg { transform: scaleX(-1) translateX(4px); }

/* ---------- tietosuojaseloste ---------- */
.legal__col { max-width: 64ch; margin-inline: auto; }
.legal__layout { position: relative; }
.legal__toc { display: none; }
@media (min-width: 1280px) {
  .legal__layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 64ch) minmax(0, 1fr); column-gap: var(--col-gap); }
  .legal__layout > .legal__col { grid-column: 2; margin: 0; max-width: none; }
  .legal__toc {
    display: block;
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    position: sticky;
    top: calc(var(--header-h) + 48px);
    margin-top: 200px;
    justify-self: end;
    width: min(100%, 16rem);
    margin-right: clamp(16px, 3vw, 56px);
  }
}
.legal__toc ol { border-left: 1px solid var(--line); }
.legal__toc a {
  display: block;
  padding: 6px 0 6px 18px;
  margin-left: -1px;
  border-left: 1px solid transparent;
  font-size: 14px;
  line-height: 1.4;
  color: var(--cream-70);
  transition: color var(--dur-micro), border-color var(--dur-micro);
}
.legal__toc a:hover { color: var(--cream); }
.legal__toc a[aria-current="true"] { color: var(--gold-2); border-left-color: var(--gold); }
.legal__head h1 { max-width: none; font-size: clamp(2.75rem, 1.6rem + 4.4vw, 5rem); }
.legal__sec { margin-top: clamp(56px, 6vw, 80px); }
.legal__head + .legal__sec { margin-top: clamp(48px, 5vw, 72px); }
.legal__sec h2 { font-size: clamp(1.75rem, 2.4vw, 2.25rem); line-height: 1.12; max-width: none; }
.legal__sec h2 + * { margin-top: 18px; }
.legal__sec p + p { margin-top: 1em; }
.legal__sec p { color: var(--cream-70); }
.legal__sec a:not(.link-arrow) {
  color: var(--cream);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .22em;
  text-decoration-color: var(--line-gold);
  transition: color var(--dur-micro), text-decoration-color var(--dur-micro);
  overflow-wrap: anywhere;
}
.legal__sec a:not(.link-arrow):hover { color: var(--gold-2); text-decoration-color: var(--gold-2); }
.legal__list { margin-top: 20px; border-bottom: 1px solid var(--line); }
.legal__list + p { margin-top: 20px; }
.legal__list li { padding: 16px 0; border-top: 1px solid var(--line); color: var(--cream-70); }
.legal__list strong { display: block; margin-bottom: 2px; font-weight: 500; color: var(--cream); }
.legal__facts { margin: 0; border-bottom: 1px solid var(--line); }
.legal__facts > div {
  display: grid;
  grid-template-columns: minmax(0, 11rem) minmax(0, 1fr);
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.legal__facts dt { color: var(--cream-70); font-size: 15px; padding-top: .1em; }
.legal__facts dd { margin: 0; }
@media (max-width: 479px) {
  .legal__facts > div { grid-template-columns: 1fr; gap: 2px; }
}
.legal__action { margin-top: 28px; }

/* ---------- 404 ---------- */
.nf {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--bg-deep);
  isolation: isolate;
}
.nf__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.nf__scrim {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 60% 70% at 50% 55%, rgba(26, 17, 11, .9) 0%, rgba(26, 17, 11, .78) 55%, rgba(26, 17, 11, .6) 100%);
}
.nf__inner { padding-top: calc(var(--header-h) + 64px); padding-bottom: 96px; }
.nf__content { max-width: 60rem; margin-inline: auto; text-align: center; }
.nf__content h1 { max-width: 10ch; margin-inline: auto; }
@media (min-width: 900px) { .nf__content h1 { max-width: none; } }
.nf__content p { margin: 20px auto 0; max-width: 44ch; }
.nf__actions { margin-top: 28px; justify-content: center; }

/* ---------- liikkeen rajoitus ---------- */
@media (prefers-reduced-motion: reduce) {
  .lb[open], .lb.is-closing { animation: none; }
  .lb.is-opening .lb__img, .lb.is-closing .lb__img,
  .lb.is-opening .lb__pic::before, .lb.is-opening .lb__pic::after { animation: none; }
  .lb__img, .masonry__link > img { transition: none; }
}

/* breakpoint-kierros 15.10. */
@media (max-height: 500px) and (orientation: landscape) {
  .page-head { padding-top: calc(var(--header-h) + 1.25rem); }
  .nf__inner { padding-top: calc(var(--header-h) + 1.25rem); padding-bottom: 2rem; }
  .nf__content h1 { max-width: none; }
  .nf__content p { margin-top: 0.75rem; max-width: 64ch; }
  .nf__actions { margin-top: 1.25rem; }
}
/* kapea puhelin: pitkä blogiotsikko enintään 3 riville */
@media (max-width: 389px) {
  .post__head h1 { font-size: 1.625rem; }
}
