/* =========================
   Core brand + layout
========================= */
:root{
  --primary:#55085E;
  --accent:#8B5FBF;
  --light:#F7F2FB;
  --text:#1f2937;
  --muted:#6b7280;

  --safe-top:env(safe-area-inset-top);
  --safe-bottom:env(safe-area-inset-bottom);

  /* Rhythm */
  --space-1:8px;
  --space-2:12px;
  --space-3:16px;
  --space-4:20px;
  --space-5:24px;
  --space-6:32px;
  --radius:16px;
  --maxw:1000px;
}

/* =========================
   Reset & scroll stability
========================= */
*{box-sizing:border-box}
html,body{height:100%;margin:0;overflow-x:hidden}
html{
  scrollbar-gutter:stable both-edges;
  overflow-y:scroll;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}
body{
  font-family:"Gelasio",serif;
  color:var(--text);
  background:#fff;
  line-height:1.6;
  position:relative;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}

/* =========================
   Watermark (responsive subtlety)
   - Slightly stronger on larger viewports (desktop)
   - Softer on small phones
========================= */
body::before{
  content:"";
  position:fixed; inset:0;
  background:url('images/hex.png') center/70vmin no-repeat;
  opacity:.06;                 /* base (tablet/mobile default) */
  pointer-events:none; z-index:-1; filter:grayscale(100%);
}
/* Very small phones: a touch softer */
@media (max-width:680px){
  body::before{ opacity:.045; background-size:90vmin; }
}
/* Desktop: make it more visible so it doesn't fade out */
@media (min-width:1024px){
  body::before{ opacity:.10; }
}
/* Very large desktops: tiny nudge more, still tasteful */
@media (min-width:1440px){
  body::before{ opacity:.12; }
}

/* Media */
img{max-width:100%;height:auto;display:block}

/* Containers */
.wrap, main{max-width:var(--maxw);margin:0 auto;padding:var(--space-5)}

/* =========================
   Header
========================= */
header{
  position:sticky; top:0;
  background:rgba(255,255,255,.85);
  -webkit-backdrop-filter:saturate(180%) blur(8px);
  backdrop-filter:saturate(180%) blur(8px);
  border-bottom:1px solid #e5e7eb;
  padding-top:var(--safe-top);
}
nav{
  width:100%;
  max-width:var(--maxw);
  margin:0 auto;
  padding:var(--space-3) var(--space-5);
  display:flex; align-items:center; justify-content:space-between;
  min-height:64px; flex-wrap:nowrap;
}
.brand{display:flex;align-items:center;gap:var(--space-3)}
.brand img{height:80px;width:auto;display:block}

/* Contact link (desktop text; mobile icon) */
.contact-link{
  font-weight:500;
  color:var(--primary);
  text-decoration:none;
  white-space:nowrap;
  position:relative;
}
.contact-link .contact-icon{display:none;font-size:1.2em;vertical-align:middle}
.contact-link .contact-email{display:inline}
@media (max-width:600px){
  .contact-link .contact-email{display:none}
  .contact-link .contact-icon{display:inline}
}

/* =========================
   Headings + text
========================= */
h1,h2,h3,h4{color:var(--primary);margin:0 0 var(--space-3)}
h1{font-size:clamp(28px,4vw,40px)}
h2{font-size:clamp(20px,3vw,28px);margin-top:var(--space-5)}
a{color:var(--primary)}

/* Justified copy without ugly breaks */
p, li{
  text-align:justify;
  text-justify:inter-word;
  hyphens:none;                /* prevent auto hyphenation */
  word-break:normal;           /* avoid mid-word breaks */
  overflow-wrap:break-word;    /* only break when necessary */
  text-wrap:pretty;            /* nicer line breaks where supported */
}

/* =========================
   Footer
========================= */
#site-footer{
  position:fixed; bottom:0; left:0; width:100%;
  background:rgba(255,255,255,.85);
  -webkit-backdrop-filter:saturate(180%) blur(8px);
  backdrop-filter:saturate(180%) blur(8px);
  border-top:1px solid #e5e7eb;
  padding:6px 0; z-index:1000;
  font-size:12px; color:#374151;
}
#site-footer .wrap{
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; text-align:center;
}
#site-footer .brand img{height:36px}
#site-footer .small, .legal-line{white-space:normal;word-break:break-word}
.legal-line{line-height:1.4;max-width:var(--maxw);padding:0 12px}
.small, .legal-line{font-size:12px;line-height:1.3}

/* =========================
   Homepage visuals
========================= */
.home .hero{
  background:radial-gradient(1200px 420px at 50% -120px, var(--light), transparent);
  padding:40px 0 16px;
  text-align:center;
}
.home h1{
  font-size:clamp(28px,4vw,44px);
  margin-bottom:8px;
}
.home .grid{display:grid;gap:var(--space-3)}
.home .cards{grid-template-columns:repeat(auto-fit,minmax(240px,1fr))}
.home .card{
  border:1px solid #e5e7eb;
  border-radius:var(--radius);
  padding:var(--space-3);
  background:#fff;
}
.home .card.full-width{grid-column:1 / -1}
.home .services{padding:40px 0}
.home .about, .home .contact{padding:40px 0}
.home .contact .info{
  display:flex; flex-direction:column; gap:8px; font-size:14px; color:#374151
}
.home p.lead{
  max-width:800px; margin:0 auto 16px; color:#374151; text-align:center
}
.home .location-line{font-size:13px;color:var(--muted);margin-top:6px;text-align:center}

/* =========================
   Accessibility
========================= */
.skip-link{position:absolute;left:-9999px;top:auto}
.skip-link:focus{
  left:12px; top:12px; background:#fff; border:2px solid var(--primary);
  padding:6px 10px; z-index:1001;
}

/* =========================
   Responsive tweaks
========================= */
@media (max-width:900px){
  .home .hero{padding:48px 0 20px}
  .wrap, main{padding:var(--space-4)}
}
@media (max-width:680px){
  /* watermark tuning happens above */
  .wrap, main{padding:var(--space-3)}
  .brand img{height:64px}
}
@media (max-width:480px){
  .brand img{height:56px}
  .home .hero{padding:40px 0 16px}
  .legal-line{font-size:12px}
  #site-footer{position:static !important}
  #site-footer .brand{display:none}
  #site-footer .wrap{gap:12px}
}

/* Desktop+: footer layout refinement */
@media (min-width:960px){
  #site-footer .wrap{
    flex-direction:row; flex-wrap:wrap; justify-content:center; align-items:center;
    gap:12px; text-align:center;
  }
  #site-footer .wrap>*{flex:0 0 auto}
  .legal-line{flex-basis:100%; margin-top:2px}
}

/* =========================
   Mobile: swap email text for icon
========================= */
@media (max-width:600px){
  .contact-link{
    font-size:24px;                /* icon size */
    text-indent:-9999px;           /* visually hide text */
    overflow:hidden;
  }
  .contact-link::before{
    content:"✉️";
    position:absolute; inset:0;
    text-indent:0; display:flex; align-items:center; justify-content:center;
  }
}

/* =========================
   Contact area
========================= */
.contact p{font-family:inherit}
.contact a{text-decoration:none;color:var(--primary)}

/* =========================
   Tables
========================= */
.wrap table{
  width:100%; border-collapse:collapse; margin:1rem 0;
}
.wrap th, .wrap td{
  border:1px solid #000; padding:.5rem .75rem; text-align:left; vertical-align:middle;
}
.wrap th{
  text-align:center; background:rgba(85,8,94,.1); font-weight:600;
}

/* =========================
   Links & lists
========================= */
.purple-link{color:var(--primary);font-weight:600}
ul.rights-list{margin:.75rem 0; padding-left:1.2rem}
ul.rights-list li{margin-bottom:.5rem}

/* =========================
   Footer hex
========================= */
.footer-hex{
  width:20px; opacity:.6; transition:opacity .2s ease-in-out; cursor:pointer;
}
.footer-hex:hover{opacity:1}

/* =========================
   Logo / hero
========================= */
.logo-hero{text-align:center;margin:2rem 0}
.big-hex{
  display:inline-block;
  width:clamp(110px,18vw,160px);
  height:auto;
}

/* =========================
   Hex diagram
========================= */
.hex-diagram-container{text-align:center;margin:2rem 0}
.hex-diagram{
  display:block; margin:2rem auto; width:100%; max-width:500px; height:auto; overflow:visible;
}
@media (max-width:480px){
  .hex-diagram{max-width:92vw}
  .hex-diagram text{font-size:28px}
  .hex-diagram text[font-weight="bold"]{font-size:36px}
}
@media (max-width:360px){
  .hex-diagram text{font-size:26px}
  .hex-diagram text[font-weight="bold"]{font-size:34px}
}

/* =========================
   Motion preferences
========================= */
@media (prefers-reduced-motion:reduce){
  *{scroll-behavior:auto!important}
  .footer-hex{transition:none}
}

/* =========================
   About link (section-as-link)
========================= */
.about-link {
  display:block;
  color:inherit;
  text-decoration:none;
}
.about-link:hover {
  background:rgba(85,8,94,.03); /* subtle hover */
}

/* =========================
   Services grid & cards
   (three columns → two → one)
========================= */
.services .cards{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:20px;
  align-items:stretch;                 /* equal heights */
}
@media (max-width:1000px){
  .services .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:640px){
  .services .cards{grid-template-columns:1fr}
}

/* Full-width cards: let text span the full container */
.services .cards > .card.full-width{ grid-column:1 / -1; }
.services .card.full-width p{ max-width:none; }

.services .card{
  display:flex; flex-direction:column;
  border:1px solid #e5e7eb;
  border-radius:var(--radius);
  background:#fff;
  padding:var(--space-3);
  box-shadow:0 1px 2px rgba(0,0,0,.04);
}

/* Desktop: slightly stronger borders/shadow so boxes read on big screens */
@media (min-width:1024px){
  .services .card{
    border-color:rgba(0,0,0,0.12);
    box-shadow:0 1px 3px rgba(0,0,0,0.06);
  }
}

.services .card.full-width{ grid-column:1 / -1 }

/* Tighter readable copy inside cards */
.services .card p{ max-width:64ch; line-height:1.7; margin:0 0 .8rem }

/* =========================
   Brand-styled details/summary
========================= */
.services details{
  border-top:1px solid #f0f0f3;
  padding-top:.6rem; margin-top:.8rem;
}
.services summary{
  list-style:none; cursor:pointer;
  font-weight:600; color:var(--primary);
  display:flex; align-items:center; gap:.5rem;
}
.services summary::-webkit-details-marker{ display:none }
.services summary::before{
  content:"▸"; font-size:.9em; line-height:1;
  transition:transform .2s ease;
  color:var(--primary);
}
.services details[open] > summary::before{ transform:rotate(90deg) }

.services summary:focus-visible{
  outline:2px solid var(--accent);
  outline-offset:3px; border-radius:6px;
}

/* UL spacing within details */
.services details ul{ margin:.5rem 0 0; padding-left:1.1rem }
.services details li{ margin:.25rem 0 }

/* =========================
   Optional CTA in cards
========================= */
.card .card-cta{
  margin-top:auto; padding-top:.8rem;
  border-top:1px dashed #e7e4ea;
}
.card .card-cta a{
  color:var(--primary); text-decoration:none; font-weight:600;
}
.card .card-cta a:hover{ text-decoration:underline }
