/*
 * Product page, Figma node 934:43578 (content 934:43658). The stacked sections of
 * components/product-detail.php: formats, sensory text, nutrition table and the box of
 * extras. They were the sections of the product modal until the modal gave way to this
 * page (change product-page); the dialog rules went with it.
 *
 * Mobile first. The frame only exists at 1440: 412 image column at x 112 and a 721 content
 * column at x 607, the same grid as the recipe page, with the image sticky. Below 1024 the
 * image stacks on top of the content (provisional, docs/BACKLOG.md).
 */

/* Image and content */

.product-detail {
	background-color: var(--color-surface);
}

.product-detail__inner {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	padding-block: var(--space-2) var(--space-7);
}

/*
 * The 412 x 547 IMG frame of 934:43585, with no card: the packshot stands on the white page
 * (Henrique for the client, 2026-12-03, change product-image-proportions). The frame's gray
 * 412 x 440 rectangle is left out; the format tiles keep their gray. The packshot is
 * contained in the box, so no shape leaves the column. Stacked below 1024, the box is
 * capped at 440 so it never fills the screen.
 */
.product-detail__media {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 412 / 547;
	max-height: 440px;
}

.product-detail__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* One wrapper per photo; the format tiles show one and hide the rest (product-formats.js). */
.product-detail__photo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	animation: product-photo-in var(--duration-base) var(--ease-out);
}

.product-detail__photo[hidden] {
	display: none;
}

@keyframes product-photo-in {
	from {
		opacity: 0;
	}
}

.product-detail__content {
	display: flex;
	flex-direction: column;
	gap: var(--space-6);
	min-width: 0;
}

.product-detail__title {
	color: var(--color-heading);
	font-size: var(--font-h1);
}

/* Stacked sections (919:40703): 16 from a Larken 24 Main Red heading to its content. */
.product-section {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.product-section__title {
	color: var(--color-title-card);
	font-size: var(--font-h5);
}

/* Perfeito para, Ingredientes, Alérgenos and the shelf lives sit in a grey box (36 inset in the frame, the nearest token). */
.product-section--extra {
	padding: var(--space-5);
	border-radius: var(--radius-card);
	background-color: var(--color-surface-muted);
}

/* Formatos */

.package-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
}

.package-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-3);
	width: 160px;
	height: 160px;
	padding: 14px;
	border-radius: var(--radius-card);
	background-color: var(--color-surface-muted);
	text-align: center;
}

/*
 * A format with its own photo is a button that switches the photo card. Figma draws no
 * selected state: the pressed tile gets a Main Red ring, provisional (docs/BACKLOG.md 126).
 */
.package-card--button {
	border: 0;
	font: inherit;
	cursor: pointer;
	transition: box-shadow var(--duration-base) var(--ease-out);
}

.package-card--button[aria-pressed='true'] {
	box-shadow: inset 0 0 0 2px var(--color-surface-brand);
}

.package-card__image {
	width: auto;
	max-height: 84px;
	object-fit: contain;
}

.package-card__label {
	color: var(--color-title-card);
	font-family: var(--font-heading);
	/* Larken 18 in 754:45903. */
	font-size: var(--font-p2);
	font-weight: var(--weight-heading);
	line-height: var(--lh-heading);
}

/* Características sensoriais: one paragraph, 707 wide (596:13019). */

.sensory-text {
	max-width: 707px;
	margin: 0;
	color: var(--color-text);
	font-size: var(--font-p2);
	line-height: 1.4;
}

/* Without the paragraph field the notes run inline in the same paragraph style. */
.sensory-text__note {
	display: inline;
}

.sensory-text__label,
.sensory-text__value {
	display: inline;
	margin: 0;
}

.sensory-text__label {
	font-weight: 500;
}

.sensory-text__label::after {
	content: ': ';
}

.sensory-text__note:not(:last-child) .sensory-text__value::after {
	content: '. ';
}

/* Informação Nutricional (597:13603, table 361:29142) */

.nutrition {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
}

.nutrition-table {
	width: 100%;
	border-collapse: collapse;
	text-align: left;
}

.nutrition-table__caption {
	margin-block-end: var(--space-3);
	color: var(--color-text);
	font-size: var(--font-p3);
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
}

/* 40px rows: 8 above a 24px line, 8 below it counting the 1px divider, 10 at the start. */
.nutrition-table th,
.nutrition-table td {
	padding: var(--space-1) 0 calc(var(--space-1) - 1px) 10px;
	border-bottom: 1px solid var(--color-surface-muted);
	color: var(--color-text);
	font-size: var(--font-p3);
	font-weight: 400;
	line-height: 24px;
}

/* The three value columns are 68.7 each in the node; the nutrient takes the rest. */
.nutrition-table th:not(:first-child),
.nutrition-table td {
	width: 69px;
	text-align: center;
}

/*
 * Stripes in Sand at the 36% of the Figma table (rgba(242, 234, 223, 0.36) in 934:43658),
 * mixed over the white surface; the extras box below is the gray one. Henrique, 2026-12-02:
 * they had shipped inverted (product-format-photos).
 */
.nutrition-table thead tr {
	background-color: color-mix(in srgb, var(--color-sand) 36%, var(--color-surface));
}

.nutrition-table thead th {
	border-top: 2px solid var(--color-surface-muted);
	font-weight: 600;
}

.nutrition-table tbody tr:nth-child(even) {
	background-color: color-mix(in srgb, var(--color-sand) 36%, var(--color-surface));
}

.nutrition-table__note {
	color: var(--color-text);
	font-size: var(--font-p4);
	line-height: 1.3;
}

.nutrition-table__note p {
	margin: 0;
}

/* Informação Extras (597:13525) */

.extra-info {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

.extra-info__block {
	display: flex;
	align-items: flex-start;
	gap: var(--space-3);
}

/* 754:45781: a 40px box, no background, the glyph at about 32. */
.extra-info__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 40px;
	height: 40px;
	color: var(--color-icon-accent);
}

.extra-info__icon svg {
	width: 32px;
	height: 32px;
}

.extra-info__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2);
	padding-block-start: 4px;
}

.extra-info__label {
	color: var(--color-title-card);
	font-size: var(--font-h5);
}

.extra-info__value {
	margin: 0;
	color: var(--color-text);
	font-size: var(--font-p2);
	line-height: 1.4;
}

/* TÓPICOS: a 24px marker with a 6px dot, 8 to the Larken 20 label, 8 between the items. */
.extra-info__list {
	display: flex;
	flex-direction: column;
	gap: var(--space-1);
	margin: 0;
	padding: 0;
	list-style: none;
}

.extra-info__item {
	display: flex;
	align-items: center;
	gap: var(--space-1);
	color: var(--color-text);
	font-family: var(--font-heading);
	font-size: var(--font-h7);
	font-weight: var(--weight-heading);
	line-height: var(--lh-heading);
}

.extra-info__item::before {
	flex: none;
	width: 24px;
	height: 6px;
	background: radial-gradient(circle, currentColor 3px, transparent 3.5px) center / 6px 6px no-repeat;
	content: '';
}

.extra-info__rich {
	color: var(--color-text);
	font-size: var(--font-p2);
	line-height: 1.4;
}

/* The page draws the section titles at H4 (28), against the H5 of the modal. */
.product-detail .product-section__title {
	font-size: var(--font-h4);
}

/*
 * The extras sit in the gray box of the approved modal (919:40703), with 36 of padding from
 * 768 up. 934:67988 draws it Sand, but Sand is the table stripes (Henrique, 2026-12-02).
 */
.product-detail .product-section--extra {
	padding: var(--space-3);
	background-color: var(--color-surface-muted);
}

@media (min-width: 768px) {
	.product-detail .product-section--extra {
		padding: 36px;
	}
}

@media (min-width: 1024px) {
	/* 412 card, 83 of gap, 721 of content: the 1216 of the container. */
	.product-detail__inner {
		display: grid;
		grid-template-columns: 412fr 721fr;
		align-items: start;
		gap: 83px;
		padding-block: 19px var(--section-padding-end);
	}

	.product-detail--no-media .product-detail__inner {
		grid-template-columns: 1fr;
	}

	.product-detail__media {
		position: sticky;
		top: calc(var(--header-height) + var(--space-4));
		max-height: none;
	}

	/* The title starts at 72 in the frame, 53 below the top of the card. */
	.product-detail__content {
		gap: var(--space-gap-section);
		padding-block-start: 53px;
	}
}

@media (max-width: 767px) {
	/* Three columns at 375px need tighter cells to stay inside the column. */
	.nutrition-table th,
	.nutrition-table td {
		padding: var(--space-1);
		font-size: var(--font-p4);
	}
}

@media (prefers-reduced-motion: reduce) {
	.product-detail__photo {
		animation: none;
	}

	.package-card--button {
		transition: none;
	}
}
