/*
Theme Name: Twenty Twenty-Five Nyys
Theme URI: https://example.com/
Description: Child theme for Twenty Twenty-Five with Nyys-specific features.
Author: Nyys
Template: twentytwentyfive
Version: 1.0.9
Text Domain: twentytwentyfive-nyys
*/

:root {
  --nyys-green: #008000;
  --nyys-green-soft: #2ea52e;
  --nyys-dark: #222;
  --nyys-border: #d7d7d7;
  --nyys-text: #2f2f2f;
  --nyys-text-soft: #5f5f5f;
  --nyys-content-width: 760px;
}

html {
  scroll-behavior: smooth;
}

body {
  background: #fff;
  color: var(--nyys-text);
}

.wp-site-blocks {
  --wp--style--global--content-size: 820px;
  --wp--style--global--wide-size: 1440px;
}

/* Perustypografia */
body,
.editor-styles-wrapper {
  line-height: 1.65;
}

p {
  margin-top: 0;
  margin-bottom: 1.15rem;
  color: var(--nyys-text);
}

ul,
ol {
  margin: 0 0 1.35rem;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 0.45rem;
}

h1,
h2,
h3,
h4 {
  color: #1f1f1f;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.3rem);
  margin: 0 0 1.2rem;
}

h2 {
  font-size: clamp(1.65rem, 2.6vw, 2.2rem);
  margin: 2.2rem 0 1rem;
}

h3 {
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  margin: 1.7rem 0 0.8rem;
}

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

figure {
  margin: 0 0 1.5rem;
}

a {
  color: var(--nyys-green);
}

a:hover {
  color: var(--nyys-green-soft);
}

hr {
  border: 0;
  border-top: 1px solid #d9d9d9;
  margin: 1.5rem 0;
}

/* Header */
.nyys-header-top {
  background: var(--nyys-green);
}

.nyys-header-brand-wrap {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.nyys-header-title {
  margin: 0;
  line-height: 1.2;
}

.nyys-header-title a {
  color: #fff !important;
  text-decoration: none !important;
  font-size: clamp(1.6rem, 3vw, 2.3rem);
  font-weight: 700;
}

.nyys-header-tagline {
  margin-top: 0.35rem;
  margin-bottom: 0;
  color: #fff !important;
  font-size: 0.98rem;
}

.nyys-header-nav {
  background: #fff;
  border-bottom: 1px solid #e4e4e4;
}

.nyys-header-nav .wp-block-navigation-item__content {
  color: #1e1e1e;
  text-decoration: none;
}

.nyys-header-nav .wp-block-navigation-item__content:hover,
.nyys-header-nav .current-menu-item > .wp-block-navigation-item__content,
.nyys-header-nav .current-menu-ancestor > .wp-block-navigation-item__content {
  color: var(--nyys-green);
}

.nyys-header-nav .wp-block-navigation__submenu-container {
  border: 1px solid #e7e7e7;
}

/* Etusivun hero */
.nyys-front-hero {
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
  margin-bottom: 2rem;
}

.nyys-front-hero .nyys-slider {
  margin: 0;
}

.nyys-front-main {
  gap: 2rem;
}

/* Etusivun entry-content ilman erillistä laatikkoa */
.home .entry-content.wp-block-post-content {
  background: transparent;
  padding: 0;
  box-shadow: none;
  border-radius: 0;
}

/* Osio-otsikot etusivulla */
.nyys-section-title {
  margin: 2.4rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #5f5f5f;
}

/* Slider */
.nyys-slider {
  position: relative;
  margin: 0 0 2rem;
  min-height: 260px;
  overflow: hidden;
  /* Slider */
  .nyys-slider {
    position: relative;
    margin: 0 0 2rem;
    min-height: clamp(260px, 38vw, 520px);
    overflow: hidden;
    background: #f4f4f4;
  }

  .nyys-slider__track {
    position: relative;
    min-height: inherit;
  }

  .nyys-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 400ms ease-in-out;
  }

  .nyys-slide.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .nyys-slide__image,
  .nyys-slide__fallback {
    width: 100%;
    height: clamp(260px, 38vw, 520px);
    min-height: 260px;
    display: block;
    object-fit: cover;
    object-position: center center;
  }

  .nyys-slide__fallback {
    background: linear-gradient(115deg, #7bc17b 0%, #2d7e2d 55%, #1d4a1d 100%);
  }

  /* Kevyt tumma kalvo koko kuvan päälle */
  .nyys-slide__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.06) 0%,
      rgba(0, 0, 0, 0.12) 55%,
      rgba(0, 0, 0, 0.18) 100%
    );
  }

  /* Teksti keskelle */
  .nyys-slide__content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 4.5rem;
    text-align: center;
    z-index: 2;
    pointer-events: none;
  }

  /* Tyhjät WP:n lisä-p:t pois */
  .nyys-slide__content p:empty,
  .nyys-slide p:empty,
  .nyys-slider > p {
    display: none;
    margin: 0;
  }

  /* Tekstille oma tausta, ei koko kuvalle */
  .nyys-slide__content p {
    margin: 0;
    max-width: 34ch;
    padding: 0.8rem 1.15rem;
    color: #fff !important;
    font-size: clamp(1.05rem, 1.8vw, 1.6rem);
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 10px;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.28);
  }

  /* Nuolet */
  .nyys-slider__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    cursor: pointer;
    z-index: 3;
    display: grid;
    place-items: center;
    line-height: 1;
  }

  .nyys-slider__nav:hover {
    background: rgba(0, 0, 0, 0.52);
  }

  .nyys-slider__nav--prev {
    left: 1rem;
  }

  .nyys-slider__nav--next {
    right: 1rem;
  }

  /* Dotit */
  .nyys-slider__dots {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 3;
  }

  .nyys-slider__dots br {
    display: none;
  }

  .nyys-slider__dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.5);
  }

  .nyys-slider__dot.is-active {
    background: #fff;
  }

  @media (max-width: 640px) {
    .nyys-slider {
      min-height: 220px;
    }

    .nyys-slide__image,
    .nyys-slide__fallback {
      height: 220px;
      min-height: 220px;
    }

    .nyys-slide__content {
      padding: 1rem 3rem;
    }

    .nyys-slide__content p {
      max-width: 26ch;
      padding: 0.65rem 0.9rem;
      font-size: 1rem;
    }

    .nyys-slider__nav {
      width: 36px;
      height: 36px;
    }

    .nyys-slider__nav--prev {
      left: 0.6rem;
    }

    .nyys-slider__nav--next {
      right: 0.6rem;
    }
  }
}

.nyys-slider__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.45);
}

.nyys-slider__dot.is-active {
  background: #fff;
}

/* Palvelut-grid */
.nyys-palvelut-grid {
  display: grid;
  gap: 1.5rem;
  margin-top: 0.8rem;
  align-items: start;
}

.nyys-palvelut-grid.columns-1 {
  grid-template-columns: 1fr;
}

.nyys-palvelut-grid.columns-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nyys-palvelut-grid.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.nyys-palvelut-grid.columns-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.nyys-palvelut-grid.columns-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.nyys-palvelut-grid.columns-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.nyys-palvelu-card {
  display: block;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0.75rem 1rem;
  text-align: center;
  transition: transform 220ms ease;
}

.nyys-palvelu-card:hover {
  transform: translateY(-3px);
}

.nyys-palvelu-thumb-link {
  display: block;
  width: 100px;
  height: 100px;
  margin: 0 auto 0.9rem;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: 0 0 0 4px rgba(0, 128, 0, 0.09);
  text-decoration: none !important;
}

.nyys-palvelu-thumb-link img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 999px;
}

.nyys-palvelu-title {
  margin-top: 0.25rem;
  margin-bottom: 0.45rem;
  font-size: 1.12rem;
  line-height: 1.3;
}

.nyys-palvelu-title-link {
  color: var(--nyys-green);
  text-decoration: none;
}

.nyys-palvelu-title-link:hover {
  color: var(--nyys-green);
  text-decoration: underline;
}

.nyys-palvelu-description {
  margin: 0 auto;
  max-width: 28ch;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #4d4d4d;
}

.nyys-empty {
  opacity: 0.85;
}

/* Blogikortit etusivulla */
.nyys-front-blog .wp-block-post-template {
  gap: 1.2rem;
  align-items: stretch;
}

.nyys-front-blog .wp-block-post-template > li {
  min-width: 0;
}

.nyys-front-blog .wp-block-post-template .wp-block-post-excerpt__excerpt {
  font-size: 0.95rem;
  line-height: 1.45;
}

.nyys-blog-card {
  height: 100%;
  border: 1px solid var(--nyys-border);
  padding: 0.8rem;
  overflow: hidden;
  background: #fff;
}

.nyys-blog-card .wp-block-post-featured-image {
  margin: 0 0 0.75rem;
  overflow: hidden;
}

.nyys-blog-card .wp-block-post-featured-image img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
}

.nyys-blog-card .wp-block-post-title {
  margin-top: 0.25rem;
}

.nyys-blog-card .wp-block-post-title a {
  color: var(--nyys-dark);
  text-decoration: none;
}

.nyys-blog-card .wp-block-post-title a:hover {
  color: var(--nyys-green);
}

.nyys-blog-card .wp-block-post-excerpt__more-link {
  color: var(--nyys-green);
  font-weight: 600;
}

/* Sisäsivut */
body:not(.home) .wp-site-blocks > main.wp-block-group {
  padding-top: clamp(1.5rem, 3vw, 3rem);
  padding-bottom: clamp(2.5rem, 5vw, 4rem);
}

body:not(.home) main > .wp-block-group.alignfull {
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding-left: 1.25rem !important;
  padding-right: 1.25rem !important;
  box-sizing: border-box;
}

/* Featured image, otsikko ja sisältö samaan leveyteen */
body:not(.home) main > .wp-block-group.alignfull > .wp-block-post-featured-image,
body:not(.home) .wp-block-post-title,
body:not(.home) .entry-content.wp-block-post-content {
  max-width: var(--nyys-content-width);
  margin-left: auto;
  margin-right: auto;
}

/* Featured image */
body:not(.home) main > .wp-block-group.alignfull > .wp-block-post-featured-image {
  margin-bottom: 1.75rem;
}

body:not(.home) main > .wp-block-group.alignfull > .wp-block-post-featured-image img {
  display: block;
  width: 100%;
  height: auto;
}

/* Korjaus WP:n alignfull-käyttäytymiseen sisäsivuilla */
body:not(.home) .entry-content.alignfull.wp-block-post-content {
  width: 100%;
  max-width: var(--nyys-content-width);
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Sisältö ilman ylimääräistä sisäpaddingia */
body:not(.home) .entry-content.wp-block-post-content {
  background: transparent;
  padding: 0 !important;
  box-shadow: none;
  border-radius: 0;
}

/* Sisällön elementit täyttävät saman palstan */
body:not(.home) .entry-content.wp-block-post-content > * {
  max-width: 100%;
}

/* Tekstit */
body:not(.home) .entry-content.wp-block-post-content p,
body:not(.home) .entry-content.wp-block-post-content li {
  font-size: 1.08rem;
  color: var(--nyys-text);
}

/* Listat kuntoon */
body:not(.home) .entry-content.wp-block-post-content ul,
body:not(.home) .entry-content.wp-block-post-content ol {
  margin: 0 0 1.5rem;
  padding-left: 1.4rem;
}

body:not(.home) .entry-content.wp-block-post-content li {
  padding-left: 0.1rem;
}

body:not(.home) .entry-content.wp-block-post-content p:last-child {
  margin-bottom: 0;
}

/* Tyhjät p-elementit pois */
body:not(.home) .entry-content.wp-block-post-content p:empty {
  display: none;
}

/* Iframe responsiiviseksi */
body:not(.home) .entry-content.wp-block-post-content iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 420px;
  border: 0;
}

/* Footer */
.nyys-footer {
  margin-top: 2.5rem;
  border-top: 1px solid #e5e5e5;
  background: #f6f6f6;
}

.nyys-footer-inner {
  text-align: left;
  max-width: 1100px;
  margin: 0 auto;
}

.nyys-footer-columns {
  display: grid;
  grid-template-columns: minmax(320px, 1.2fr) minmax(260px, 0.8fr);
  gap: 56px;
  align-items: start;
}

.nyys-footer-columns > * {
  margin: 0 !important;
}

.nyys-footer-column {
  min-width: 0;
}

.nyys-footer-column--right {
  justify-self: stretch;
}

.nyys-footer-widget-slot {
  width: 100%;
}

.nyys-footer-widget-slot-right {
  max-width: 420px;
  margin-left: 0;
}

.nyys-footer-widget {
  margin: 0;
}

.nyys-footer-widget-title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  line-height: 1.2;
  font-weight: 700;
}

.nyys-footer-widget p {
  margin: 0;
  line-height: 1.35;
}

.nyys-footer-contact-role,
.nyys-footer-contact-name {
  display: block;
  font-weight: 600;
}

.nyys-footer-contact-email,
.nyys-footer-contact-phone {
  display: block;
}

.nyys-footer-contact-email {
  word-break: break-word;
}

.nyys-footer-contact-note {
  margin: 0;
  color: #666;
  font-size: 0.9rem;
}

/* Oletus-yhteystiedot selkeina ryhmina */
.nyys-footer-contact-default {
  max-width: 430px;
  font-size: 0.98rem;
  line-height: 1.34;
}

.nyys-footer-contact-default > .nyys-footer-widget-title {
  margin-bottom: 0.9rem;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 600;
}

.nyys-footer-contact-default .nyys-footer-contact-block {
  margin: 0;
  line-height: 1.32;
}

.nyys-footer-contact-default .nyys-footer-contact-block + .nyys-footer-contact-block {
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid #e1e1e1;
}

.nyys-footer-contact-default .nyys-footer-contact-block br {
  display: none;
}

.nyys-footer-contact-default .nyys-footer-contact-role,
.nyys-footer-contact-default .nyys-footer-contact-name {
  margin-bottom: 0.2rem;
  line-height: 1.28;
}

.nyys-footer-contact-default .nyys-footer-contact-email,
.nyys-footer-contact-default .nyys-footer-contact-phone {
  margin-top: 0.1rem;
  line-height: 1.28;
  font-size: 0.95rem;
}

.nyys-footer-right-default .nyys-footer-widget-title {
  margin-bottom: 0.65rem;
  font-size: 1rem;
  line-height: 1.2;
  font-weight: 600;
}

.nyys-footer-recent-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.nyys-footer-recent-list li + li {
  margin-top: 0.15rem;
}

.nyys-footer-recent-list a {
  display: block;
  padding: 0.62rem 0;
  text-decoration: none;
  color: #3b3b3b;
  font-size: 0.95rem;
  line-height: 1.35;
  border-bottom: 1px solid #e5e5e5;
}

.nyys-footer-recent-list a:hover {
  color: #1f1f1f;
  text-decoration: underline;
}

.nyys-footer-recent-list a br {
  display: none;
}

.nyys-footer-meta {
  margin-top: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid #e5e5e5;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.nyys-footer-meta p {
  margin: 0;
}

.nyys-footer-copyright-text {
  font-size: 0.85rem;
  color: #606060;
}

@media (max-width: 768px) {
  .nyys-footer-columns {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .nyys-footer-widget-slot-right {
    max-width: 430px;
  }

  .nyys-footer-meta {
    justify-content: flex-start;
    margin-top: 1.2rem;
    padding-top: 0.8rem;
  }
}

/* Tablet / pienempi desktop */
@media (max-width: 1000px) {
  .nyys-slide__image,
  .nyys-slide__fallback {
    min-height: 280px;
  }

  .nyys-palvelut-grid.columns-4,
  .nyys-palvelut-grid.columns-5,
  .nyys-palvelut-grid.columns-6 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Tablet ja mobiili */
@media (max-width: 820px) {
  body:not(.home) .wp-site-blocks > main.wp-block-group {
    padding-top: 1rem;
    padding-bottom: 2rem;
  }

  body:not(.home) main > .wp-block-group.alignfull {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  body:not(.home) main > .wp-block-group.alignfull > .wp-block-post-featured-image,
  body:not(.home) .wp-block-post-title,
  body:not(.home) .entry-content.wp-block-post-content {
    max-width: 100%;
  }

}

/* Mobiili */
@media (max-width: 640px) {
  .nyys-slide__image,
  .nyys-slide__fallback {
    min-height: 210px;
  }

  .nyys-slider__nav {
    width: 36px;
    height: 36px;
  }

  .nyys-palvelut-grid.columns-2,
  .nyys-palvelut-grid.columns-3,
  .nyys-palvelut-grid.columns-4,
  .nyys-palvelut-grid.columns-5,
  .nyys-palvelut-grid.columns-6 {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: clamp(1.9rem, 8vw, 2.5rem);
  }

  h2 {
    font-size: clamp(1.45rem, 6vw, 1.95rem);
  }

  body:not(.home) .entry-content.wp-block-post-content p,
  body:not(.home) .entry-content.wp-block-post-content li {
    font-size: 1rem;
  }

  body:not(.home) .entry-content.wp-block-post-content ul,
  body:not(.home) .entry-content.wp-block-post-content ol {
    padding-left: 1.15rem;
  }

  body:not(.home) .entry-content.wp-block-post-content iframe {
    min-height: 320px;
  }
}

@media (max-width: 480px) {
  body:not(.home) main > .wp-block-group.alignfull {
    padding-left: 0.875rem !important;
    padding-right: 0.875rem !important;
  }

  .nyys-header-brand-wrap {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
  }

  .nyys-header-title a {
    font-size: 1.55rem;
  }

  .nyys-header-tagline {
    font-size: 0.9rem;
  }
}

/* Header ja nav sliderin yläpuolelle */
.nyys-header-top,
.nyys-header-nav,
header.wp-block-template-part {
  position: relative;
  z-index: 50;
}

/* Pudotusvalikko vielä navin yläpuolelle */
.nyys-header-nav .wp-block-navigation__submenu-container,
.nyys-header-nav .wp-block-navigation__responsive-container {
  position: relative;
  z-index: 60;
}

/* Slider varmasti navigaation alle */
.nyys-front-hero,
.nyys-slider {
  position: relative;
  z-index: 1;
}

/* Mobiilivalikon skrolli pienille näytöille */
@media (max-width: 782px) {
  .nyys-header-nav .wp-block-navigation__responsive-container.is-menu-open {
    position: fixed;
    inset: 0;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .nyys-header-nav .wp-block-navigation__responsive-dialog {
    height: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .nyys-header-nav .wp-block-navigation__responsive-container-content {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: max(1rem, env(safe-area-inset-bottom));
  }
}
