/*
Theme Name: Turfgrass Mastery
Theme URI: https://turfgrassmastery.fi
Author: Turfgrass Mastery
Description: Brand theme for Turfgrass Mastery — modern agronomy for Nordic turf systems. Deep Green & Off-white palette, Iosevka Charon typography, restrained editorial layout. Built as a block theme, fully editable in the WordPress Site Editor.
Version: 1.4.1
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: turfgrass-mastery
*/

/* Brand extras beyond theme.json */

/* Sticky header — stays pinned while scrolling */
header.wp-block-template-part {
  position: sticky;
  top: 0;
  z-index: 90;
}
/* Breathing room at the header edges (logo left, menu + flags right) */
header.wp-block-template-part > .wp-block-group {
  padding-left: 2.75rem !important;
  padding-right: 2.75rem !important;
}
@media (max-width: 781px) {
  header.wp-block-template-part > .wp-block-group {
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
  }
}
/* The inner full-width row must respect the header padding, not escape it */
header.wp-block-template-part > .wp-block-group > .wp-block-group.alignfull {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: auto !important;
}

/* Images placed directly in the content column are centered (e.g. the About hero) */
.wp-block-post-content .is-layout-constrained > .wp-block-image img {
  margin-left: auto;
  margin-right: auto;
  display: block;
}
body.admin-bar header.wp-block-template-part { top: 32px; }
@media screen and (max-width: 782px) {
  body.admin-bar header.wp-block-template-part { top: 46px; }
}

/* Self-hosted brand fonts — identical rendering on every device, no external requests */
@font-face { font-family: "Iosevka Charon"; font-weight: 300; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-300.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon"; font-weight: 400; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-400.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon"; font-weight: 500; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-500.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon"; font-weight: 700; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-700.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon"; font-weight: 400; font-style: italic; font-display: swap; src: url(assets/fonts/iosevka-charon-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon Mono"; font-weight: 300; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-mono-300.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-mono-400.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-mono-500.woff2) format("woff2"); }
@font-face { font-family: "Iosevka Charon Mono"; font-weight: 700; font-style: normal; font-display: swap; src: url(assets/fonts/iosevka-charon-mono-700.woff2) format("woff2"); }

/* Dot-grid pattern (static fallback). When tm-waves.js runs, it upgrades these
   elements to a living, wave-animated canvas and layers the brand blur texture. */
.tm-dotgrid-light {
  background-image: radial-gradient(rgba(239, 236, 231, 0.22) 1px, transparent 1.5px);
  background-size: 22px 22px;
}
.tm-dotgrid-dark {
  background-image: radial-gradient(rgba(19, 51, 28, 0.15) 1px, transparent 1.5px);
  background-size: 22px 22px;
}

.tm-waves-live {
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(rgba(19, 51, 28, 0.82), rgba(19, 51, 28, 0.88)), url(assets/textures/texture-green.jpg);
  background-size: cover;
  background-position: center;
}
.tm-waves-live > * { position: relative; z-index: 2; }
canvas.tm-waves-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  /* WP constrained layout caps child widths — the canvas must always span the full section */
  max-width: none !important;
  margin: 0 !important;
  width: 100%;
  height: 100%;
}

/* Hero — tall, vertically centered, big display heading (matches the design draft) */
.tm-perspective {
  min-height: 86vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tm-perspective h1 {
  font-size: clamp(46px, 6.6vw, 100px) !important;
  line-height: 1.08;
  max-width: 16ch;
}
/* Left-align the hero column inside the 1360px content area (as in the draft) */
.wp-block-group.tm-perspective.tm-dotgrid-light > h1,
.wp-block-group.tm-perspective.tm-dotgrid-light > p,
.wp-block-group.tm-perspective.tm-dotgrid-light > .wp-block-buttons {
  margin-left: max(0px, calc((100% - 1360px) / 2)) !important;
  margin-right: 0 !important;
}

/* Hero: close-up turf photo under the animated dot waves.
   Add the class "tm-hero-photo" to any tm-dotgrid-light group to use it. */
.tm-hero-photo,
.tm-hero-photo.tm-waves-live {
  background-image: linear-gradient(rgba(19, 51, 28, 0.60), rgba(19, 51, 28, 0.82)), url(assets/textures/hero-photo.jpg);
  background-size: cover;
  background-position: center bottom;
}

/* Hero side panel — tm-waves.js collapses the links behind the rings icon */
.tm-hero-panel img { cursor: pointer; transition: transform 0.25s; }
.tm-hero-panel img:hover { transform: scale(1.08); }
.tm-hero-panel.tm-collapsed .tm-panel-link { display: none; }
.tm-hero-panel.tm-collapsible:not(.tm-collapsed) .tm-panel-link { animation: tm-panel-in 0.3s ease; }
@keyframes tm-panel-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: none; }
}

/* Brand blur textures (from the brand book) as reusable background classes */
.tm-texture-green { background-image: linear-gradient(rgba(19,51,28,.80), rgba(19,51,28,.88)), url(assets/textures/texture-green.jpg); background-size: cover; background-position: center; }
.tm-texture-moss  { background-image: linear-gradient(rgba(19,51,28,.84), rgba(19,51,28,.90)), url(assets/textures/texture-moss.jpg);  background-size: cover; background-position: center; }
.tm-texture-clay  { background-image: linear-gradient(rgba(210,206,193,.84), rgba(210,206,193,.84)), url(assets/textures/texture-clay.jpg); background-size: cover; background-position: center; }
.tm-texture-gold  { background-image: linear-gradient(rgba(19,51,28,.72), rgba(19,51,28,.84)), url(assets/textures/texture-gold.jpg);  background-size: cover; background-position: center; }

.wp-block-quote {
  background-color: var(--wp--preset--color--clay);
  background-image: linear-gradient(rgba(210, 206, 193, 0.84), rgba(210, 206, 193, 0.84)), url(assets/textures/texture-clay.jpg);
  background-size: cover;
  background-position: center;
  border: none;
  padding: 1.8rem 2rem;
  font-style: italic;
}
.wp-block-quote cite {
  display: block;
  margin-top: 1rem;
  font-style: normal;
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--wp--preset--color--soil);
}

.wp-block-separator {
  border-color: var(--wp--preset--color--turfgrass-green);
  opacity: 1;
}

/* mono uppercase label style — add class "tm-label" to a paragraph */
.tm-label {
  font-family: var(--wp--preset--font-family--mono);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wp--preset--color--soil);
}

a { text-underline-offset: 3px; }

/* Links on Turfgrass Green backgrounds inherit the light text colour
   (otherwise WP paints them dark green — invisible on the dark ground) */
.has-turfgrass-green-background-color a,
.tm-waves-live a,
footer.wp-block-template-part a { color: currentColor; }

/* Wide 1360px content (as in the design draft) — body text stays readable at 66ch */
.wp-block-post-content p:not(.has-text-align-center) { max-width: 66ch; }
.tm-svc p, .tm-steps p, .tm-proof2 p, .tm-marquee-track, blockquote p { max-width: none; }

/* Everything aligns flush left at the SAME edge — the left edge of the
   centered 1360px content column (like the draft). WP would otherwise center
   narrow paragraphs on their own line, off-grid from the headings. */
.wp-block-post-content .is-layout-constrained > p:not(.has-text-align-center),
.wp-block-post-content .is-layout-constrained > .wp-block-buttons {
  margin-left: max(0px, calc((100% - 1360px) / 2)) !important;
  margin-right: auto !important;
}

/* Referrals — narrow round portrait column, text beside it */
.tm-ref.wp-block-columns { gap: 48px; }
.tm-ref > .wp-block-column:first-child { flex: 0 0 220px; }
.tm-ref > .wp-block-column:first-child img {
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--wp--preset--color--turfgrass-green);
  width: 100%;
  height: auto;
}
.tm-ref h3 { margin: 0 0 6px; }
@media (max-width: 781px) {
  .tm-ref > .wp-block-column:first-child { flex: 0 0 auto; max-width: 180px; }
}

/* Project cases — asymmetric split, framed sticky image */
.tm-case.wp-block-columns { gap: 56px; }
.tm-case > .wp-block-column:first-child { flex: 0 0 42%; }
.tm-case > .wp-block-column:first-child figure { position: sticky; top: 170px; margin: 0; }
.tm-case img { border: 1px solid var(--wp--preset--color--turfgrass-green); width: 100%; height: auto; }
@media (max-width: 781px) {
  .tm-case > .wp-block-column:first-child { flex: 1 1 auto; }
  .tm-case > .wp-block-column:first-child figure { position: static; }
}

/* Brand photo grade — matches the treatment applied to the portfolio images
   (muted colour, soft matte contrast, gentle warmth). Add class "tm-graded"
   to any image block to apply it. */
.tm-graded img, img.tm-graded {
  filter: saturate(0.8) contrast(0.86) brightness(1.06) sepia(0.05);
}

/* Portfolio — moodboard collage after the brand book "Image concept" page:
   staggered heights, generous space, no frames */
.tm-pf .pfrow { display: flex; gap: 26px; align-items: center; margin-bottom: 36px; }
.tm-pf .pfrow:last-child { margin-bottom: 0; }
.tm-pf .pfrow.indent { padding-left: 6%; }
.tm-pf .pfi { flex: none; overflow: hidden; }
.tm-pf .pfi img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s ease; }
.tm-pf .pfi:hover img { transform: scale(1.04); }

/* ---- Preview-parity sections (proof strip, service cards, system steps) ---- */
img.tm-ic { height: 46px; width: 46px; display: block; margin-bottom: 16px; }

/* Proof strip / timeline — cells separated by hairlines */
.tm-proof2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0; border: 1px solid var(--wp--preset--color--turfgrass-green); background: var(--wp--preset--color--off-white); }
.tm-proof2 .cell { padding: 44px 32px; border-left: 1px solid var(--wp--preset--color--turfgrass-green); }
.tm-proof2 .cell:first-child { border-left: none; }
.tm-proof2 .num { font-family: var(--wp--preset--font-family--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--wp--preset--color--soil); display: block; margin-bottom: 14px; }
.tm-proof2 .cell p { font-size: 18px; line-height: 1.45; font-weight: 500; margin: 0; }
.tm-proof2 img.tm-ic { height: 40px; width: 40px; }

/* Service cards — shared hairline grid on green */
.tm-svc { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1px; background: var(--wp--preset--color--turfgrass-green); border: 1px solid var(--wp--preset--color--turfgrass-green); margin-top: 48px; }
.tm-svc .card { background: var(--wp--preset--color--off-white); padding: 34px 26px; transition: background 0.2s; }
.tm-svc .card:hover { background: var(--wp--preset--color--clay); }
.tm-svc .num { font-family: var(--wp--preset--font-family--mono); font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--wp--preset--color--soil); display: block; margin-bottom: 16px; }
.tm-svc h3 { font-family: var(--wp--preset--font-family--mono); font-size: 19px; font-weight: 500; margin: 0 0 12px; color: var(--wp--preset--color--turfgrass-green); }
.tm-svc p { font-size: 15px; line-height: 1.55; margin: 0; }

/* System steps — hairline grid on Turfgrass Green */
.tm-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: rgba(239, 236, 231, 0.35); border: 1px solid rgba(239, 236, 231, 0.35); margin-top: 56px; }
.tm-steps .st { background: var(--wp--preset--color--turfgrass-green); padding: 26px 20px; min-height: 190px; }
.tm-steps .num { font-family: var(--wp--preset--font-family--mono); font-size: 11px; letter-spacing: 0.16em; color: var(--wp--preset--color--sun); display: block; margin-bottom: 12px; }
.tm-steps h4 { font-family: var(--wp--preset--font-family--mono); font-size: 15px; font-weight: 500; margin: 0 0 12px; color: var(--wp--preset--color--off-white); }
.tm-steps p { font-size: 13.5px; line-height: 1.5; color: var(--wp--preset--color--clay); font-style: italic; margin: 0; }
.tm-steps .st.deco { display: none; align-items: center; justify-content: center; }
.tm-steps .st.deco img { width: 76px; height: 76px; opacity: 0.5; }
@media (max-width: 640px) {
  .tm-steps .st.deco { display: flex; }
}

/* Wide screens: every card grid fits on a single row regardless of item count */
@media (min-width: 1000px) {
  .tm-svc, .tm-steps, .tm-proof2 { display: flex; }
  .tm-svc .card, .tm-steps .st, .tm-proof2 .cell { flex: 1 1 0; min-width: 0; }
  .tm-steps .st.deco { display: none; }
}

/* Footer — generous side margins so the content sits clear of the edges */
footer.wp-block-template-part > .wp-block-group {
  padding-left: 5rem !important;
  padding-right: 5rem !important;
}
footer.wp-block-template-part .wp-block-columns.alignwide { max-width: 1280px; }
/* Contact column hugs the right edge, mirroring the left text margin */
footer.wp-block-template-part .wp-block-columns.alignwide > .wp-block-column:last-child {
  flex: 0 0 auto;
}
@media (max-width: 781px) {
  footer.wp-block-template-part > .wp-block-group {
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
  }
}

/* EN/FI language switcher flags (header) */
.tm-lang { display: inline-flex; gap: 7px; align-items: center; margin-left: 14px; }
.tm-lang a { display: block; line-height: 0; padding: 3px; border: 1px solid transparent; opacity: 0.45; transition: opacity 0.2s, border-color 0.2s; }
.tm-lang a:hover { opacity: 0.85; }
.tm-lang a.on { opacity: 1; border-color: var(--wp--preset--color--turfgrass-green); }
.tm-lang img { width: 24px; height: 15px; display: block; }

/* Decorative icon cells — mobile only (fills the empty grid slot there;
   on desktop the row is complete without it) */
.tm-deco { display: none; }
@media (max-width: 781px) {
  .tm-deco { display: flex; justify-content: center; opacity: 0.5; }
}

/* Mobile refinements */
@media (max-width: 640px) {
  .tm-pf .pfrow { flex-direction: column; align-items: stretch; gap: 18px; margin-bottom: 18px; }
  .tm-pf .pfrow.indent { padding-left: 0; }
  .tm-pf .pfi { width: 100% !important; }
  .tm-marquee-track img { height: 32px; margin-right: 44px; }
}

/* Trusted by — horizontally moving client marquee.
   Group class "tm-marquee"; the moving paragraph gets class "tm-marquee-track"
   (content must be duplicated twice for a seamless loop). */
.tm-marquee { overflow: hidden; }
.tm-marquee-track {
  display: inline-flex;
  white-space: nowrap;
  width: max-content;
  max-width: none;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: tm-marq 36s linear infinite;
}
.tm-marquee:hover .tm-marquee-track { animation-play-state: paused; }
.tm-marquee-track img {
  height: 44px;
  width: auto;
  margin-right: 70px;
  flex: none;
  display: block;
}
@keyframes tm-marq {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .tm-marquee-track { animation: none; }
}


/* ---- Mobile refinements (v1.4.0) ---- */
@media (max-width: 781px) {
  /* compact sticky header */
  header.wp-block-template-part .wp-block-site-logo img { width: 132px !important; height: auto !important; }

  /* hero: fits the first screen, buttons visible without scrolling */
  .tm-perspective { min-height: 74vh; }
  .wp-block-group.tm-perspective { padding-top: 4.5rem !important; padding-bottom: 4rem !important; }

  /* proof strip: stacked cells separated by hairlines, tighter padding */
  .tm-proof2 .cell { padding: 28px 22px; border-left: none; border-top: 1px solid var(--wp--preset--color--turfgrass-green); }
  .tm-proof2 .cell:first-child { border-top: none; }

  /* service cards + steps: tighter */
  .tm-svc .card { padding: 26px 20px; }
}
@media (max-width: 640px) {
  .tm-steps .st { min-height: 0; padding: 20px 16px; }
}


/* Mobile overlay menu — breathing room from the edges */
.wp-block-navigation__responsive-container.is-menu-open {
  padding: 4.5rem 1.75rem 2rem 1.75rem !important;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
  padding-top: 0.5rem;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item {
  padding: 0.4rem 0;
}
