/*
Theme Name:   VPC
Theme URI:    https://www.vpcpickleball.com/
Description:  Custom block theme for the Valleystream Pickleball Club. No page
              builder - design tokens live in theme.json, layout in block
              templates, and everything is a file under version control.
Author:       Ben Dow
Version:      2.8.1
Requires PHP: 7.4
Text Domain:  vpc
*/

/* =========================================================================
   Utility + design layer. Tokens live in theme.json; this file carries what
   theme.json cannot express: waves, cards, motion, a11y details.
   ========================================================================= */

:root {
  --vpc-shadow-card: 0 1px 2px rgba(16,34,43,.06), 0 8px 24px rgba(16,34,43,.10);
  --vpc-shadow-card-hover: 0 2px 4px rgba(16,34,43,.08), 0 16px 40px rgba(16,34,43,.16);
  --vpc-wave-blue: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 90' preserveAspectRatio='none'%3E%3Cpath d='M0,55 C240,90 480,10 720,35 C960,60 1200,15 1440,45 L1440,90 L0,90 Z' fill='%2300A6E0'/%3E%3C/svg%3E");
  --vpc-wave-green: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 90' preserveAspectRatio='none'%3E%3Cpath d='M0,60 C260,95 520,20 760,42 C1000,64 1240,22 1440,52 L1440,90 L0,90 Z' fill='%232E8739'/%3E%3C/svg%3E");
  --vpc-wave-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 90' preserveAspectRatio='none'%3E%3Cpath d='M0,58 C250,92 500,14 740,38 C980,62 1220,18 1440,48 L1440,90 L0,90 Z' fill='%23ffffff'/%3E%3C/svg%3E");
}

/* --- Header ------------------------------------------------------------- */

.vpc-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(16,34,43,.07);
}
.vpc-header .wp-block-navigation a {
  text-decoration: none;
  position: relative;
  padding-bottom: .2em;
}
.vpc-header .wp-block-navigation a:hover { color: var(--wp--preset--color--vpc-blue); }
/* yellow underline swoosh on the current page */
.vpc-header .wp-block-navigation .current-menu-item > a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 4px; border-radius: 2px;
  background: var(--wp--preset--color--vpc-yellow);
}

/* --- Tri-colour rule (logo swoosh as a divider) -------------------------- */

hr.vpc-ball-rule, .vpc-ball-rule {
  height: 6px !important; border: 0; border-radius: 3px; opacity: 1;
  background: linear-gradient(90deg,
    var(--wp--preset--color--vpc-yellow) 0 33%,
    var(--wp--preset--color--vpc-blue-bright) 33% 66%,
    var(--wp--preset--color--vpc-green-bright) 66% 100%);
}
.vpc-header hr.vpc-ball-rule { height: 4px !important; margin: 0; border-radius: 0; }

/* --- Hero ---------------------------------------------------------------- */

.vpc-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60rem 30rem at 85% -20%, rgba(239,230,14,.28), transparent 60%),
    radial-gradient(50rem 28rem at -10% 110%, rgba(0,166,224,.14), transparent 60%),
    var(--wp--preset--color--vpc-mist);
}
/* the actual logo ball, drifting behind the headline */
.vpc-hero::before {
  content: ""; position: absolute; z-index: 0;
  width: 34rem; height: 34rem; top: -7rem;
  /* laptop: tucked behind the headline edge; big screens: pushed right into the free space beside the 46rem column */
  left: max(calc(50% + 10rem), calc(100% - 36rem));
  background: url(assets/ball.svg) center/contain no-repeat;
  opacity: .35;
  filter: saturate(.9);
  animation: vpc-drift 14s ease-in-out infinite alternate;
}
.vpc-hero > * { position: relative; z-index: 1; }

@keyframes vpc-drift {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(2.2rem) rotate(9deg); }
}

/* phones: no side space, so a smaller ball peeks from the top-right corner */
@media (max-width: 781px) {
  .vpc-hero::before {
    width: 19rem; height: 19rem;
    left: auto; right: -5.5rem; top: -4.5rem;
  }
}

.vpc-eyebrow {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 700; font-size: .95rem; letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--wp--preset--color--vpc-blue);
}

/* yellow marker sweep behind one word of the headline */
.vpc-mark {
  background: linear-gradient(104deg,
    transparent .12em, var(--wp--preset--color--vpc-yellow) .22em calc(100% - .22em), transparent calc(100% - .12em));
  margin: 0 -.05em;
  padding: 0 .08em;
  border-radius: .1em;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

/* wave section divider: attach to a full-width Group with position relative */
.vpc-wave-bottom-white { padding-bottom: 9rem !important; }
.vpc-wave-bottom-white::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  height: 7.5rem;
  background:
    var(--vpc-wave-white) bottom/100% 5rem no-repeat,
    var(--vpc-wave-green) bottom .8rem center / 100% 6.2rem no-repeat,
    var(--vpc-wave-blue)  bottom 1.7rem center / 100% 7.5rem no-repeat;
}

/* --- Buttons ------------------------------------------------------------- */

.wp-block-button__link {
  box-shadow: 0 2px 8px rgba(16,34,43,.18);
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.wp-block-button__link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(16,34,43,.24);
}
.is-style-outline .wp-block-button__link { box-shadow: none; border-width: 2px; }

/* --- Stat cards ----------------------------------------------------------- */

.vpc-cards { margin-top: -3.25rem; position: relative; z-index: 2; }
.vpc-card {
  background: #fff;
  border-radius: 18px;
  padding: 2rem 1.5rem 1.6rem !important;
  box-shadow: var(--vpc-shadow-card);
  border-top: 6px solid var(--vpc-card-accent, var(--wp--preset--color--vpc-blue));
  transition: transform .18s ease, box-shadow .18s ease;
}
.vpc-card:hover { transform: translateY(-4px); box-shadow: var(--vpc-shadow-card-hover); }
.vpc-card--yellow { --vpc-card-accent: var(--wp--preset--color--vpc-yellow); }
.vpc-card--blue   { --vpc-card-accent: var(--wp--preset--color--vpc-blue-bright); }
.vpc-card--green  { --vpc-card-accent: var(--wp--preset--color--vpc-green-bright); }
.vpc-card .vpc-stat {
  font-family: var(--wp--preset--font-family--display);
  font-weight: 800; font-size: var(--wp--preset--font-size--colossal);
  line-height: 1; letter-spacing: -0.02em;
}

/* --- Panels (New to the club? / Latest news) ------------------------------ */

/* Group/Column > "Panel": a tinted tile, used for side-by-side sections */
.vpc-panel, .is-style-panel {
  background: var(--wp--preset--color--vpc-mist);
  border-radius: 18px;
  padding: 1.5rem !important;
  height: 100%;
}
.is-style-panel > h2:first-child, .is-style-panel > h3:first-child {
  margin-top: 0; font-size: var(--wp--preset--font-size--large);
}
.is-style-panel .wp-block-list.is-style-pdf-list li:last-child { border-bottom: 0; }
.is-style-panel > :last-child { margin-bottom: 0; }
.wp-block-column.is-style-panel { height: auto; }
/* A column of panels (Members Only, right-hand side): natural height, even gaps. */
.vpc-panel-stack > .is-style-panel { height: auto; }
.vpc-panel-stack > .is-style-panel + .is-style-panel { margin-top: 1.5rem; }  /* let the column's default flex stretch do the work */
.vpc-panel .wp-block-latest-posts { margin: 0; padding-left: 0; list-style: none; }
.vpc-panel .wp-block-latest-posts li {
  padding: .65rem 0;
  border-bottom: 1px dashed rgba(16,34,43,.18);
}
.vpc-panel .wp-block-latest-posts li:last-child { border-bottom: 0; }
.vpc-panel .wp-block-latest-posts a { font-weight: 700; text-decoration: none; }
.vpc-panel .wp-block-latest-posts a:hover { text-decoration: underline; }
.vpc-panel .wp-block-latest-posts__post-date {
  display: block; font-size: .9rem; color: var(--wp--preset--color--vpc-muted);
}

/* --- Inner-page title band ------------------------------------------------ */

.vpc-title-band {
  background:
    radial-gradient(46rem 18rem at 90% -30%, rgba(239,230,14,.20), transparent 60%),
    var(--wp--preset--color--vpc-mist);
}

/* --- Badges, tables ------------------------------------------------------- */

.vpc-badge {
  display: inline-block; padding: .2em .6em; border-radius: 999px;
  font-weight: 700; font-size: .8em; letter-spacing: .02em;
  background: var(--wp--preset--color--vpc-yellow);
  color: var(--wp--preset--color--vpc-ink);
}
.vpc-badge--closed { background: #E5E7EA; color: var(--wp--preset--color--vpc-muted); }
.vpc-badge--open   { background: var(--wp--preset--color--vpc-green); color: #fff; }

/* --- Tables ----------------------------------------------------------------
   Every core Table block gets the club look, so a table the board adds in the
   editor matches the existing ones without any class to remember. */

.wp-block-table { margin-block: 1.25rem; -webkit-overflow-scrolling: touch; }
.wp-block-table table { border-collapse: collapse; width: 100%; }
/* 4+ columns can't squeeze onto a phone: keep a readable width and scroll sideways inside the figure */
.wp-block-table table:has(tr > :nth-child(4)) { min-width: 32rem; }
.wp-block-table thead { border-bottom: 0; }
.wp-block-table th, .wp-block-table td {
  padding: .6rem .75rem; border: 0; border-bottom: 1px solid #E1E6EA;
  text-align: left; vertical-align: top;
}
.wp-block-table thead th { background: var(--wp--preset--color--vpc-mist); }
/* row headers (League, Role) read as labels, not as data */
.wp-block-table tbody th { font-weight: 700; }
/* a heading directly above a table (the weekly schedule's day names) sits close to it */
h3.wp-block-heading:has(+ .wp-block-table) { margin-bottom: .25rem; }
h3.wp-block-heading + .wp-block-table { margin-top: 0; }

/* "On this page" list (template: Page with contents list; built by inc/contents.php) */
.vpc-contents {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem .75rem;
  margin: 0 0 2rem; padding: 1rem 1.25rem; border-radius: 14px;
  background: #F2F6F9; border: 1px solid #E1E6EA;
}
.vpc-contents__label { font-weight: 700; font-size: .9rem; text-transform: uppercase; letter-spacing: .04em; color: #4A5A68; }
.vpc-contents ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem .5rem; }
.vpc-contents li { margin: 0; }
.vpc-contents a {
  display: inline-block; padding: .3rem .8rem; border-radius: 999px; font-size: .95rem; font-weight: 600;
  background: #fff; border: 1px solid #D5DDE4; text-decoration: none; color: inherit;
}
.vpc-contents a:hover, .vpc-contents a:focus-visible { border-color: currentColor; }
h2[id] { scroll-margin-top: 6rem; }

/* --- Block styles (registered in functions.php, picked from the Styles panel) --- */

/* Details block (core "fold-open" section): club look, no extra class needed */
.wp-block-details {
  border: 1px solid #E1E6EA; border-radius: 12px;
  padding: 0 1.25rem; margin-block: 1rem; background: #fff;
}
.wp-block-details > summary {
  display: flex; align-items: center; gap: .6rem;
  padding: .8rem 0; font-weight: 600; cursor: pointer; list-style: none;
}
.wp-block-details > summary::-webkit-details-marker { display: none; }
.wp-block-details > summary::before {
  content: ""; flex: none; width: .55em; height: .55em;
  border-right: 2px solid var(--wp--preset--color--vpc-blue);
  border-bottom: 2px solid var(--wp--preset--color--vpc-blue);
  transform: rotate(-45deg); transition: transform .15s ease;
}
.wp-block-details[open] > summary::before { transform: rotate(45deg); }
.wp-block-details[open] > summary { border-bottom: 1px dashed rgba(16,34,43,.18); margin-bottom: 1rem; }
.wp-block-details[open] { padding-bottom: 1rem; }
.wp-block-details > summary + * { margin-top: 0; }
.wp-block-details > :last-child { margin-bottom: 0; }
.wp-block-details h3 { font-size: var(--wp--preset--font-size--medium); }

/* Group > "Coach profile" (photo column + name/email/rates, bio folded in a Details) */
.is-style-coach { padding-block: 1.5rem; border-top: 1px solid #E1E6EA; }
.is-style-coach:first-of-type { border-top: 0; }
.is-style-coach h2 { margin-top: 0; }
.is-style-coach > .wp-block-columns { gap: 1.5rem; }
.is-style-coach .wp-block-column > p { margin-block: .25rem 0; }
.is-style-coach a[href^="mailto:"] { overflow-wrap: anywhere; }
.is-style-coach .wp-block-list.is-style-rate-card { margin-block: .75rem 0; }
.is-style-coach .wp-block-details { margin-top: 1rem; }
/* Image > "Coach photo" */
.is-style-coach-photo { margin: 0; }
.is-style-coach-photo img { width: 100%; border-radius: 14px; box-shadow: var(--vpc-shadow-card); }
@media (max-width: 600px) {
  .is-style-coach > .wp-block-columns { gap: .9rem; }
  .is-style-coach > .wp-block-columns > .wp-block-column[style*="flex-basis"] { flex-basis: 7rem !important; }
  .is-style-coach .wp-block-list.is-style-rate-card { grid-template-columns: 1fr; padding: .75rem 1rem; }
}

/* List > "Rate card": label left, price right, as a compact grid */
.wp-block-list.is-style-rate-card {
  list-style: none; padding: 1rem 1.25rem; margin-block: 1.25rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .35rem 1.5rem;
  background: var(--wp--preset--color--vpc-mist); border-radius: 12px;
}
.wp-block-list.is-style-rate-card li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px dashed rgba(16,34,43,.18); padding: .2rem 0; }

/* List > "PDF list" (policy PDFs) */
.wp-block-list.is-style-pdf-list { list-style: none; padding-left: 0; }
.wp-block-list.is-style-pdf-list li {
  padding: .55rem 0 .55rem 3.25rem; text-indent: -3.25rem;
  border-bottom: 1px solid #E1E6EA;
}
.wp-block-list.is-style-pdf-list li::before {
  content: "PDF"; display: inline-block; box-sizing: border-box;
  width: 2.5rem; margin-right: .75rem; padding: .1em 0; border-radius: 4px;
  text-align: center; text-indent: 0;
  font-size: .72em; font-weight: 700; letter-spacing: .06em; vertical-align: .12em;
  background: var(--wp--preset--color--vpc-blue); color: #fff;
}

/* --- Galleries -------------------------------------------------------------- */

.wp-block-gallery img { border-radius: 10px; }

/* --- Footer ---------------------------------------------------------------- */

.vpc-footer a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.vpc-footer .wp-block-list { list-style: none; padding-left: 0; }
.vpc-footer .wp-block-list li { padding: .2rem 0; }

/* --- Motion: staggered hero entrance -------------------------------------- */

@media not (prefers-reduced-motion: reduce) {
  .vpc-hero .vpc-eyebrow,
  .vpc-hero h1,
  .vpc-hero p,
  .vpc-hero .wp-block-buttons {
    animation: vpc-rise .6s cubic-bezier(.2,.7,.3,1) both;
  }
  .vpc-hero h1 { animation-delay: .08s; }
  .vpc-hero p { animation-delay: .16s; }
  .vpc-hero .wp-block-buttons { animation-delay: .26s; }
}
@keyframes vpc-rise {
  from { opacity: 0; transform: translateY(1.1rem); }
  to   { opacity: 1; transform: none; }
}

/* --- A11y ------------------------------------------------------------------ */

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--wp--preset--color--vpc-blue);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; transition-duration: .01ms !important;
  }
}

/* --- Members Only password form -------------------------------------------- */

.post-password-form {
  padding: 1.5rem 1.75rem; border-radius: 12px;
  background: var(--wp--preset--color--vpc-mist);
}
.post-password-form p:last-child { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 0; }
.post-password-form label { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; font-weight: 700; }
.post-password-form input[type="password"] {
  font: inherit; padding: .55rem .8rem; min-width: 14rem;
  border: 1px solid #C9D2D8; border-radius: 8px; background: #fff;
}
.post-password-form input[type="submit"] { cursor: pointer; }
