/**
 * OptConnect card grids (PR 3.1, extended by PR 3.7).
 *
 * One stylesheet for the whole card-grid family — the five patterns
 * `optconnect/card-grid-apps`, `optconnect/card-grid-features`,
 * `optconnect/card-grid-resources`, and PR 3.7's `optconnect/card-grid-benefits`
 * and `optconnect/card-grid-choice`. They share the `.oc-card-grid` shell, the
 * `.oc-card` surface, and the type scale; only the card interior differs, hence
 * the `--app` / `--feature` / `--resource` / `--benefit` / `--choice` modifiers.
 *
 * PR 3.7's two patterns rebuild the *flip-card* family, which plans.md measures as
 * a family of its own — but a flip box with its two faces shown at once is an icon
 * card, so they get the same shell rather than a stylesheet of their own. That is
 * PR 3.5 and PR 3.6's finding for a third time: the measured family boundary is
 * not a component boundary. The only thing genuinely new is `.oc-tone-*`, which
 * carries the four-colour brand rotation both flip shapes are built on.
 *
 * There is no media query in this file, on purpose. The columns come from
 * core's grid layout with `minimumColumnWidth: 19rem`, which emits
 * `repeat(auto-fill, minmax(19rem, 1fr))` — 3-up at the theme's 1140px content
 * width, 2-up on a tablet, 1-up on a phone, with no breakpoint of ours to keep
 * in step with core's. The two rows that do need to stack, the resources
 * heading row and the choice pair, are `core/columns` and core already stacks
 * them at 781px.
 *
 * Deliberate deviations from the Elementor originals are recorded per pattern in
 * `patterns/card-grid-*.php`, next to the source section they rebuild. The ones
 * that live here rather than in the markup:
 *   - Legacy card radii were 5px (service_box) and 15px (restly_service_five);
 *     unified on 12px.
 *   - The legacy feature card is a 2px `#e6ecf7` border that swaps to a shadow on
 *     hover, i.e. the card changes size class on hover. Kept as a shadow that
 *     deepens, so nothing reflows.
 *   - Hover raises the card and darkens the link. It is not the only affordance:
 *     `:focus-visible` gets the same treatment plus a real focus ring, since the
 *     legacy cards had no visible focus state at all.
 *   - `#104cba` (Restly demo blue) appeared in every card's link and hover fill.
 *     Replaced with `accent-1` / `accent-2`, the brand pair from PR 1.1.
 */

/* --------------------------------------------------------------------------
 * Section shell
 *
 * No `margin` declarations on anything that sits inside a block-gapped group.
 * Core's flow layout emits `.wp-container-… > * + * { margin-block-start: var(…) }`
 * at one-class specificity, and this file loads after it — so a `margin: 0` here
 * would win and silently delete the gap the block attributes asked for. Spacing
 * between blocks is set with `blockGap` in the pattern markup, where the Site
 * Editor can also see it; this file only styles what the editor can't express.
 * The two exceptions below say why they are exceptions.
 * ---------------------------------------------------------------------- */
/* `accent-2` for the same reason as `.oc-card__label` below: 16px / 700 is not large
   text, and `accent-1` on white is 4.27:1 (PR 6.2). */
.oc-card-grid__eyebrow {
	color: var(--wp--preset--color--accent-2, #006ba4);
	font-family: var(--wp--preset--font-family--nunito, sans-serif);
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.5;
}

.oc-card-grid__title {
	font-size: clamp(1.75rem, 3vw, 2.15rem);
	line-height: 1.2;
}

.oc-card-grid__intro {
	color: var(--wp--preset--color--accent-6, #454545);
}

/* Exception 1: core/columns carries `margin-bottom: 1.75em` in a `:where()`
   wrapper, so this one class clears it — and it doubles the shell's block gap
   rather than being that gap. */
.oc-card-grid__head {
	margin-bottom: 0;
}

/* --------------------------------------------------------------------------
 * Card surface
 * The card group is the grid item, so it stretches to the row height on its
 * own — no `height: 100%`, which would resolve against an auto row and fight
 * the stretch. `min-width: 0` stops a long unbroken title from widening the
 * track past `1fr`.
 * ---------------------------------------------------------------------- */
.oc-card {
	display: flex;
	min-width: 0;
	flex-direction: column;
	border-radius: 12px;
	background-color: var(--wp--preset--color--base, #ffffff);
	box-shadow: 0 6px 24px 0 rgba(29, 44, 56, 0.08);
	overflow: hidden;
	transition:
		box-shadow 0.25s ease-in-out,
		transform 0.25s ease-in-out;
}

.oc-card:hover,
.oc-card:focus-within {
	box-shadow: 0 12px 34px 0 rgba(29, 44, 56, 0.16);
	transform: translateY(-2px);
}

/* The card is a link target, not a link — keep the ring on the anchor itself so
   it says which card, and which part of it, has focus.
 *
 * `:not(.wp-element-button)` was added by PR 3.7, which put the first
 * `core/button` inside a card. Without it this rule is (0,2,0) and quietly beats
 * `theme.json`'s own `:root :where(.wp-element-button:focus-visible)` at (0,1,0),
 * so a button would lose the site-wide white ring + `contrast` shadow and get the
 * card's blue ring instead — a different focus treatment for the same control
 * depending on what it happens to sit inside. `theme.json` has owned the button
 * since PR 3.3 and should keep owning its focus state. Card *links* are unchanged:
 * they carry no `wp-element-button` class, so they still match at (0,3,0). */
.oc-card :focus-visible:not(.wp-element-button) {
	outline: 2px solid var(--wp--preset--color--accent-1, #0081c2);
	outline-offset: 3px;
	border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.oc-card {
		transition: none;
	}

	.oc-card:hover,
	.oc-card:focus-within {
		transform: none;
	}
}

/* `flex: 1` lets `.oc-card__link` sit on the card's bottom edge whatever the
   description length, so a row of cards lines its links up. */
.oc-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
}

/* --------------------------------------------------------------------------
 * Card media
 * `aspect-ratio` and `object-fit` are set per image by the block's own
 * `aspectRatio` / `scale` attributes, so the editor shows the same crop as the
 * front end.
 *
 * Exception 2 to the no-margins rule: the app and resource card groups set no
 * `blockGap` — the image is meant to sit flush against the card's top edge — so
 * core emits no flow container for them and `core/image`'s own
 * `margin: 0 0 1em` survives. This clears it. Nothing here is fighting a gap.
 * ---------------------------------------------------------------------- */
.oc-card__media {
	margin: 0;
}

.oc-card__media img {
	display: block;
	width: 100%;
}

/* A figure in a grid's own head — the landing pages' "The OptConnect Advantage"
   diagram (PR 6.1) — is narrower than the content width; centred under the
   centred heading rather than hanging off the left edge. */
.oc-card-grid__figure {
	text-align: center;
}

/* --------------------------------------------------------------------------
 * Card icon (feature cards)
 * Placeholder SVGs ship in `assets/images/icons/` — see
 * patterns/card-grid-features.php for why the legacy icon fonts are not ported.
 * ---------------------------------------------------------------------- */
.oc-card__icon {
	display: flex;
	width: 72px;
	height: 72px;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background-color: var(--wp--preset--color--accent-5, #eff2f8);
}

.oc-card__icon img {
	width: 40px;
	height: 40px;
}

/* --------------------------------------------------------------------------
 * Card text
 * ---------------------------------------------------------------------- */

/* `accent-2`, not the brand `accent-1`: at 14px / 700 the label is not large text,
   and #0081c2 on white is 4.27:1, under AA's 4.5. #006ba4 is 5.77:1 (PR 6.2). */
.oc-card__label {
	color: var(--wp--preset--color--accent-2, #006ba4);
	font-family: var(--wp--preset--font-family--nunito, sans-serif);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.5;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.oc-card__title {
	font-size: 1.25rem;
	line-height: 1.35;
}

.oc-card__title a {
	color: inherit;
	text-decoration: none;
}

.oc-card__title a:hover,
.oc-card__title a:focus-visible {
	color: var(--wp--preset--color--accent-2, #006ba4);
	text-decoration: underline;
}

.oc-card__text {
	color: var(--wp--preset--color--accent-6, #454545);
	font-size: 1rem;
}

/* --------------------------------------------------------------------------
 * Card link
 * `margin-block-start: auto` pins the link to the bottom of `.oc-card__body`, so
 * a row of cards lines its links up whatever the description length. It is
 * deliberately written as the SAME logical property core's flow gap sets, at two
 * classes rather than one — replacing the gap here is the point, and doing it at
 * a higher specificity means it does not depend on this file loading last.
 * ---------------------------------------------------------------------- */
.oc-card__body > .oc-card__link {
	margin-block-start: auto;
	padding-top: var(--wp--preset--spacing--20, 10px);
}

.oc-card__link {
	font-family: var(--wp--preset--font-family--nunito, sans-serif);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.5;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

/* `accent-2` at rest too (PR 6.2): `accent-1` at 14px / 700 is 4.27:1, under AA for
   everyone who never hovers. Hover still says itself with the underline and the
   arrow's nudge. */
.oc-card__link a {
	color: var(--wp--preset--color--accent-2, #006ba4);
	text-decoration: none;
}

.oc-card__link a::after {
	content: "\2192";
	display: inline-block;
	margin-left: 0.4em;
	transition: transform 0.25s ease-in-out;
}

.oc-card__link a:hover,
.oc-card__link a:focus-visible {
	color: var(--wp--preset--color--accent-2, #006ba4);
	text-decoration: underline;
}

.oc-card:hover .oc-card__link a::after {
	transform: translateX(3px);
}

@media (prefers-reduced-motion: reduce) {
	.oc-card__link a::after {
		transition: none;
	}

	.oc-card:hover .oc-card__link a::after {
		transform: none;
	}
}

/* --------------------------------------------------------------------------
 * Brand tone rotation (PR 3.7)
 *
 * The flip-card family's whole visual signature is a four-colour rotation —
 * blue, orange, green, light blue — applied per card. Live it lands on the icon,
 * the title, and the hidden back panel at once; here it lands on the icon badge
 * only, because OC orange is 2.76:1 on white and OC green 2.53:1 (measured in
 * PR 3.2), so a coloured title fails AA outright while a filled badge is
 * decorative and has no contrast floor to meet.
 *
 * One custom property per class rather than four copies of every rule, so a card
 * changes colour by swapping one `className` in the editor. The classes are named
 * for the palette slug they carry, not for a position in the rotation, so
 * `oc-tone-accent-3` still means "OC green" if a page reorders its cards.
 *
 * The live rotation's fourth colour is `#3AB3E5`, an Elementor-kit blue with no
 * `theme.json` token; `accent-2` is the nearest brand blue and is what the
 * patterns use. See docs/history/phase-3.md → PR 3.7.
 * ---------------------------------------------------------------------- */
.oc-tone-accent-1 {
	--oc-tone: var(--wp--preset--color--accent-1, #0081c2);
}

.oc-tone-accent-2 {
	--oc-tone: var(--wp--preset--color--accent-2, #006ba4);
}

.oc-tone-accent-3 {
	--oc-tone: var(--wp--preset--color--accent-3, #7cb242);
}

.oc-tone-accent-4 {
	--oc-tone: var(--wp--preset--color--accent-4, #f47920);
}

/* --------------------------------------------------------------------------
 * Benefit and choice cards (PR 3.7)
 *
 * Both are centred, both fill the icon badge with the card's tone, and both are
 * otherwise `.oc-card` — the surface, radius, shadow, hover lift and focus ring
 * all come from the rules above.
 *
 * `align-items: center` rather than `margin-inline: auto` on the badge: the card
 * is already a column flex container, so this centres every child without adding
 * a margin to anything sitting inside a block-gapped group (see the note at the
 * top of this file).
 * ---------------------------------------------------------------------- */
.oc-card--benefit,
.oc-card--choice {
	align-items: center;
	text-align: center;
}

.oc-card--benefit .oc-card__icon,
.oc-card--choice .oc-card__icon {
	background-color: var(--oc-tone, var(--wp--preset--color--accent-1, #0081c2));
}

/* The glyph has to be white on a filled badge, and it arrives through an
   `<img src>` — so `currentColor` has nothing to inherit and the SVG's own fill
   is the OC blue `tools/sync-icons.sh` bakes in (PR 3.1 explains why it is
   literal). `brightness(0)` flattens whatever that fill is to black and
   `invert(1)` turns it white, which keeps one set of icon files serving both the
   pale badge on the feature cards and the filled badge here. The alternative —
   a second, white-filled copy of every icon — would fork the sync script. */
.oc-card--benefit .oc-card__icon img,
.oc-card--choice .oc-card__icon img {
	filter: brightness(0) invert(1);
}

/* --------------------------------------------------------------------------
 * Choice pair (PR 3.7)
 * Two cards in a `core/columns`, so core stacks them at its own 781px and this
 * file adds no breakpoint. The column is made a flex container purely so the
 * card stretches to the taller of the two — `height: 100%` would depend on the
 * column resolving a definite height, which it only does by stretching anyway.
 * ---------------------------------------------------------------------- */
.oc-card-grid--choice .oc-card-grid__title,
.oc-card-grid__note {
	text-align: center;
}

.oc-card-grid__note {
	color: var(--wp--preset--color--accent-6, #454545);
}

/* Same exception as `.oc-card-grid__head` above: core/columns carries
   `margin-bottom: 1.75em` in a `:where()` wrapper, and the shell's own blockGap
   is what should be spacing this row. */
.oc-card-grid__cols {
	margin-bottom: 0;
}

.oc-card-grid__cols > .wp-block-column {
	display: flex;
}

.oc-card--choice {
	flex: 1;
}

.oc-card--choice .oc-card__title {
	font-size: clamp(1.25rem, 2vw, 1.5rem);
}

/* Pins the button to the card's bottom edge so the two cards' actions line up
   whatever the heading wraps to. Written at two classes, on the same logical
   property core's flow gap sets, so it does not depend on load order — the same
   reasoning as `.oc-card__body > .oc-card__link` above. */
.oc-card--choice > .oc-card__actions {
	margin-block-start: auto;
}

/* --------------------------------------------------------------------------
 * Site Editor canvas fixes
 * Selectors containing `.editor-styles-wrapper` are passed through unprefixed
 * by the editor's style transform, so they only ever apply inside the canvas.
 * ---------------------------------------------------------------------- */

/* The editor draws grid items with its own outlines; a translate on hover makes
   the block toolbar chase the card. Keep the shadow, drop the movement. */
.editor-styles-wrapper .oc-card:hover,
.editor-styles-wrapper .oc-card:focus-within {
	transform: none;
}

/* --------------------------------------------------------------------------
 * Series tiles (`/products/routers-series/`, PR 6.1)
 *
 * Each tile is a full-colour product logo over its linked series name — a jump to
 * the section below. The logo is the tile's picture, not a glyph, so it gets no
 * badge: `.oc-card__logo`, not `.oc-card__icon`.
 * ---------------------------------------------------------------------- */
.oc-card--tile {
	align-items: center;
	text-align: center;
}

.oc-card--tile .oc-card__logo img {
	display: block;
	width: 96px;
	height: auto;
	margin-inline: auto;
}

/* --------------------------------------------------------------------------
 * Portal cards (`/platforms-and-management-portals/`, PR 6.1)
 *
 * Nine portals' logos, each its own shape and size: one height, so the names and
 * the "Sign In" buttons under them line up across the grid.
 * ---------------------------------------------------------------------- */
.oc-card--portal .oc-card__logo img {
	width: auto;
	max-width: 100%;
	height: 56px;
	object-fit: contain;
}

/* --------------------------------------------------------------------------
 * Partner cards (`/partners/`, PR 6.1)
 *
 * Seventeen logos at one height, and "Learn More" pinned to the card's foot so a
 * row's buttons line up however long its copy runs — the `.oc-card--choice` rule,
 * for the same reason. The height is the portal cards' 56px doubled: these files
 * are 3:2 boards with the wordmark small in the middle, so 56px leaves it a smudge.
 * ---------------------------------------------------------------------- */
.oc-card--partner .oc-card__logo img {
	width: auto;
	max-width: 100%;
	height: 112px;
	object-fit: contain;
}

.oc-card--partner > .oc-card__actions {
	margin-block-start: auto;
}

/* --------------------------------------------------------------------------
 * Model cards (`/our-approach/`, PR 6.1)
 *
 * White line icons on the brand fill, as live (there on `primary`, here `accent-2`
 * for white text at 5.77:1). The card text inherits the group's white; the body
 * copy class would otherwise set it grey.
 * ---------------------------------------------------------------------- */
.oc-card--model .oc-card__text {
	color: inherit;
}

/* Not a link target, so none of `.oc-card`'s lift: a surface that moves under the
   pointer and does nothing promises what it can't keep (`stats.css`' reasoning). */
.oc-card--model:hover,
.oc-card--model:focus-within {
	box-shadow: 0 6px 24px 0 rgba(29, 44, 56, 0.08);
	transform: none;
}

/* The icon has no badge, as live: white line art straight on the fill. */
.oc-card--model .oc-card__glyph {
	margin-block-end: var(--wp--preset--spacing--10, 0.25rem);
}

/* --------------------------------------------------------------------------
 * Leadership and award cards (`/about-us/`, PR 6.1)
 *
 * Neither is a link, so neither lifts (the model cards' reasoning); the role reads as
 * the person's label, in `accent-2` at 5.77:1.
 * ---------------------------------------------------------------------- */
.oc-card--person:hover,
.oc-card--person:focus-within,
.oc-card--award:hover,
.oc-card--award:focus-within {
	box-shadow: 0 6px 24px 0 rgba(29, 44, 56, 0.08);
	transform: none;
}

.oc-card--person .oc-card__role {
	color: var(--wp--preset--color--accent-2, #006ba4);
	font-weight: 600;
}

/* --------------------------------------------------------------------------
 * Timeline (`/about-us/`, PR 6.1)
 *
 * Each year under a short brand rule, the year itself in `accent-2`, so the grid reads
 * as a sequence of dated entries rather than a wall of cards.
 * ---------------------------------------------------------------------- */
.oc-timeline__item {
	border-top: 3px solid var(--wp--preset--color--accent-1, #0081c2);
	padding-top: var(--wp--preset--spacing--30, 1rem);
}

.oc-timeline__item .oc-timeline__year {
	color: var(--wp--preset--color--accent-2, #006ba4);
}

/* The global family's map (`/about-us/`): centred under its copy. The figure is the
   column's width in a constrained layout, so the image centres inside it. */
.oc-family .oc-family__map {
	text-align: center;
}

/* --------------------------------------------------------------------------
 * Support cards (`/contact-us/`, PR 6.1)
 *
 * A label over a phone number or an address in each line, so no bullets: the bold
 * label is the line's marker. An email address is one unbreakable word, wider than
 * a narrow card, so it may break anywhere rather than overflow.
 * ---------------------------------------------------------------------- */
.oc-card--support .oc-card__contacts {
	display: grid;
	gap: var(--wp--preset--spacing--30, 1rem);
	padding-inline-start: 0;
	list-style: none;
}

.oc-card--support .oc-card__contacts a {
	overflow-wrap: anywhere;
}

/* --------------------------------------------------------------------------
 * Fee badges (`/get-sim-cards/`, PR 6.1)
 *
 * Three short titles under their icons, centred as live: the icon is the
 * badge's glyph, so it keeps `.oc-card__icon`'s round, centred here.
 * ---------------------------------------------------------------------- */
.oc-card--badge {
	text-align: center;
}

.oc-card--badge .oc-card__icon {
	margin-inline: auto;
}

/* --------------------------------------------------------------------------
 * Jump cards (`/applications/`, PR 6.1)
 *
 * Six links to the page's own sections, each an icon over a title. Live they
 * are bold feature titles; here the title is a paragraph (they navigate, so
 * they are not headings), set bold, and its link covers the card, since the
 * whole card lifts on hover like a link would.
 * ---------------------------------------------------------------------- */
.oc-card--jump {
	position: relative;
}

.oc-card--jump .oc-card__title {
	font-weight: 700;
}

.oc-card--jump .oc-card__title a::after {
	position: absolute;
	inset: 0;
	content: "";
}

/* --------------------------------------------------------------------------
 * Comparison table (`/managed-iot-connectivity-vs-diy/`, PR 6.1)
 *
 * Live, an `html` widget with its own `<style>`: a dark header row, row
 * headers on a light ground, and the managed column tinted with a blue rule.
 * The same here on a `core/table`, in theme colours. On a narrow screen the
 * three columns wrap rather than scroll: a scrolled-off column would be out of
 * reach for a keyboard, and the cells are short phrases.
 * ---------------------------------------------------------------------- */
.oc-compare__table {
	max-width: 900px;
	margin-inline: auto;
}

.oc-compare__table table {
	overflow-wrap: anywhere;
	border-collapse: collapse;
	font-size: var(--wp--preset--font-size--small, 0.9375rem);
}

.oc-compare__table th,
.oc-compare__table td {
	padding: clamp(0.5rem, 2vw, 0.875rem) clamp(0.375rem, 2vw, 1.125rem);
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--accent-5, #eff2f8);
	text-align: left;
	vertical-align: top;
}

.oc-compare__table thead th {
	background-color: var(--wp--preset--color--accent-2, #006ba4);
	color: var(--wp--preset--color--base, #fff);
	font-weight: 600;
}

.oc-compare__table tbody th {
	width: 30%;
	background-color: var(--wp--preset--color--accent-5, #eff2f8);
	font-weight: 600;
}

.oc-compare__table tbody td:nth-child(2) {
	border-left: 3px solid var(--wp--preset--color--accent-1, #0081c2);
	background-color: var(--wp--preset--color--accent-5, #eff2f8);
	font-weight: 500;
}
