/* =========================================================== */
/* Elmira FAQ - "drawing set"                                     */
/* The list is a drawing sheet: framed, gridded paper, a sheet    */
/* number per question in a title-block strip. The toggle is an   */
/* architect's section-cut marker that turns to point at the open */
/* answer; opening draws a dimension line over the answer. A      */
/* dimension string down the side measures the sheet as you read. */
/* Native <details>: keyboard + screen reader friendly.           */
/* =========================================================== */
.ea-faq {
  --faq-ink: var(--color-charcoal);
  --faq-paper: #FCFBF8;
  --faq-line: rgba(45, 62, 74, 0.22);
  --faq-sheet: #417773;           /* teal darkened to 4.6:1 on paper */
  --faq-ease: cubic-bezier(0.65, 0, 0.35, 1);
  background: #FAF8F5;
}
.ea-faq-inner { max-width: 900px; margin: 0 auto; }
.ea-faq-title { text-align: center; margin-bottom: var(--space-lg); }

/* ---------- the sheet ---------- */
.ea-faq-list {
  position: relative;
  border: 1px solid rgba(45, 62, 74, 0.38);
  background-color: var(--faq-paper);
  background-image:
    linear-gradient(rgba(45, 62, 74, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(45, 62, 74, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  /* inner border line, like the margin frame on a drawing sheet */
  box-shadow: inset 0 0 0 7px var(--faq-paper), inset 0 0 0 8px rgba(45, 62, 74, 0.16);
}
/* registration crosshairs on opposite corners */
.ea-faq-list::before,
.ea-faq-list::after {
  content: ""; position: absolute; width: 24px; height: 24px; pointer-events: none; opacity: 0.6;
  background:
    linear-gradient(var(--faq-ink), var(--faq-ink)) center / 1px 100% no-repeat,
    linear-gradient(var(--faq-ink), var(--faq-ink)) center / 100% 1px no-repeat,
    radial-gradient(circle, transparent 5px, var(--faq-ink) 5.2px, var(--faq-ink) 6.2px, transparent 6.6px);
}
.ea-faq-list::before { top: -12px; left: -12px; }
.ea-faq-list::after { bottom: -12px; right: -12px; }

/* ---------- one sheet row ---------- */
.ea-faq-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  transition: background-color 0.6s var(--faq-ease);
}
.ea-faq-item:has(details[open]:not([data-closing])) { background-color: rgba(255, 255, 255, 0.72); }
.ea-faq-item details { grid-column: 1; grid-row: 1; min-width: 0; }

/* title-block strip with the sheet number */
.ea-faq-sheet {
  grid-column: 2; grid-row: 1;
  border-left: 1px solid var(--faq-line);
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: calc(var(--space-md) + 0.35em);
  font-family: var(--font-accent); font-size: 13px; font-weight: 600;
  letter-spacing: 0.1em; font-variant-numeric: tabular-nums;
  color: var(--faq-sheet);
  transition: color 0.5s var(--faq-ease);
}
.ea-faq-item:has(details[open]:not([data-closing])) .ea-faq-sheet { color: var(--faq-ink); }

/* row divider, drafted left to right with the scroll */
.ea-faq-rule {
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: var(--faq-ink); opacity: 0.4;
  transform-origin: left center; pointer-events: none;
}
.ea-faq-item:last-child .ea-faq-rule { display: none; }

/* ---------- question ---------- */
.ea-faq-item summary {
  list-style: none; cursor: pointer; position: relative;
  display: flex; align-items: center; gap: var(--space-sm);
  padding: var(--space-md);
  font-family: var(--font-heading); font-size: var(--text-h4);
  line-height: 1.3; color: var(--faq-ink);
}
.ea-faq-item summary::-webkit-details-marker { display: none; }
.ea-faq-q { flex: 1 1 auto; min-width: 0; }
.ea-faq-icon { flex: none; font-size: 24px; color: var(--color-teal); }

/* crop marks on the row's corners when you point at it */
.ea-faq-item summary::before,
.ea-faq-item summary::after {
  content: ""; position: absolute; width: 12px; height: 12px; pointer-events: none;
  opacity: 0; transition: opacity 0.45s var(--faq-ease), transform 0.45s var(--faq-ease);
}
.ea-faq-item summary::before { top: 12px; left: 12px; border-top: 1.5px solid var(--color-teal); border-left: 1.5px solid var(--color-teal); transform: translate(-5px, -5px); }
.ea-faq-item summary::after { bottom: 12px; right: 12px; border-bottom: 1.5px solid var(--color-teal); border-right: 1.5px solid var(--color-teal); transform: translate(5px, 5px); }
@media (hover: hover) {
  .ea-faq-item summary:hover::before,
  .ea-faq-item summary:hover::after { opacity: 1; transform: none; }
  .ea-faq-item summary:hover .ea-faq-cut circle { stroke: var(--color-teal); }
}
.ea-faq-item summary:focus-visible { outline: 2px solid var(--faq-ink); outline-offset: -6px; }
.ea-faq-item summary:focus-visible::before,
.ea-faq-item summary:focus-visible::after { opacity: 1; transform: none; }

/* section-cut marker: points at the question, turns down to the open answer */
.ea-faq-cut { flex: none; width: 32px; height: 32px; margin-left: var(--space-xs); }
.ea-faq-cut svg {
  display: block; overflow: visible;
  transform-origin: 14px 16px;
  transition: transform 0.6s var(--faq-ease);
}
.ea-faq-cut .ea-faq-cut-arrow { fill: var(--faq-ink); }
.ea-faq-cut circle { fill: var(--faq-paper); stroke: var(--faq-ink); stroke-width: 1.4; transition: stroke 0.4s var(--faq-ease); }
.ea-faq-cut line { stroke: var(--faq-ink); stroke-width: 1.2; }
.ea-faq-item details[open]:not([data-closing]) .ea-faq-cut svg { transform: rotate(90deg); }

/* ---------- answer ---------- */
.ea-faq-answer { overflow: hidden; }
.ea-faq-answer-inner {
  padding: 0 var(--space-md) var(--space-md) calc(var(--space-md) + 24px + var(--space-sm));
  max-width: calc(68ch + var(--space-md) + 24px + var(--space-sm));
}
.ea-faq-answer p {
  margin: 0; color: var(--color-charcoal-light);
  font-size: 1.125rem; line-height: 1.6; text-wrap: pretty;
}
.ea-faq-answer p + p { margin-top: 0.5em; }

/* dimension line drawn over the open answer: extension lines + 45deg ticks */
.ea-faq-dim { display: block; position: relative; height: 14px; margin: 0 0 14px; }
.ea-faq-dim::before {
  content: ""; position: absolute; left: 0; right: 0; top: 7px; height: 1px;
  background: var(--faq-ink); opacity: 0.5;
  transform: scaleX(0); transform-origin: center;
  transition: transform 0.7s var(--faq-ease) 0.1s;
}
.ea-faq-dim i {
  position: absolute; top: 0; width: 1px; height: 14px; background: rgba(45, 62, 74, 0.5);
  opacity: 0; transition: opacity 0.4s var(--faq-ease) 0.55s;
}
.ea-faq-dim i:first-child { left: 0; }
.ea-faq-dim i:last-child { right: 0; }
.ea-faq-dim i::after {
  content: ""; position: absolute; left: 0; top: 2px; width: 1.5px; height: 10px;
  background: var(--faq-ink); transform: rotate(45deg);
}
.ea-faq-item details[open]:not([data-closing]) .ea-faq-dim::before { transform: scaleX(1); }
.ea-faq-item details[open]:not([data-closing]) .ea-faq-dim i { opacity: 1; }

/* ---------- dimension string down the side (wide screens) ---------- */
.ea-faq-measure, .ea-faq-tick { display: none; }
@media (min-width: 1040px) {
  .ea-faq-measure {
    display: block; position: absolute; left: -40px; top: 0; bottom: 0; width: 1px;
    background: var(--faq-ink); opacity: 0.45; transform-origin: top center; pointer-events: none;
  }
  .ea-faq-tick { display: block; position: absolute; left: -47px; top: -7px; width: 47px; height: 14px; pointer-events: none; }
  .ea-faq-tick::before {
    content: ""; position: absolute; left: 6px; top: 1px; width: 1.5px; height: 12px;
    background: var(--faq-ink); transform: rotate(45deg);
  }
  .ea-faq-tick::after {
    content: ""; position: absolute; left: 7px; right: 0; top: 7px; height: 1px;
    background: var(--faq-ink); opacity: 0.25;
  }
}

/* ---------- phones ---------- */
/* the site's phone-centering net would center the sheet's contents; a drawing reads from the left */
@media (max-width: 900px) {
  html .ea-faq .ea-faq-inner,
  html .ea-faq .ea-faq-answer-inner { justify-items: normal !important; align-items: normal !important; }
}
@media (max-width: 600px) {
  .ea-faq-item { grid-template-columns: minmax(0, 1fr) 44px; }
  /* sheet number runs up the strip, below the marker (rotated, so bottom padding sits on top) */
  .ea-faq-sheet {
    writing-mode: vertical-rl; transform: rotate(180deg);
    align-items: center; justify-content: flex-end;
    padding: 0 0 62px; font-size: 12px;
  }
  .ea-faq-item summary { padding: 20px 12px 20px 16px; gap: 10px; }
  .ea-faq-icon { font-size: 22px; }
  /* the section-cut marker moves into the title-block strip, giving the question the width */
  .ea-faq-cut { position: absolute; right: -36px; top: 18px; width: 28px; height: 28px; margin: 0; }
  .ea-faq-cut svg { width: 28px; height: 28px; transform-origin: 12.25px 14px; }
  .ea-faq-answer-inner { padding: 0 12px 20px 16px; }
  .ea-faq-list::before { top: -10px; left: -10px; }
  .ea-faq-list::after { bottom: -10px; right: -10px; }
}

/* narrowest phones: a little less air so the longest question never splits a word */
@media (max-width: 380px) {
  .ea-faq-item summary { padding-left: 12px; padding-right: 6px; gap: 8px; }
  .ea-faq-icon { font-size: 20px; }
  .ea-faq-answer-inner { padding-left: 12px; }
}
.ea-faq-q { overflow-wrap: normal; }

@media (prefers-reduced-motion: reduce) {
  .ea-faq-item, .ea-faq-sheet, .ea-faq-cut svg, .ea-faq-cut circle,
  .ea-faq-dim::before, .ea-faq-dim i,
  .ea-faq-item summary::before, .ea-faq-item summary::after { transition: none; }
}
