/*
Theme Name: This Might Help Theme
Theme URI: https://aprilcooke.com
Author: Justin Echeverria
Author URI: https://aprilcooke.com
Description: A custom theme for April Cooke's website
Version: 1.0.22
License: GNU General Public License v2 or later
Tags: therapy, minimalist, responsive
Text Domain: this-might-help
*/

/* ---------- Base ---------- */
:root{
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6b7280;
  --border: #e5e7eb;
  --card: #f9f9f9;
  --brand: #1e90ff;
  --brand-ink: #ffffff;
  --ring: 0 0 0 4px rgba(30,144,255,.15);
  --radius: 12px;
  --pad: clamp(16px, 3vw, 32px);
  --gap: clamp(20px, 4vw, 48px);
  --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
  --shadow-md: 0 8px 24px rgba(0,0,0,.08);
  --shadow: 0 8px 24px rgba(15,23,42,.06), 0 2px 8px rgba(15,23,42,.04);

  /* Added for forms */
  --success-bg: #e8f7ec;
  --success-ink: #186a2e;
  --success-border: #c5efcf;
  --error-bg: #ffe9e9;
  --error-ink: #7a1e1e;
  --error-border: #ffc7c7;
  --placeholder: #9aa3af;
}

*{ box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Helvetica Neue', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
.hero-buttons {
  display: flex;
  justify-content: space-between;
  max-width: 600px;
  margin: 2rem auto 0 auto;
  gap: 1rem;
}

.hero-buttons a {
  flex: 1;
}

/* Common button styles */
.hero-buttons button {
  width: 100%;
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.3s ease, transform 0.2s ease;
}

/* Blue button */
.blue-btn {
  background-color: #4da6ff;
}
.blue-btn:hover {
  background-color: #3399ff;
  transform: translateY(-2px);
}

/* Red button */
.red-btn {
  background-color: #ff4d4d;
}
.red-btn:hover {
  background-color: #e60000;
  transform: translateY(-2px);
}

.container {
  max-width: 1200px;
  margin: auto;
  padding: 1rem;
}

/* ---------- Header ---------- */
header { background: #f5f5f5; }
header .container a#title { text-decoration: none; color: inherit; }
.container h1 { margin: 0; }

.header-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.header-text h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.header-text p { margin: 0; font-size: 0.95rem; color: var(--muted); }

/* Social links */
.social-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin: 5px 0;
}
.social-links a {
  width: 45px; height: 45px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #000; color: #fff; border-radius: 12px;
  text-decoration: none; font-size: 24px; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-sm);
}
.social-links a:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.social-links a:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.social-links a img { width: 100%; height: 100%; object-fit: cover; display: block; }
.social-links a:nth-child(1) { background: #3b5998; }
.social-links a:nth-child(2) { background: #e1306c; }
.social-links a:nth-child(3) { background: #1da1f2; }
.social-links a:nth-child(4) { background: #000000; }
.social-links a:nth-child(5) { background: #5851db; }
.social-links a:nth-child(6) { background: #5A9FFF; }

/* ---------- Hero (front page) ---------- */
.hero {
  background: radial-gradient(3000px 3200px at 80% 80%, rgba(255,255,255,0) 0%, rgba(255,254,255,0.9) 30%), url("images/skyline.jpg") center/cover no-repeat #f5f5f5;
  color: #000;
}
.hero .overlay {
  display: block; padding: 1rem 1rem 3rem; border-radius: 10px;
  max-width: 1200px; margin: auto;
}
.hero h2 { font-size: 2rem; margin-bottom: 1rem; letter-spacing: .01em; }
.hero p { max-width: 680px; color: #222; }
.hero button {
  background: var(--brand); color: var(--brand-ink); border: none;
  padding: 0.8rem 1.25rem; border-radius: 10px; font-size: 1rem; font-weight: 600;
  margin-top: 1rem; cursor: pointer;
  transition: filter .15s ease, transform .1s ease, box-shadow .15s ease;
  box-shadow: var(--shadow-sm);
}
.hero button:hover { filter: brightness(.98); box-shadow: var(--shadow-md); }
.hero button:active { transform: translateY(1px); }

/* ---------- Main layout ---------- */
main {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  align-items: stretch;
}

/* ---------- Sections (About/Find) layout ---------- */
.sections{
  max-width: 1200px;
  margin: 0 auto;
  padding: calc(var(--pad) * 1.5) var(--pad);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: calc(var(--gap) * 1.25);
  align-items: stretch;
}

main:has(> .sections){ display: block; }

.split{
  display: block;
  padding: var(--pad);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
}

.copy{ min-width: 0; }
.title{
  margin: 0 0 .4em;
  font-size: clamp(24px, 2.2vw, 34px);
  letter-spacing: -0.02em;
}
.desc{ margin: 0; color: var(--muted); font-size: clamp(14px, 1.2vw, 16px); }

.contact-block h3{ margin: 1em 0 .4em; font-size: 1rem; font-weight: 600; color: var(--ink); }
.contact-block p{ margin: 0; color: var(--muted); }
.contact-block a{
  color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--border);
  transition: border-color .2s ease;
}
.contact-block a:hover{ border-color: var(--ink); }

/* ---------- Square cover images ---------- */
.wrap-img{
  display: block;
  width: 200px;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  background: #eef2f7;
}
.wrap-img img { border-radius: 18px; }

.wrap-right{
  float: right;
  margin: .25rem 0 1rem 1rem;
  shape-outside: inset(0 round 18px);
}
.wrap-left{
  float: left;
  margin: .25rem 1rem 1rem 0;
  shape-outside: inset(0 round 18px);
}
.wrap-img img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- Footer ---------- */
footer {
  background: #f0f0f0; text-align: center; padding: 1rem;
  font-size: 0.9rem; margin-top: 2rem;
}
.footer-links { margin-top: 0.5rem; }
.footer-links a { margin: 0 0.5rem; color: #1e90ff; text-decoration: none; }

/* ---------- Page & Single Post Layout ---------- */
.page-layout,
.single-layout {
  background-color: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-top: 2rem;
}
.page-title,
.single-title {
  margin-top: 0;
  font-size: 2rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.5rem;
}
.page-content,
.single-content {
  margin-top: 1rem;
  line-height: 1.8;
  color: #222;
}
.single-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

/* =========================================================
   Modern Form Styles — polished for accessibility & mobile
   ========================================================= */
.page-layout form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem 1.25rem;
  margin-top: .75rem;
}

/* Top-level labels (section prompts) */
.page-layout form > label {
  grid-column: 1 / -1;
  font-weight: 700;
  margin-top: .25rem;
  color: #111;
  letter-spacing: .01em;
}

/* Add a * to any label whose next field is required */
.page-layout form > label:has(+ input[required])::after,
.page-layout form > label:has(+ select[required])::after,
.page-layout form > label:has(+ textarea[required])::after,
.page-layout form > label:has(+ div input[required])::after{
  content: " *";
  color: #d92d20;
  font-weight: 700;
}

/* Two-input row (First/Last, etc.) */
.page-layout form > label + div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

/* Make checkbox groups into neat cards using :has() */
.page-layout form > label + div:has(input[type="checkbox"]) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .6rem;
}
.page-layout form > label + div:has(input[type="checkbox"]) > label{
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0,0,0,.02) inset;
  transition: border-color .15s ease, box-shadow .15s ease, background-color .2s ease, transform .02s ease;
  cursor: pointer;
}
.page-layout form > label + div:has(input[type="checkbox"]) > label:hover{
  background: #fbfbfb;
  box-shadow: var(--shadow-sm);
}
.page-layout form div > label input[type="checkbox"],
.page-layout form div > label input[type="radio"]{
  transform: translateY(2px);
  accent-color: var(--brand);
  margin-right: .1rem;
}

/* Inputs */
.page-layout input[type="text"],
.page-layout input[type="email"],
.page-layout input[type="tel"],
.page-layout input[type="url"],
.page-layout input[type="number"],
.page-layout select,
.page-layout textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.8rem 0.95rem;
  font: inherit;
  color: #111;
  background: #fff;
  transition: box-shadow .15s ease, border-color .15s ease, transform .02s ease, background-color .2s ease;
  box-shadow: 0 1px 0 rgba(0,0,0,.02) inset;
}
.page-layout input::placeholder,
.page-layout textarea::placeholder{ color: var(--placeholder); }

/* Custom select arrow (keeps native a11y) */
.page-layout select{
  appearance: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'><path d='M5.5 7.5l4.5 4.5 4.5-4.5' fill='none' stroke='%23111111' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 18px 18px;
  padding-right: 2.2rem;
}

/* Textarea */
.page-layout textarea {
  min-height: 160px;
  resize: vertical;
  grid-column: 1 / -1;
}

/* Focus ring / focus-visible */
.page-layout input:focus,
.page-layout select:focus,
.page-layout textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--ring);
}
.page-layout input:focus-visible,
.page-layout select:focus-visible,
.page-layout textarea:focus-visible{
  outline: none;
}

/* Invalid states (native HTML5 validation) */
.page-layout input:invalid,
.page-layout select:invalid,
.page-layout textarea:invalid{
  border-color: #f3b2b2;
}
.page-layout input:invalid:focus,
.page-layout select:invalid:focus,
.page-layout textarea:invalid:focus{
  box-shadow: 0 0 0 4px rgba(220, 53, 69, .12);
}

/* Helper text */
.page-layout .help {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .9rem;
}

/* Submit button */
.page-layout button,
.page-layout input[type="submit"] {
  grid-column: 1 / -1;
  justify-self: start;
  background: var(--brand);
  color: var(--brand-ink);
  border: none;
  padding: 0.9rem 1.2rem;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: .02em;
  box-shadow: var(--shadow-sm);
  transition: filter .15s ease, transform .08s ease, box-shadow .15s ease, opacity .15s ease;
}
.page-layout button:hover,
.page-layout input[type="submit"]:hover { filter: brightness(.98); box-shadow: var(--shadow-md); }
.page-layout button:active,
.page-layout input[type="submit"]:active { transform: translateY(1px); }
.page-layout button:disabled,
.page-layout input[type="submit"]:disabled{ opacity: .6; cursor: not-allowed; }

/* Success / error messages from PHP */
.success-message,
.tmh-form-success {
  background: var(--success-bg);
  color: var(--success-ink);
  border: 1px solid var(--success-border);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin: 0 0 1rem;
}
.error-message,
.tmh-form-errors {
  background: var(--error-bg);
  color: var(--error-ink);
  border: 1px solid var(--error-border);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin: 0 0 1rem;
}
.tmh-form-errors ul { margin: 0; padding-left: 1.1rem; }

/* Honeypot (hidden) */
.hp-field {
  position: absolute !important;
  left: -99999px !important;
  width: 1px; height: 1px; overflow: hidden;
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hero {
    background: linear-gradient(rgba(255,255,255,.72) 0%, rgba(255,254,255,.72) 30%), url("images/skyline.jpg") center/cover no-repeat #f5f5f5;
  }
  .hero .overlay { text-align: left; }
  .hero .overlay p { max-width: 100%; font-size: 15px; }
  .social-links { display: block; margin: auto; }
}

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

/* Form responsive: single column on mobile; checkbox cards stack nicely */
@media (max-width: 760px){
  .page-layout form { grid-template-columns: 1fr; gap: 1rem; }
  .page-layout form > label + div { grid-template-columns: 1fr; }
  .page-layout form > label + div:has(input[type="checkbox"]) {
    grid-template-columns: 1fr;
  }
  .page-layout textarea { min-height: 140px; }
}

/* --- MOBILE: image ALWAYS after text & full-width (handles both DOM structures) --- */
@media (max-width: 768px){
  /* Kill floats */
  .split .wrap-right, .split .wrap-left{
    float: none !important;
    shape-outside: auto;
  }

  /* Case A: wrap-img is a sibling of .copy */
  .split{
    display: flex;
    flex-direction: column;
  }
  .split > .copy{ order: 1; }
  .split > .wrap-img{
    order: 2;
    width: 100%;
    max-width: none;
    aspect-ratio: 1 / 1;     /* keep square on mobile; change to 'auto' if preferred */
    margin: 1rem 0 0 0;
  }

  /* Case B: wrap-img lives inside .copy */
  .split .copy{
    display: flex;
    flex-direction: column;
  }
  .split .copy > :not(.wrap-img){ order: 1; }
  .split .copy > .wrap-img{
    order: 2;
    width: 100%;
    max-width: none;
    aspect-ratio: 1 / 1;
    margin: 1rem 0 0 0;
  }
}

@media (prefers-reduced-motion: reduce){
  .hero button,
  .page-layout button,
  .page-layout input[type="submit"] { transition: none; }
}
