/*
Theme Name: Upper Eight
Theme URI: https://bohagstjanstgoteborg.se
Author: Upper Eight
Author URI: https://uppereight.com
Description: Block theme for Familjens Bohagstjänst Göteborg — dödsbohantering i Göteborg. Värdering, uppköp, tömning och städning av dödsbon.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.1
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: uppereight
Tags: full-site-editing, block-patterns, block-styles, custom-colors, custom-fonts, wide-blocks
*/


/* ============================================================
   FOUNDATIONS
   ============================================================ */

/* Override WP auto-generated spacing with our airy values */
body {
  --wp--preset--spacing--10: 0.5rem;
  --wp--preset--spacing--20: 1rem;
  --wp--preset--spacing--30: 1.5rem;
  --wp--preset--spacing--40: 2.5rem;
  --wp--preset--spacing--50: 3rem;
  --wp--preset--spacing--60: clamp(3rem, 5vw, 5rem);
  --wp--preset--spacing--70: clamp(4rem, 7vw, 7rem);
  --wp--preset--spacing--80: clamp(5rem, 9vw, 9rem);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
}

/* Remove WordPress default gap between header/main/footer */
.wp-site-blocks > * + * {
  margin-block-start: 0;
}

/* Remove gaps between full-width sections */
.wp-block-image.alignfull,
.trust-carousel-wrap,
main .alignfull + .alignfull {
  margin-block-start: 0 !important;
  margin-block-end: 0;
}


/* ============================================================
   STICKY HEADER
   ============================================================ */

header.wp-block-template-part {
  position: sticky;
  top: 0;
  z-index: 100;
}

header.wp-block-template-part > .wp-block-group {
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background-color: rgba(255, 255, 255, 0.92) !important;
  transition: box-shadow 0.3s ease;
}

/* Shadow on scroll — added via JS */
.header-scrolled {
  box-shadow: 0 2px 20px rgba(28, 25, 23, 0.08) !important;
}

.wp-block-site-logo img {
  max-height: 72px;
  width: auto;
  transition: max-height 0.3s ease;
}

.header-scrolled .wp-block-site-logo img {
  max-height: 48px;
}

@media (max-width: 782px) {
  .wp-block-site-logo img {
    max-height: 52px;
  }
  .header-scrolled .wp-block-site-logo img {
    max-height: 40px;
  }
}

/* When mobile menu is open, undo sticky and transparent bg */
.has-modal-open header.wp-block-template-part {
  position: static;
}

.has-modal-open header.wp-block-template-part > .wp-block-group {
  background-color: #ffffff !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* Mobile menu overlay — full screen white background */
.wp-block-navigation__responsive-container.is-menu-open.is-menu-open.is-menu-open {
  background-color: #ffffff !important;
}

.wp-block-navigation .wp-block-navigation__responsive-container.is-menu-open {
  background-color: #ffffff !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
  padding-top: 0 !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 1.25rem !important;
}

.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
  font-family: var(--wp--preset--font-family--heading);
  font-size: 1.5rem !important;
  font-weight: 500;
  padding: 0.5rem 0 !important;
  color: #1C1917 !important;
}

/* Close button — fixed top right, large tap target */
.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close.wp-block-navigation__responsive-container-close {
  position: fixed !important;
  right: 1.25rem !important;
  top: 1.25rem !important;
  z-index: 100001 !important;
  padding: 0.5rem !important;
}

.wp-block-navigation__responsive-container-close svg {
  width: 28px !important;
  height: 28px !important;
}

/* "Tjänster" parent link in mobile menu — same style but grayed out with chevron */
.is-menu-open .wp-block-navigation-submenu > .wp-block-navigation-item__content {
  color: #A09A94 !important;
  pointer-events: none !important;
}

.is-menu-open .wp-block-navigation-submenu > .wp-block-navigation-item__content .wp-block-navigation-item__label::after {
  content: ' ▾';
  font-size: 0.8em;
  opacity: 0.6;
}

/* Hide the submenu toggle arrow in mobile overlay */
.is-menu-open .wp-block-navigation__submenu-icon {
  display: none !important;
}

/* WP Admin bar offset */
.admin-bar header.wp-block-template-part {
  top: 32px;
}

@media (max-width: 782px) {
  .admin-bar header.wp-block-template-part {
    top: 46px;
  }
}


/* ============================================================
   SCROLL ANIMATIONS
   Sections fade up on scroll. Applied via IntersectionObserver.
   ============================================================ */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Elements waiting to be revealed */
.reveal {
  opacity: 0;
}

.reveal.revealed {
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Stagger children in columns */
.reveal.revealed .wp-block-column:nth-child(1) { animation-delay: 0s; }
.reveal.revealed .wp-block-column:nth-child(2) { animation-delay: 0.1s; }
.reveal.revealed .wp-block-column:nth-child(3) { animation-delay: 0.2s; }
.reveal.revealed .wp-block-column:nth-child(4) { animation-delay: 0.3s; }

.reveal.revealed .wp-block-column {
  opacity: 0;
  animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; }
  .reveal.revealed,
  .reveal.revealed .wp-block-column {
    animation: none;
    opacity: 1;
    transform: none;
  }
}


/* ============================================================
   FAQ ACCORDION — core/details
   ============================================================ */

.wp-block-details {
  transition: background-color 0.2s ease;
}

.wp-block-details[open] {
  padding-bottom: 0.75rem;
}

/* Smooth open/close animation */
.wp-block-details .faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
  overflow: hidden;
}

.wp-block-details[open] .faq-answer {
  grid-template-rows: 1fr;
}

.wp-block-details .faq-answer > * {
  overflow: hidden;
}

.wp-block-details summary {
  cursor: pointer;
  font-family: var(--wp--preset--font-family--heading);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.4;
  color: var(--wp--preset--color--primary);
  padding: 0.75rem 2.5rem 0.75rem 0;
  position: relative;
  list-style: none;
  user-select: none;
  transition: color 0.2s ease;
}

.wp-block-details summary:hover {
  color: var(--wp--preset--color--accent);
}

.wp-block-details summary::marker,
.wp-block-details summary::-webkit-details-marker {
  display: none;
}

/* Custom expand/collapse — teal accent */
.wp-block-details summary::after {
  content: '';
  position: absolute;
  right: 0.5rem;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none' stroke='%232D6A6A' stroke-width='1.5' stroke-linecap='round'%3E%3Cline x1='9' y1='3' x2='9' y2='15'/%3E%3Cline x1='3' y1='9' x2='15' y2='9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.wp-block-details[open] summary::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none' stroke='%232D6A6A' stroke-width='1.5' stroke-linecap='round'%3E%3Cline x1='3' y1='9' x2='15' y2='9'/%3E%3C/svg%3E");
}

.wp-block-details > :not(summary) {
  color: var(--wp--preset--color--body);
  line-height: 1.7;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.wp-element-button,
.wp-block-button__link {
  transition: background-color 0.3s ease,
              color 0.3s ease,
              box-shadow 0.3s ease,
              transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
}

.wp-element-button:hover,
.wp-block-button__link:hover {
  box-shadow: 0 6px 20px rgba(45, 106, 106, 0.2);
  transform: translateY(-2px);
}

.wp-element-button:active,
.wp-block-button__link:active {
  transform: translateY(0);
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
}

/* Outline button style */
.wp-block-button.is-style-outline .wp-block-button__link {
  border: 2px solid var(--wp--preset--color--accent);
  color: var(--wp--preset--color--accent);
  background: transparent;
  box-shadow: none;
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
  background: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--white);
  box-shadow: 0 6px 20px rgba(45, 106, 106, 0.2);
}


/* ============================================================
   COVER BLOCK
   ============================================================ */

.wp-block-cover {
  min-height: 480px;
}

.wp-block-cover .wp-block-cover__inner-container {
  max-width: var(--wp--style--global--wide-size);
  margin: 0 auto;
}


/* ============================================================
   COLUMNS — Card hover with teal shadow
   ============================================================ */

.wp-block-column[class*="has-background"] {
  transition: box-shadow 0.35s ease, transform 0.3s ease;
}

.wp-block-column[class*="has-background"]:hover {
  box-shadow: 0 12px 40px rgba(45, 106, 106, 0.08);
  transform: translateY(-3px);
}


/* ============================================================
   LINKS
   ============================================================ */

.entry-content a:not(.wp-element-button):not(.wp-block-button__link) {
  text-decoration-color: rgba(45, 106, 106, 0.3);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.entry-content a:not(.wp-element-button):not(.wp-block-button__link):hover {
  text-decoration-color: var(--wp--preset--color--accent);
}


/* ============================================================
   FOOTER
   ============================================================ */

footer a,
footer.wp-block-template-part a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.2s ease;
}

footer a:hover,
footer.wp-block-template-part a:hover {
  color: var(--wp--preset--color--white);
}

/* Remove any list bullets in footer */
footer ul,
footer.wp-block-template-part ul,
footer.wp-block-template-part ol {
  list-style: none;
  padding-left: 0;
  margin-left: 0;
}

footer li,
footer.wp-block-template-part li {
  list-style: none;
  padding-left: 0;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 782px) {
  .wp-block-columns:not(.is-not-stacked-on-mobile) {
    flex-direction: column !important;
  }

  .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
    flex-basis: 100% !important;
  }

  .wp-block-cover {
    min-height: 360px;
  }

  .wp-element-button,
  .wp-block-button__link {
    padding: 0.8rem 1.5rem;
  }
}

@media (max-width: 480px) {
  .wp-block-cover {
    min-height: 300px;
  }
}


/* ============================================================
   PRINT
   ============================================================ */

@media print {
  header, footer, .wp-block-button {
    display: none;
  }
}


/* ============================================================
   TRUST CAROUSEL — Infinite horizontal scroll
   ============================================================ */

@keyframes trustScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.trust-carousel-wrap {
  overflow: hidden;
  position: relative;
}

/* Fade edges */
.trust-carousel-wrap::before,
.trust-carousel-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}

.trust-carousel-wrap::before {
  left: 0;
  background: linear-gradient(to right, var(--wp--preset--color--background-alt), transparent);
}

.trust-carousel-wrap::after {
  right: 0;
  background: linear-gradient(to left, var(--wp--preset--color--background-alt), transparent);
}

.trust-carousel {
  animation: trustScroll 30s linear infinite;
  gap: 1.5rem !important;
  white-space: nowrap;
  width: max-content;
}

.trust-carousel:hover {
  animation-play-state: paused;
}

.trust-item {
  white-space: nowrap;
  flex-shrink: 0;
}

.trust-sep {
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.4;
}

@media (prefers-reduced-motion: reduce) {
  .trust-carousel {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
  }
}


/* ============================================================
   SUBTLE TEXTURE
   ============================================================ */

.has-background-alt-background-color {
  background-image:
    url("data:image/svg+xml,%3Csvg width='4' height='4' viewBox='0 0 4 4' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 3h1v1H1V3zm2-2h1v1H3V1z' fill='%2378716C' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}


/* ============================================================
   CONTACT FORM 7
   ============================================================ */

.wpcf7 {
  margin-top: 1.5rem;
}

/* Reset all CF7 margins and line breaks */
.wpcf7 p {
  margin: 0 0 0.75rem 0;
}

.wpcf7 br {
  display: none;
}

.wpcf7 label {
  display: block;
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--wp--preset--color--primary);
  margin-bottom: 0.375rem;
}

.wpcf7 label .required {
  color: var(--wp--preset--color--accent);
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 select,
.wpcf7 textarea {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--wp--preset--color--border);
  border-radius: 8px;
  font-family: var(--wp--preset--font-family--body);
  font-size: 1rem;
  color: var(--wp--preset--color--primary);
  background: var(--wp--preset--color--white);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.wpcf7 input:focus,
.wpcf7 select:focus,
.wpcf7 textarea:focus {
  outline: none;
  border-color: var(--wp--preset--color--accent);
  box-shadow: 0 0 0 3px rgba(45, 106, 106, 0.12);
}

.wpcf7 textarea {
  min-height: 140px;
  resize: vertical;
}

.wpcf7 select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%2378716C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.wpcf7 input[type="submit"] {
  display: inline-block;
  padding: 0.9rem 2rem;
  background-color: var(--wp--preset--color--accent);
  color: var(--wp--preset--color--white);
  border: none;
  border-radius: 8px;
  font-family: var(--wp--preset--font-family--body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(28, 25, 23, 0.08);
  margin-top: 0.5rem;
}

.wpcf7 input[type="submit"]:hover {
  background-color: var(--wp--preset--color--accent-light);
  box-shadow: 0 6px 20px rgba(45, 106, 106, 0.2);
  transform: translateY(-2px);
}

/* Form grid layout */
.cf7-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.cf7-grid p,
.cf7-field p,
.cf7-full p {
  margin: 0;
}

.cf7-field {
  min-width: 0;
  overflow: hidden;
}

.cf7-full {
  margin-top: 0.25rem;
}

.cf7-full p {
  margin: 0;
}

/* Override CF7 size attribute */
.wpcf7-form-control-wrap {
  display: block;
}

@media (max-width: 600px) {
  .cf7-grid {
    grid-template-columns: 1fr;
  }
}

.wpcf7-not-valid-tip {
  color: #b91c1c;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.wpcf7-response-output {
  padding: 1rem !important;
  border-radius: 8px !important;
  margin-top: 1rem !important;
  font-size: 0.9375rem;
}

.wpcf7-mail-sent-ok {
  border-color: #16a34a !important;
  background: #f0fdf4;
  color: #166534;
}

.wpcf7-validation-errors {
  border-color: #dc2626 !important;
  background: #fef2f2;
  color: #991b1b;
}


/* ============================================================
   SMOOTH TRANSITIONS — Global polish
   ============================================================ */

img {
  transition: opacity 0.3s ease;
}

.wp-block-group {
  transition: background-color 0.3s ease;
}

/* Call button — responsive */
.call-short { display: none; }
.call-full { display: inline; }
@media (max-width: 782px) {
	.call-short { display: inline; }
	.call-full { display: none; }
	.call-button { order: -1; }
	nav.wp-block-navigation { order: 99; }
}
