/**
 * Questions and answers block.
 *
 * Figma: PAC-Page-Designs, page "Home Page", "Show Hide"
 *   1440px  node 2001:1726   section 1440 x 515, panels 480 and 960
 *   1199px  node 3076:3745   section 1199 x 540, panels 399.67 and 799.33
 *    768px  node 3076:3789   section  768 x 630, stacked
 *    390px  node 3076:4037   section  390 x 814, stacked
 *
 * One question and its answer is in blocks/accordion-item/style.css.
 */

.pchs-accordion {
	/* Set here so the background rule below is valid even when no drawing
	   has been chosen. render.php replaces it with a url(). */
	--pchs-accordion-pattern: none;

	display: flex;
	flex-direction: column;
}


/* ------------------------------------------------------------
   The heading panel
   ------------------------------------------------------------ */

.pchs-accordion__info {
	position: relative;
	/* Keeps the drawing below, which sits at a negative z-index, from
	   slipping behind this panel's own background colour. */
	isolation: isolate;
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20); /* 40/20 */
	background-color: var(--wp--preset--color--neutral-100);
}

/* The faint wave drawing. On a layer of its own rather than a second
   background on the panel, because the designs set it to 40% and a
   background layer cannot carry its own opacity. */
.pchs-accordion__info::before {
	position: absolute;
	z-index: -1;
	content: "";
	inset: 0;
	background-image: var(--pchs-accordion-pattern);
	background-repeat: no-repeat;
	background-position: center;
	background-size: cover;
	opacity: 0.4;
}

/* The designs set this heading in the heavy weight throughout, where other
   sections use the light one and mark a few words. An editor gets that by
   selecting the whole heading and pressing Emphasis - the same control, used
   on everything rather than on part. */
.pchs-accordion__heading {
	color: var(--wp--preset--color--blue-500);
}


/* ------------------------------------------------------------
   The list of questions
   ------------------------------------------------------------ */

.pchs-accordion__list {
	padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20); /* 40/20 */
	background-color: var(--wp--preset--color--white);
}


/* ------------------------------------------------------------
   The gold tone
   Figma: PAC-Page-Designs, page "Financial Aid", node 2489:9061
     1440px  section 1440 x 458 with four questions
      768px  node 2871:25418
      390px  node 2826:3104

   The same section in the palest yellow instead of grey and
   white. Nothing here is a measurement: the split, the padding
   and the type are the light tone's, above.
   ------------------------------------------------------------ */

.pchs-accordion--gold .pchs-accordion__info {
	background-color: var(--wp--preset--color--yellow-100);
	background-image: linear-gradient(
		90deg,
		var(--wp--preset--color--yellow-100) 0%,
		var(--wp--preset--color--yellow-300) 100%
	);
}

/*
 * The ginkgo in the heading panel, at 40%. It ships with the theme rather
 * than being chosen - see render.php.
 *
 * Below 1024 the panel is a short banner above the questions rather than a
 * tall column beside them, so the drawing just covers it, which is what the
 * light tone's rule already does. The frame's exact placement belongs with
 * the side-by-side layout and is further down.
 */
.pchs-accordion--gold .pchs-accordion__info::before {
	background-position: right top;
}

.pchs-accordion--gold .pchs-accordion__list {
	background-color: var(--wp--preset--color--yellow-100);
}


/* ------------------------------------------------------------
   The pale tone
   Figma: PAC-Page-Designs, page "REVIEW*** Financial Aid-Grants",
   node 2555:18706 (1440 x 926), expanded at 2555:18515.

   Blue-grey throughout, the heading panel graded across it, and
   the ginkgo BLENDED into the panel rather than faded over it.
   The rules between questions stay blue, as the light tone's.
   ------------------------------------------------------------ */

.pchs-accordion--pale .pchs-accordion__info {
	background-color: var(--wp--preset--color--gray-200);
	/* Deeper at the outer edge, meeting the questions at the paler end. */
	background-image: linear-gradient(
		270deg,
		var(--wp--preset--color--gray-200) 0%,
		var(--wp--preset--color--gray-500) 100%
	);
}

/*
 * Luminosity, not opacity.
 *
 * The frame composites this drawing with mix-blend-mode: luminosity, which
 * keeps the lightness of the leaves and takes the colour from the panel
 * underneath - so a gold ginkgo comes out as the blue-grey ghost the frame
 * shows. Fading it to 40% instead, as the light tone does, would leave it
 * gold and far too present.
 */
.pchs-accordion--pale .pchs-accordion__info::before {
	opacity: 1;
	mix-blend-mode: luminosity;
}

/*
 * The questions sit on the DARKER grey, not the paler one.
 *
 * Sampled off the frame's export rather than assumed: the list reads
 * 220,227,235 at both ends, which is gray-500, while the heading panel
 * beside it fades to 241,246,249 - gray-200 - where the two meet. So
 * there is a step in tone at the seam, and the questions are the same
 * grey the heading panel starts from on its far side.
 */
.pchs-accordion--pale .pchs-accordion__list {
	background-color: var(--wp--preset--color--gray-500);
}


/* ------------------------------------------------------------
   768px and up
   Figma node 3076:3789.

   Still stacked, but the padding between the two panels is
   split 40 and 40 while the outer edges take the section's
   usual 64.
   ------------------------------------------------------------ */

@media (min-width: 768px) {

	.pchs-accordion__info {
		padding: var(--wp--preset--spacing--64) var(--wp--preset--spacing--40) var(--wp--preset--spacing--40);
	}

	.pchs-accordion__list {
		padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--40) var(--wp--preset--spacing--64);
	}
}


/* ------------------------------------------------------------
   1024px and up
   Figma nodes 3076:3745 (1199) and 2001:1726 (1440).

   Side by side: the heading takes a third, the questions two
   thirds, with nothing between them - the two background
   colours meet.
   ------------------------------------------------------------ */

@media (min-width: 1024px) {

	.pchs-accordion {
		flex-direction: row;
		align-items: stretch;
	}

	/*
	 * A third and two thirds.
	 *
	 * Stated as a width rather than left to grow factors, because these
	 * panels are padded: a flex item with a basis of 0 cannot be narrower
	 * than its own padding, so the padding is effectively added to the
	 * share and two panels padded by 64 on each side come out 522 and 917
	 * where the design has 480 and 960. An explicit basis does not have
	 * that problem - with border-box, which this theme sets on everything,
	 * the padding is counted INSIDE it.
	 *
	 * The width is the gutter plus a third of the page. Below 1440 the
	 * gutter is 0 and the page is the whole screen, so it is simply a
	 * third; past 1440 each panel takes the empty space on its own side,
	 * which keeps the two colours running to the edges of the screen while
	 * the text columns stay exactly as wide as the design draws them.
	 *
	 * min-width: 0 lets a panel be narrower than the longest word in it,
	 * which a flex item otherwise refuses to do.
	 */
	.pchs-accordion__info {
		min-width: 0;
		flex: 0 0 calc(
			var(--pchs-page-gutter) +
			min(100%, var(--wp--custom--breakpoint--max-page)) / 3
		);
		padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--64);
		padding-left: calc(var(--wp--preset--spacing--64) + var(--pchs-page-gutter));
	}

	/* Whatever is left, which is the other two thirds plus its own gutter. */
	.pchs-accordion__list {
		min-width: 0;
		flex: 1 1 auto;
		padding: var(--wp--preset--spacing--80) var(--wp--preset--spacing--64);
		padding-right: calc(var(--wp--preset--spacing--64) + var(--pchs-page-gutter));
	}

	/*
	 * The gold tone's drawing: its own size, hung from the top right, running
	 * off the bottom of the panel.
	 *
	 * Frame 2489:9061 gives this as 72.58% of the panel's width and 156.48%
	 * of its height. On that frame's panel - 480 by 458 - those come to 348
	 * by 717, which IS the artwork's own 350 by 720. So the frame is drawing
	 * it at natural size and the percentages are just Figma's way of saying
	 * so against one particular panel.
	 *
	 * Taking the percentage literally was wrong twice over. The panel here is
	 * taller than the frame's, because this FAQ has nine questions where the
	 * frame abbreviates to four - so the drawing came out half as big again
	 * as the design's. And a percentage of the panel's HEIGHT is re-evaluated
	 * when a question opens and the panel grows, so the leaves visibly jumped
	 * every time someone opened one.
	 *
	 * Natural size cannot do either. It is also what the design means: a
	 * drawing laid in a corner, not one stretched to the box.
	 *
	 * The frame carries an annotation saying "center top", which is not what
	 * its geometry does. The geometry wins, as it did on the Events section.
	 */
	.pchs-accordion--gold .pchs-accordion__info::before {
		background-size: auto;
	}

	/*
	 * The pale tone's drawing is a whole panel of leaves, exported at the
	 * frame's own 480 x 926 - so at natural size it fills the panel across
	 * and sits from the top down.
	 *
	 * Natural size rather than cover for the reason in the note above: a
	 * size given as a proportion of the panel is recalculated when a
	 * question opens and the panel grows, and the leaves visibly jump.
	 * This FAQ has more questions than the frame draws, so the panel is
	 * taller than 926 and the drawing simply stops short of the bottom,
	 * which is what a drawing laid in a panel does.
	 */
	.pchs-accordion--pale .pchs-accordion__info::before {
		background-size: auto;
		background-position: left top;
	}
}


/* ============================================================
   The WHITE tone
   Figma: PAC-Page-Designs, page "Nursing-PBSN"
     1440px  node 2005:3742   section 1440 x 568 with three questions
      768px  node 2319:1655   section  768 x 863 with four
      390px  node 2418:9468   section  390 x 927 with four

   Both panels white, with the wave drawing marking the heading
   side. Nothing is measured here either: the split, the padding
   and the type are the light tone's.

   This is also the only tone whose heading panel carries more
   than a heading - a paragraph and a button under it, which the
   frames put 20 apart.
   ============================================================ */

/*
 * The panel is white, with the wave over it at the shared 40%. The drawing
 * is images/sections/wave-band.png, which render.php supplies as this tone's
 * default.
 *
 * Figma flattens this one layer into a picture of its own. That picture
 * scores 0.06 of 255 against the frame's panel and wave-band.png scores
 * 3.2 - measured on the two text-free strips at the panel's top and bottom.
 * A third near-identical copy of the same drawing was not worth three levels
 * of grey on a panel that is already white; blocks/steps/style.css records
 * the same judgement at 2.9.
 */
.pchs-accordion--white .pchs-accordion__info {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: var(--wp--preset--spacing--20);
	background-color: var(--wp--preset--color--white);
}

.pchs-accordion--white .pchs-accordion__body {
	/* Figma names Neutral/800 here, where .pchs-section-intro is blue-800. */
	color: var(--wp--preset--color--neutral-800);
}

.pchs-accordion--white .pchs-accordion__actions {
	margin: 0;
}


/* ============================================================
   The GOLD-DEEP tone
   Figma: PAC-Page-Designs, page "Nursing-PBSN"
     1440px  node 3034:12905   section 1440 x 500 with four questions
      768px  node 3034:13170
      390px  node 3034:13004

   Two flat golds, a shade apart: the heading panel in yellow-500
   and the list in yellow-300. Not the gold tone above, which is
   two much paler yellows with a gradient across the panel - and
   not its yellow-700 rules either. These stay blue-300, which is
   what node 3034:12905 draws and what every other tone uses.

   NO DRAWING. The frame has the whisper of one on the panel -
   about five levels either side of the flat gold - but it is
   neither of the two ginkgos this theme ships: scored against
   the frame's own panel, flat yellow-500 alone comes to 1.05 of
   255 and the best drawing we have makes it worse at 1.40. One
   level of grey is not worth a wrong drawing.
   ============================================================ */

.pchs-accordion--gold-deep .pchs-accordion__info {
	background-color: var(--wp--preset--color--yellow-500);
	background-image: none;
}

.pchs-accordion--gold-deep .pchs-accordion__info::before {
	background-image: none;
}

.pchs-accordion--gold-deep .pchs-accordion__list {
	background-color: var(--wp--preset--color--yellow-300);
}
