/*
Theme Name: Stephy's Place
Theme URI: https://www.stephysplace.org
Author: Stephy's Place
Description: Custom block theme for Stephy's Place, a grief support nonprofit. Calming greens, purples, and creams with butterfly and dragonfly motifs of transformation and renewal.
Version: 0.1.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.0
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: stephys-place
Tags: block-theme, full-site-editing, nonprofit, accessibility-ready
*/

/* Most styling lives in theme.json. Use this file for things that can't be expressed there. */

:root {
  --sp-easing: cubic-bezier(0.2, 0.7, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  transition: color 200ms var(--sp-easing), background-color 200ms var(--sp-easing), border-color 200ms var(--sp-easing);
}

.wp-block-button__link {
  transition: transform 200ms var(--sp-easing), box-shadow 200ms var(--sp-easing), background-color 200ms var(--sp-easing);
}

.wp-block-button__link:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(91, 74, 135, 0.18);
}

/* Header: render the logo image as a block so it has no inline baseline gap.
   That gap makes the logo box taller than the image and shifts it above the
   nav's vertical centre. */
.wp-block-site-logo {
  margin: 0;
  line-height: 0;
}

.wp-block-site-logo img {
  display: block;
}

/* Let the nav fill the space to the right of the logo and centre its items
   within that space, rather than hugging the far right edge. */
header .wp-block-navigation {
  flex-grow: 1;
}

/* On mobile the nav collapses to a hamburger button; pin it to the right
   edge rather than leaving it centred. */
@media (max-width: 600px) {
  header .wp-block-navigation {
    justify-content: flex-end;
  }
}

/* Decorative motif container: tucks butterflies/dragonflies in corners without affecting layout.
   Boxes are sized to the traced graphics' landscape aspect ratio (~3:2). */
.sp-motif {
  position: relative;
}

.sp-motif::before,
.sp-motif::after {
  content: "";
  position: absolute;
  width: 150px;
  height: 100px;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.35;
  pointer-events: none;
}

.sp-motif--butterflies::before {
  top: 14px;
  left: 14px;
  background-position: top left;
  background-image: url("assets/butterfly.svg");
  transform: rotate(-8deg);
}

.sp-motif--butterflies::after {
  bottom: 14px;
  right: 14px;
  background-position: bottom right;
  background-image: url("assets/butterfly.svg");
  transform: scaleX(-1) rotate(-8deg);
}

.sp-motif--dragonflies::before {
  top: 14px;
  right: 14px;
  background-position: top right;
  background-image: url("assets/dragonfly.svg");
  transform: rotate(8deg);
}

.sp-motif--dragonflies::after {
  bottom: 14px;
  left: 14px;
  background-position: bottom left;
  background-image: url("assets/dragonfly.svg");
  transform: scaleX(-1) rotate(8deg);
}

/* Card surface */
.sp-card {
  background: var(--wp--preset--color--surface);
  border: 1px solid color-mix(in srgb, var(--wp--preset--color--sage) 30%, transparent);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(47, 90, 62, 0.04), 0 8px 24px rgba(47, 90, 62, 0.06);
}

/* Staff directory: a responsive name grid. Members with a written profile
   render as native <details> disclosures; clicking the name expands the
   profile in place, spanning the full width of the grid. */
.sp-roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 1.75rem;
  margin-top: 0.5rem;
}

.sp-roster > p {
  margin: 0;
  padding: 0.45rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--sage) 22%, transparent);
}

.sp-roster .sp-roster-role {
  display: block;
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--wp--preset--color--muted);
}

.sp-roster .wp-block-details {
  margin: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--sage) 22%, transparent);
}

.sp-roster .wp-block-details > summary {
  cursor: pointer;
  padding: 0.45rem 0;
  color: var(--wp--preset--color--plum);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.sp-roster .wp-block-details > summary::-webkit-details-marker {
  display: none;
}

.sp-roster .wp-block-details > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 4.5px 0 4.5px 7px;
  border-color: transparent transparent transparent currentColor;
  transition: transform 150ms var(--sp-easing);
}

.sp-roster .wp-block-details[open] > summary::before {
  transform: rotate(90deg);
}

/* An opened profile spans every column and becomes a soft full-width card. */
.sp-roster details[open] {
  grid-column: 1 / -1;
  margin: 0.5rem 0;
  padding: 0.25rem 1.5rem 1.25rem;
  background: var(--wp--preset--color--cream);
  border: 1px solid color-mix(in srgb, var(--wp--preset--color--sage) 30%, transparent);
  border-radius: 14px;
}

/* Soft glow for hero */
.sp-hero-glow {
  background:
    radial-gradient(60% 60% at 20% 20%, color-mix(in srgb, var(--wp--preset--color--lavender) 40%, transparent), transparent 70%),
    radial-gradient(50% 50% at 85% 30%, color-mix(in srgb, var(--wp--preset--color--sage) 35%, transparent), transparent 70%),
    var(--wp--preset--color--cream);
}

/* Focus styling (accessible) */
:where(a, button, .wp-block-button__link):focus-visible {
  outline: 3px solid var(--wp--preset--color--plum);
  outline-offset: 3px;
  border-radius: 6px;
}

/* Announcement bar (managed under Settings > Announcement Bar) */
.sp-announce {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  background: linear-gradient(90deg, var(--wp--preset--color--plum), var(--wp--preset--color--forest));
  color: var(--wp--preset--color--cream);
  font-size: 0.95rem;
  line-height: 1.4;
}

.sp-announce__inner {
  flex: 1 1 auto;
  max-width: 1180px;
  width: 100%;
  margin: 0 auto;
  padding: 0.6rem 3rem;
  text-align: center;
  overflow: hidden;
}

.sp-announce a,
.sp-announce__link {
  color: var(--wp--preset--color--cream);
  text-decoration: underline;
  font-weight: 600;
}

.sp-announce__link {
  white-space: nowrap;
}

.sp-announce__close {
  position: absolute;
  top: 50%;
  right: 0.75rem;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  color: inherit;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0 0.4rem;
  cursor: pointer;
  opacity: 0.85;
}

.sp-announce__close:hover {
  opacity: 1;
}

/* Scrolling (marquee) variant */
.sp-announce--scroll .sp-announce__inner {
  white-space: nowrap;
}

.sp-announce--scroll .sp-announce__track {
  display: inline-block;
  padding-left: 100%;
  animation: sp-marquee 20s linear infinite;
}

.sp-announce--scroll:hover .sp-announce__track {
  animation-play-state: paused;
}

@keyframes sp-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-100%); }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  html { scroll-behavior: auto; }

  /* Without the scroll animation the marquee would hide its text off-screen,
     so lay it out as a normal centered line instead. */
  .sp-announce--scroll .sp-announce__inner { white-space: normal; }
  .sp-announce--scroll .sp-announce__track {
    display: block;
    padding-left: 0;
  }
}
