/* The portal. Colours are variables so the theme, or Audrey, can override them. */

.yss-portal-wrap {
	--yss-text: #1f1f1f;
	--yss-muted: #6b6b6b;
	--yss-rule: #4a4a4a;
	--yss-line: #d9d9d9;
	--yss-bg: transparent;
	--yss-radius: 10px;

	color: var(--yss-text);
	background: var(--yss-bg);
}

/* The account navigation is removed from the markup here, so the content can use the full width. */
.yss-portal .woocommerce-MyAccount-content {
	width: 100%;
	float: none;
	margin: 0;
}

/* On a creature's own page its name is the heading, so the theme's page title steps aside. */
.yss-portal-creature .entry-header {
	display: none;
}

.yss-portal-exit {
	margin: 0 0 1.5rem;
}

.yss-exit-link {
	display: inline-block;
	padding: 0.35rem 0;
	color: var(--yss-muted);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}

.yss-exit-link:hover,
.yss-exit-link:focus {
	color: var(--yss-text);
	border-bottom-color: currentColor;
}

/*
 * A focus ring in the portal's own text colour, since the theme's own cannot be
 * relied on. Not the element's colour: the theme turns links pale gold on focus,
 * and dark buttons have white text, which would give a white ring on a white page.
 */
.yss-portal-wrap a:focus-visible,
.yss-portal-wrap button:focus-visible,
.yss-portal-wrap input:focus-visible,
.yss-portal-wrap summary:focus-visible,
.yss-portal-wrap [tabindex]:focus-visible {
	outline: 3px solid var(--yss-text);
	outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.yss-portal-wrap * {
		animation: none !important;
		transition: none !important;
	}
}

/* ---------- The collection ---------- */

.yss-grid-heading {
	margin: 0 0 1.5rem;
	font-size: 1.25rem;
}

.yss-empty {
	color: var(--yss-muted);
}

/* An empty sanctuary's way to the shop, drawn like the welcome's Continue button. */
.yss-empty-adopt {
	margin: 1.25rem 0 0;
}

/* Specific enough that the theme's link colours on hover and focus don't reach it. */
.yss-portal-wrap a.yss-adopt-button,
.yss-portal-wrap a.yss-adopt-button:visited,
.yss-portal-wrap a.yss-adopt-button:hover,
.yss-portal-wrap a.yss-adopt-button:focus {
	display: inline-block;
	padding: 0.85rem 2.5rem;
	border: 1px solid var(--yss-text);
	border-radius: 6px;
	background: var(--yss-text);
	color: #fff;
	text-decoration: none;
}

.yss-portal-wrap a.yss-adopt-button:hover {
	text-decoration: underline;
}

/* When the collection's next eggs hatch or hatchlings grow up, just under the heading. */
.yss-next-change {
	margin: -0.75rem 0 1.5rem;
}

/* No borders: the creatures share one space rather than sitting in boxes. */
.yss-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2rem 1.25rem;
}

@media (min-width: 600px) {
	.yss-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 900px) {
	.yss-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1200px) {
	.yss-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.yss-tile {
	margin: 0;
}

/* Specific enough that the theme's gold link colour on hover and focus doesn't reach the tiles. */
.yss-portal-wrap .yss-tile-link {
	display: block;
	color: inherit;
	text-decoration: none;
	text-align: center;
	border-radius: var(--yss-radius);
}

.yss-tile-image {
	display: block;
	aspect-ratio: 1 / 1;
	margin: 0 0 0.5rem;
}

.yss-tile-image img,
.yss-tile-noimage {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.yss-tile-noimage {
	background: var(--yss-line);
	border-radius: var(--yss-radius);
	opacity: 0.5;
}

.yss-tile-name {
	display: block;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.yss-tile-meta {
	display: block;
	font-size: 0.85em;
	color: var(--yss-muted);
}

.yss-tile-link:hover .yss-tile-name,
.yss-tile-link:focus-visible .yss-tile-name {
	text-decoration: underline;
}

/* ---------- A creature's own page ---------- */

.yss-creature {
	max-width: 48rem;
	margin: 0 auto;
}

/* Backgrounds will sit here, behind the creature. */
.yss-creature-stage {
	display: flex;
	align-items: flex-end;
	justify-content: center;
	min-height: 16rem;
	margin: 0 0 1.5rem;
	padding: 1rem;
	background-position: center;
	background-size: cover;
	border-radius: var(--yss-radius);
}

.yss-creature-image {
	max-width: 100%;
	max-height: 60vh;
	width: auto;
	height: auto;
	object-fit: contain;
}

.yss-creature-name {
	margin: 0 0 0.25rem;
	text-align: center;
	font-size: clamp(2rem, 5vw, 3rem);
	line-height: 1.15;
}

.yss-rename-toggle-wrap {
	margin: 0 0 2rem;
	text-align: center;
}

/* When the rename form is open, it sits just under its button. */
.yss-rename-toggle-wrap:has(+ .yss-rename:not([hidden])) {
	margin-bottom: 0.75rem;
}

.yss-rename-toggle {
	padding: 0.25rem 0.5rem;
	border: 0;
	background: none;
	color: var(--yss-muted);
	font: inherit;
	text-decoration: underline;
	cursor: pointer;
}

.yss-rename-toggle:hover {
	color: var(--yss-text);
}

.yss-rename {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	margin: 0 0 2rem;
}

/* display:flex would otherwise override the hidden attribute. */
.yss-rename[hidden] {
	display: none;
}

.yss-rename input {
	flex: 0 1 16rem;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--yss-line);
	border-radius: 6px;
	font: inherit;
}

.yss-rename-save {
	padding: 0.5rem 1rem;
	border: 1px solid var(--yss-text);
	border-radius: 6px;
	background: var(--yss-text);
	color: #fff;
	font: inherit;
	cursor: pointer;
}

.yss-rename-status {
	flex: 1 0 100%;
	text-align: center;
	font-size: 0.9em;
	color: var(--yss-muted);
	min-height: 1.2em;
}

.yss-facts {
	margin: 0 0 2rem;
}

.yss-facts > div {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	margin: 0 0 0.25rem;
}

.yss-facts dt {
	margin: 0;
	font-weight: 700;
}

.yss-facts dt::after {
	content: ':';
}

.yss-facts dd {
	margin: 0;
}

.yss-section {
	border-top: 1px solid var(--yss-rule);
	padding: 1rem 0;
}

.yss-section h2 {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 700;
}

.yss-section summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	list-style: none;
	cursor: pointer;
}

.yss-section summary::-webkit-details-marker {
	display: none;
}

/* A small chevron: pointing down when open, right when folded away. */
.yss-section summary::after {
	content: '';
	flex: none;
	width: 0.5rem;
	height: 0.5rem;
	margin-right: 0.25rem;
	border-right: 2px solid var(--yss-muted);
	border-bottom: 2px solid var(--yss-muted);
	transform: rotate(45deg);
}

.yss-section:not([open]) summary::after {
	transform: rotate(-45deg);
}

.yss-section-body {
	padding-top: 0.75rem;
}

.yss-section-body p:last-child {
	margin-bottom: 0;
}

.yss-unknown {
	margin: 0.75rem 0 0;
	color: var(--yss-muted);
	letter-spacing: 0.1em;
}

.yss-creature-artist {
	margin: 0;
	padding: 1rem 0 0;
	border-top: 1px solid var(--yss-rule);
}

/* Underlined, so it reads as a link without relying on bold alone. */
.yss-portal-wrap .yss-creature-artist a {
	color: inherit;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

/* ---------- The welcome: the whole screen ---------- */

.yss-welcome {
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: var(--yss-text);
	overscroll-behavior: contain;
}

/* Only when open: display would otherwise show the dialog while closed. */
.yss-welcome[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.yss-welcome::backdrop {
	background: rgba(0, 0, 0, 0.55);
}

.yss-welcome-inner {
	width: min(100%, 40rem);
	max-height: 100%;
	overflow: auto;
	padding: 3rem 1.5rem;
	text-align: center;
	overscroll-behavior: contain;
}

.yss-welcome h2 {
	margin: 0 0 1.5rem;
	font-size: clamp(1.75rem, 4vw, 2.5rem);
	outline: none;
}

.yss-welcome-body {
	margin: 0 0 2rem;
	text-align: left;
	font-size: 1.1rem;
	line-height: 1.6;
}

/* A blank line in the welcome text starts a new paragraph, with a gap before it,
   whatever the theme does with paragraph spacing. */
.yss-welcome .yss-welcome-body p {
	margin: 0 0 1em;
}

.yss-welcome .yss-welcome-body p:last-child {
	margin-bottom: 0;
}

.yss-welcome-continue {
	padding: 0.85rem 2.5rem;
	border: 1px solid var(--yss-text);
	border-radius: 6px;
	background: var(--yss-text);
	color: #fff;
	font: inherit;
	cursor: pointer;
}

html:has(.yss-welcome[open]),
body:has(.yss-welcome[open]) {
	overflow: hidden;
}

/* ---------- The way in, on the account dashboard ---------- */

.yss-dashboard-entry {
	margin: 1.5rem 0 0;
}

.yss-dashboard-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: min(100%, 28rem);
	aspect-ratio: 12 / 5;
	padding: 1rem;
	border: 2px solid #d9a45b;
	border-radius: 2rem;
	background-color: #f6efe3;
	background-position: center;
	background-size: cover;
	color: #1f1f1f;
	text-decoration: none;
}

.yss-dashboard-button-label {
	width: 70%;
	padding: 1.25rem 1.5rem;
	border-radius: 2rem;
	background: #fff;
	font-size: clamp(1.15rem, 4.5vw, 1.6rem);
	line-height: 1.35;
	text-align: center;
}

.yss-dashboard-button:hover .yss-dashboard-button-label,
.yss-dashboard-button:focus-visible .yss-dashboard-button-label {
	text-decoration: underline;
}

.yss-dashboard-button:focus-visible {
	outline: 3px solid #1f1f1f;
	outline-offset: 3px;
}

/* ---------- Shared ---------- */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Sharing a creature's picture. */
.yss-share { margin: 2em 0 1em; }
.yss-share-help { margin: 0 0 1em; }
.yss-share-preview { display: block; max-width: 200px; height: auto; margin: 0 0 1em; }
.yss-share-row { margin: 0 0 .9em; }
.yss-share-row label { display: block; font-weight: 600; margin: 0 0 .25em; }
.yss-share-field { display: flex; flex-wrap: wrap; gap: .5em; }
.yss-share-field input { flex: 1 1 14em; min-width: 0; font-size: .9em; }
/* The label always reserves room for "Copied", so the button never changes width. */
.yss-share .yss-copy-label { display: inline-grid; }
.yss-share .yss-copy-label::after { content: attr(data-done); visibility: hidden; height: 0; overflow: hidden; }
/* The theme removes the outline from text boxes, so this one is made specific enough to win. */
.yss-share .yss-share-field input[type="text"]:focus,
.yss-share .yss-share-field input[type="text"]:focus-visible,
.yss-share .yss-copy:focus-visible { outline: 2px solid var(--yss-text) !important; outline-offset: 2px; }

/* Announcements are for screen readers; sighted visitors see the change itself. */
.yss-live { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The theme removes the outline from text boxes; the rename box gets one that wins. */
.yss-rename input[type="text"]:focus,
.yss-rename input[type="text"]:focus-visible,
.yss-rename .yss-rename-save:focus-visible { outline: 2px solid var(--yss-text) !important; outline-offset: 2px; }