/* AstroWay widget styles. Theme-overridable via CSS custom properties on .astroway-embed. */

.astroway-embed {
	--astroway-bg: transparent;
	--astroway-border: 0;
	--astroway-border-radius: 8px;
	--astroway-max-width: 100%;
	--astroway-margin: 1em auto;
	--astroway-min-height: 240px;

	background: var(--astroway-bg);
	border: var(--astroway-border);
	border-radius: var(--astroway-border-radius);
	max-width: var(--astroway-max-width);
	margin: var(--astroway-margin);
	overflow: hidden;
	line-height: 0;
	min-height: var(--astroway-min-height);
}

.astroway-embed__iframe {
	display: block;
	width: 100%;
	max-width: 100%;
	border: 0;
	background: transparent;
}

/* The admin-only note is text, not a frame, so it needs the line box back:
   `line-height: 0` on the wrapper exists to kill the gap under an iframe, and
   it collapsed the note's lines onto each other. */

.astroway-embed--unavailable {
	--astroway-min-height: 0;

	line-height: 1.5;
	padding: 0.9em 1.1em;
	border: 1px dashed var(--astroway-card-line, rgba(128, 128, 128, 0.35));
	border-radius: 8px;
	font-size: 0.9em;
	opacity: 0.85;
}

.astroway-embed--unavailable p {
	margin: 0;
}

/* Per-widget max-width matches the embed page's intrinsic content width */
.astroway-embed--natal,
.astroway-embed--bodygraph,
.astroway-embed--daily-horoscope {
	--astroway-max-width: 460px;
}

.astroway-embed--moon-phase,
.astroway-embed--tarot-daily {
	--astroway-max-width: 320px;
}

@media (max-width: 480px) {
	.astroway-embed {
		--astroway-max-width: 100%;
		margin-inline: 0;
	}
}

/* ── Server-rendered cards ───────────────────────────────────────────────────
   These hold real text in the page DOM, so unlike the iframe they inherit the
   theme's font and colour by default. Every value is a custom property a theme
   can override; the defaults deliberately borrow currentColor rather than
   picking a palette, so a card looks native in a light and a dark theme alike
   without either side knowing about the other. */

.astroway-card {
	--astroway-card-bg: transparent;
	--astroway-card-fg: inherit;
	--astroway-card-muted: color-mix(in srgb, currentColor 62%, transparent);
	--astroway-card-line: color-mix(in srgb, currentColor 18%, transparent);
	--astroway-card-accent: currentColor;
	--astroway-card-band: color-mix(in srgb, currentColor 5%, transparent);
	--astroway-card-stripe: color-mix(in srgb, currentColor 2.5%, transparent);
	--astroway-card-current: color-mix(in srgb, currentColor 11%, transparent);
	--astroway-card-radius: 10px;
	--astroway-card-padding: 1.25em 1.4em;
	--astroway-card-max-width: 34em;
	--astroway-card-margin: 1.5em 0;

	display: block;
	box-sizing: border-box;
	max-width: var(--astroway-card-max-width);
	margin: var(--astroway-card-margin);
	padding: var(--astroway-card-padding);
	background: var(--astroway-card-bg);
	color: var(--astroway-card-fg);
	border: 1px solid var(--astroway-card-line);
	border-radius: var(--astroway-card-radius);
}

/* Older engines without color-mix fall back to a flat tint rather than an
   invisible border. */
@supports not (color: color-mix(in srgb, currentColor 50%, transparent)) {
	.astroway-card {
		--astroway-card-muted: inherit;
		--astroway-card-line: rgba(128, 128, 128, 0.32);
		--astroway-card-band: rgba(128, 128, 128, 0.09);
		--astroway-card-stripe: rgba(128, 128, 128, 0.045);
		--astroway-card-current: rgba(128, 128, 128, 0.19);
	}
}

.astroway-card__header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25em 1em;
	margin-block-end: 0.9em;
	padding-block-end: 0.8em;
	border-block-end: 1px solid var(--astroway-card-line);
}

.astroway-card__title {
	margin: 0;
	font-size: 1.05em;
	line-height: 1.3;
}

.astroway-card__meta {
	font-size: 0.85em;
	color: var(--astroway-card-muted);
}

.astroway-card__lead {
	margin: 0 0 0.5em;
	font-size: 1.25em;
	font-weight: 600;
	line-height: 1.25;
	color: var(--astroway-card-accent);
}

.astroway-card__glyph {
	font-size: 1.15em;
	line-height: 1;
}

.astroway-card__body {
	margin: 0;
}

.astroway-card__body p {
	margin: 0 0 0.85em;
}

.astroway-card__body p:last-child {
	margin-bottom: 0;
}

.astroway-card__keywords {
	margin: 0 0 0.75em;
	font-size: 0.9em;
	color: var(--astroway-card-muted);
}

.astroway-card__details {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.35em 1em;
	margin: 0;
}

.astroway-card__details dt {
	font-size: 0.9em;
	color: var(--astroway-card-muted);
}

.astroway-card__details dd {
	margin: 0;
	font-size: 0.95em;
}

.astroway-card__themes {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.astroway-card__themes li {
	padding: 0.15em 0.6em;
	font-size: 0.85em;
	border: 1px solid var(--astroway-card-line);
	border-radius: 999px;
}

.astroway-card__note {
	margin-top: 1em;
	padding-top: 0.75em;
	border-top: 1px solid var(--astroway-card-line);
	font-size: 0.8em;
	line-height: 1.45;
	color: var(--astroway-card-muted);
}

@media (max-width: 480px) {
	.astroway-card {
		--astroway-card-padding: 1em;
		--astroway-card-max-width: 100%;
	}

	.astroway-card__details {
		grid-template-columns: 1fr;
		gap: 0.1em;
	}

	.astroway-card__details dd {
		margin-bottom: 0.5em;
	}
}

/* Natal card: the wheel keeps its own sizing, the text below it is a table so a
   screen reader can navigate it by row and column. */

.astroway-card--natal {
	--astroway-card-max-width: 40em;
}

.astroway-card--natal .astroway-embed {
	margin: 0 0 1em;
	min-height: 0;
}

/* A subtitle opens a section, and a section inside a card needs a line above it
   or the card reads as one long column. Not after the header, which has its own. */
.astroway-card__subtitle {
	margin-block: 1.4em 0.5em;
	padding-block-start: 1em;
	border-block-start: 1px solid var(--astroway-card-line);
	font-size: 0.95em;
	font-weight: 600;
}

.astroway-card__header + .astroway-card__subtitle,
.astroway-card__subtitle:first-child {
	margin-block-start: 0;
	padding-block-start: 0;
	border-block-start: 0;
}

/* One framed table rather than a stack of underlined rows. The frame is what
   makes a table read as a block of its own inside the card, and the banded
   header is what keeps the column names from reading as a first row of data.
   Everything here is `start` and `block`/`inline` rather than left and bottom,
   because the plugin ships Arabic and a table hard-aligned to the left is
   wrong in it. */

.astroway-card__placements {
	inline-size: 100%;
	margin-block-start: 0.6em;
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
	font-size: 0.92em;
	border: 1px solid var(--astroway-card-line);
	border-radius: calc(var(--astroway-card-radius) - 4px);
}

.astroway-card__placements caption {
	margin-block-end: 0.4em;
	font-size: 1.03em;
	font-weight: 600;
	text-align: start;
}

.astroway-card__placements thead tr {
	background: var(--astroway-card-band);
}

.astroway-card__placements th,
.astroway-card__placements td {
	padding: 0.45em 0.7em;
	text-align: start;
	vertical-align: baseline;
}

.astroway-card__placements th {
	font-weight: 600;
	font-size: 0.86em;
	letter-spacing: 0.01em;
	white-space: nowrap;
	color: var(--astroway-card-muted);
	border-block-end: 1px solid var(--astroway-card-line);
}

/* Stripes rather than a rule per row: at twenty-four rows the rules become a
   grid the eye has to read through, and the stripe does the same job quietly. */
.astroway-card__placements tbody tr:nth-child(even) {
	background: var(--astroway-card-stripe);
}

/* The muted last column belongs to the natal placements, where it holds the
   house number beside a position. On the sky tables the last column is the
   answer, and greying it out was a heuristic firing where it was never meant to. */
.astroway-card--natal .astroway-card__placements td:last-child {
	font-size: 0.88em;
	color: var(--astroway-card-muted);
}

.astroway-card__aspects {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3em 0.9em;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

@media (max-width: 480px) {
	.astroway-card__placements {
		font-size: 0.86em;
	}

	.astroway-card__placements th,
	.astroway-card__placements td {
		padding-inline: 0.45em;
	}
}

/* Bodygraph card: all text, no drawing to make room for. */

.astroway-card--bodygraph {
	--astroway-card-max-width: 40em;
}

.astroway-card__channels {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3em 0.9em;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9em;
}

/* A single placement: one answer, so the sign itself carries the card. */

.astroway-card--moon-sign,
.astroway-card--rising-sign {
	--astroway-card-max-width: 26em;
}

.astroway-card--moon-sign .astroway-card__lead,
.astroway-card--rising-sign .astroway-card__lead {
	font-size: 1.5em;
	line-height: 1.2;
}

/* The section only groups: it sets the sign for the blocks inside and stays out
   of the way of whatever layout the theme gives them. */

.astroway-section {
	display: flex;
	flex-direction: column;
	gap: 1.25em;
}

/* Generated cards: shapes we did not choose, so the layout has to survive
   anything from three fields to a thirteen-column table. */

.astroway-card--generic {
	--astroway-card-max-width: 44em;
}

.astroway-card__scroll {
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
}

.astroway-card__scroll .astroway-card__placements {
	min-width: max-content;
}

.astroway-card--generic .astroway-card__subtitle {
	margin-top: 1.4em;
}

/* Sky cards: what the sky is doing right now. Each is a short answer over a
   table, and in two of them exactly one row is the answer. */

.astroway-card--retrograde,
.astroway-card--retrogrades,
.astroway-card--moon-voc,
.astroway-card--planetary-hours {
	--astroway-card-max-width: 42em;
}

/* The row the reader is inside: the current planetary hour, the void of course
   window that is open. Weight and a wash rather than a colour, so it reads the
   same in a dark theme and to anyone who cannot see the wash.
   The wash is four times the zebra stripe on purpose: at the same strength the
   marked row landed on an even row and disappeared into the striping. */
.astroway-card__row--current > td {
	font-weight: 600;
	background: var(--astroway-card-current);
}

/* "Yes, Mercury is retrograde" is the reason the widget is on the page; the
   other answer is the quiet one. */
.astroway-card__lead--no {
	color: var(--astroway-card-muted);
	font-weight: 500;
}

/* Twenty-four rows of two words each: the hour table can afford to be tighter
   than the placements it borrows its styling from. */
.astroway-card--planetary-hours .astroway-card__placements td {
	padding-top: 0.22em;
	padding-bottom: 0.22em;
}

/* Sign cards: one is an essay, one is six facts. */

.astroway-card--zodiac-compatibility {
	--astroway-card-max-width: 44em;
}

.astroway-card--chinese-zodiac {
	--astroway-card-max-width: 26em;
}

.astroway-card--chinese-zodiac .astroway-card__lead {
	display: flex;
	align-items: center;
	gap: 0.4em;
}

/* ── Tabs ────────────────────────────────────────────────────────────────────
   The strip a section grows once the enhancement script runs. Everything here
   is scoped to `--tabbed`, which only that script adds, so a section that never
   gets the script keeps its plain stacked layout and none of this applies. */

.astroway-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35em;
	margin-block-end: 1em;
	padding-block-end: 0.6em;
	border-block-end: 1px solid var(--astroway-card-line, rgba(128, 128, 128, 0.32));
}

.astroway-tabs__tab {
	appearance: none;
	margin: 0;
	padding: 0.45em 0.9em;
	font: inherit;
	font-size: 0.92em;
	line-height: 1.3;
	color: var(--astroway-card-muted, inherit);
	background: transparent;
	border: 1px solid transparent;
	border-radius: 999px;
	cursor: pointer;
}

.astroway-tabs__tab:hover {
	color: inherit;
	background: var(--astroway-card-stripe, rgba(128, 128, 128, 0.06));
}

/* Selected rather than active: aria-selected is the state that decides which
   panel is shown, so the styling reads the same attribute rather than a class
   that could drift away from it. */
.astroway-tabs__tab[aria-selected="true"] {
	color: inherit;
	font-weight: 600;
	background: var(--astroway-card-current, rgba(128, 128, 128, 0.14));
	border-color: var(--astroway-card-line, rgba(128, 128, 128, 0.32));
}

.astroway-tabs__tab:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* A tabbed panel is the only card on screen, so the margin that separated it
   from its neighbours is now a gap under the tab strip and nothing else. */
.astroway-section--tabbed > .astroway-card {
	margin-block-start: 0;
}

/* `hidden` is a UA-stylesheet rule, and ANY author rule outranks it. The cards
   set `display: block` on themselves, so setting the attribute did nothing at
   all: every panel stayed on screen under the tab strip. Caught by looking at
   the page; the DOM reported exactly what it was asked to report. */
.astroway-section--tabbed > [hidden] {
	display: none;
}

/* Narrow screens: the strip scrolls sideways rather than wrapping into three
   rows of buttons above a card. */
@media (max-width: 480px) {
	.astroway-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scrollbar-width: none;
	}

	.astroway-tabs::-webkit-scrollbar {
		display: none;
	}

	.astroway-tabs__tab {
		flex: 0 0 auto;
	}
}

/* Synastry: one number, then the aspects that produced it. */

.astroway-card--synastry {
	--astroway-card-max-width: 42em;
}

.astroway-card__score {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.15em 0.6em;
	margin: 0 0 0.5em;
}

.astroway-card__score-value {
	font-size: 2.4em;
	font-weight: 700;
	line-height: 1;
	color: var(--astroway-card-accent);
}

/* The per cent sign is a unit, not part of the figure, and at the size of the
   figure it shouts. */
.astroway-card__score-value span {
	font-size: 0.45em;
	font-weight: 600;
	margin-inline-start: 0.1em;
}

.astroway-card__score-label {
	font-size: 1.05em;
	font-weight: 600;
}

/* The bar is the figure above drawn again, nothing more, which is why it is
   hidden from assistive technology rather than labelled. */
.astroway-card__meter {
	block-size: 6px;
	margin-block-end: 1em;
	border-radius: 999px;
	/* The line tint, not the band tint. At 5% the empty half of the bar was
	   invisible and the filled half read as an underline that stopped early. */
	background: var(--astroway-card-line);
	overflow: hidden;
}

.astroway-card__meter > span {
	display: block;
	block-size: 100%;
	border-radius: inherit;
	background: var(--astroway-card-accent);
}

/* Every card that folds detail away uses the same summary, so the styling that
   was scoped to the generic renderer moves out to all of them. */
.astroway-card__more {
	margin-block-start: 0.9em;
	font-size: 0.95em;
}

.astroway-card__more summary {
	cursor: pointer;
	color: var(--astroway-card-muted);
}
