/*
 * Perepaik Theme
 * Design tokens, base styles, header, navigation and footer.
 *
 * Structured Perepaik data and business logic belong to Perepaik Core.
 * This file is presentation only.
 */

/* ---------------------------------------------------------
   Design tokens
   --------------------------------------------------------- */

:root {
	--pp-bg: #fffaf6;
	--pp-surface: #ffffff;
	--pp-surface-tint: #fcf3ec;
	--pp-ink: #26283a;
	--pp-ink-soft: #565869;
	--pp-muted: #868797;
	--pp-line: #f0e7de;

	--pp-coral: #e8836b;
	--pp-coral-strong: #d96c53;
	--pp-coral-soft: #fbe5dd;
	--pp-green: #87a275;
	--pp-green-soft: #e7eedf;
	--pp-purple: #9a86d4;
	--pp-purple-soft: #ede8f8;
	--pp-star: #e8836b;

	--pp-font-heading: "Fraunces", Georgia, "Times New Roman", serif;
	--pp-font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--pp-radius-lg: 22px;
	--pp-radius-md: 16px;
	--pp-radius-sm: 12px;

	--pp-shadow-sm: 0 2px 8px rgba(90, 64, 40, 0.05);
	--pp-shadow-md: 0 12px 32px rgba(90, 64, 40, 0.08);
	--pp-shadow-lg: 0 18px 44px rgba(90, 64, 40, 0.12);

	--pp-container: 1240px;
	--pp-gutter: 32px;
	--pp-header-height: 76px;
	--pp-bottom-nav-height: 68px;
}

@media (max-width: 767px) {
	:root {
		--pp-gutter: 16px;
		--pp-header-height: 64px;
	}
}

/* ---------------------------------------------------------
   Base
   --------------------------------------------------------- */

body {
	margin: 0;
	background: var(--pp-bg);
	color: var(--pp-ink);
	font-family: var(--pp-font-body);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

img {
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
}

:focus-visible {
	outline: 3px solid var(--pp-purple);
	outline-offset: 2px;
	border-radius: 6px;
}

.pp-container {
	width: 100%;
	max-width: calc(var(--pp-container) + 2 * var(--pp-gutter));
	margin: 0 auto;
	padding: 0 var(--pp-gutter);
}

.pp-icon {
	display: block;
	width: 1em;
	height: 1em;
	flex: none;
}

.pp-skip-link {
	position: absolute;
	left: 16px;
	top: -100px;
	z-index: 1000;
	padding: 10px 16px;
	background: var(--pp-ink);
	color: #fff;
	border-radius: var(--pp-radius-sm);
	text-decoration: none;
}

.pp-skip-link:focus {
	top: 16px;
}

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

/* ---------------------------------------------------------
   Buttons
   --------------------------------------------------------- */

.pp-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 42px;
	padding: 0 22px;
	border: 1px solid transparent;
	border-radius: var(--pp-radius-sm);
	font-family: var(--pp-font-body);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.pp-button--primary {
	background: var(--pp-coral);
	color: #fff;
	box-shadow: 0 6px 16px rgba(232, 131, 107, 0.28);
}

.pp-button--primary:hover,
.pp-button--primary:focus-visible {
	background: var(--pp-coral-strong);
}

.pp-button--ghost {
	background: var(--pp-surface);
	border-color: var(--pp-line);
	color: var(--pp-ink);
	box-shadow: var(--pp-shadow-sm);
}

.pp-button--ghost:hover,
.pp-button--ghost:focus-visible {
	border-color: #e3d6c9;
}

.pp-icon-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	color: var(--pp-ink);
	font-size: 24px;
	text-decoration: none;
	transition: background-color 160ms ease, color 160ms ease;
}

.pp-icon-button:hover,
.pp-icon-button:focus-visible {
	background: var(--pp-coral-soft);
	color: var(--pp-coral-strong);
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */

.pp-site-header {
	position: relative;
	z-index: 50;
	background: var(--pp-bg);
}

.pp-site-header__inner {
	width: 100%;
	max-width: calc(var(--pp-container) + 2 * var(--pp-gutter));
	min-height: var(--pp-header-height);
	margin: 0 auto;
	padding: 0 var(--pp-gutter);

	display: grid;
	grid-template-columns: minmax(140px, 1fr) auto minmax(140px, 1fr);
	align-items: center;
	column-gap: 32px;
}

/* Branding */

.pp-site-branding {
	justify-self: start;
	line-height: 0;
}

.pp-site-branding .custom-logo-link {
	display: block;
}

.pp-site-branding .custom-logo {
	display: block;
	width: 158px;
	max-width: 100%;
	height: auto;
}

.pp-site-title {
	color: var(--pp-ink);
	font-family: var(--pp-font-heading);
	font-size: 1.6rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
}

/* Primary navigation */

.pp-primary-nav {
	justify-self: center;
}

.pp-primary-nav__menu {
	display: flex;
	align-items: center;
	gap: 40px;

	list-style: none;
	margin: 0;
	padding: 0;
}

.pp-primary-nav__menu > li {
	margin: 0;
	padding: 0;
}

.pp-primary-nav__menu a {
	position: relative;
	display: block;
	padding: 12px 0;

	color: var(--pp-ink);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	text-decoration: none;

	transition: color 160ms ease;
}

.pp-primary-nav__menu a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 4px;
	height: 2px;
	border-radius: 2px;
	background: var(--pp-coral);
	transform: scaleX(0);
	transition: transform 160ms ease;
}

.pp-primary-nav__menu a:hover,
.pp-primary-nav__menu a:focus-visible,
.pp-primary-nav__menu .current-menu-item > a {
	color: var(--pp-coral);
}

.pp-primary-nav__menu .current-menu-item > a::after,
.pp-primary-nav__menu a:hover::after {
	transform: scaleX(1);
}

/* Header actions */

.pp-header-actions {
	justify-self: end;

	display: flex;
	align-items: center;
	gap: 12px;
}

/* Mobile menu button */

.pp-mobile-menu-toggle {
	display: none;
}

@media (max-width: 960px) {
	.pp-site-header__inner {
		grid-template-columns: 1fr auto auto;
		column-gap: 4px;
	}

	.pp-site-branding .custom-logo {
		width: 112px;
	}

	.pp-header-actions {
		gap: 4px;
	}

	.pp-header-actions__auth {
		display: none;
	}

	.pp-mobile-menu-toggle {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 42px;
		height: 42px;
		margin-right: -8px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: transparent;
		color: var(--pp-ink);
		font-size: 26px;
		cursor: pointer;
	}

	.pp-mobile-menu-toggle__close,
	.is-menu-open .pp-mobile-menu-toggle__open {
		display: none;
	}

	.is-menu-open .pp-mobile-menu-toggle__close {
		display: block;
	}

	.pp-primary-nav {
		position: absolute;
		top: 100%;
		justify-self: stretch; /* browsers now align abspos boxes too; keep it full width */
		left: var(--pp-gutter);
		right: var(--pp-gutter);
		display: none;
		padding: 8px 20px;
		background: var(--pp-surface);
		border: 1px solid var(--pp-line);
		border-radius: var(--pp-radius-md);
		box-shadow: var(--pp-shadow-lg);
	}

	.is-menu-open .pp-primary-nav {
		display: block;
	}

	.pp-primary-nav__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.pp-primary-nav__menu > li + li {
		border-top: 1px solid var(--pp-line);
	}

	.pp-primary-nav__menu a {
		padding: 14px 0;
		font-size: 16px;
	}

	.pp-primary-nav__menu a::after {
		display: none;
	}
}

/* ---------------------------------------------------------
   Mobile bottom navigation
   --------------------------------------------------------- */

.pp-bottom-nav {
	display: none;
}

@media (max-width: 767px) {
	body {
		padding-bottom: calc(var(--pp-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
	}

	.pp-bottom-nav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 60;
		display: block;
		padding-bottom: env(safe-area-inset-bottom, 0px);
		background: var(--pp-surface);
		border-radius: 22px 22px 0 0;
		box-shadow: 0 -6px 24px rgba(90, 64, 40, 0.08);
	}

	.pp-bottom-nav__list {
		display: grid;
		grid-template-columns: repeat(5, 1fr);
		height: var(--pp-bottom-nav-height);
		margin: 0;
		padding: 0 6px;
		list-style: none;
	}

	.pp-bottom-nav__item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 4px;
		height: 100%;
		color: var(--pp-ink-soft);
		font-size: 11px;
		font-weight: 500;
		text-decoration: none;
	}

	.pp-bottom-nav__item .pp-icon {
		font-size: 22px;
	}

	.pp-bottom-nav__item.is-active {
		color: var(--pp-coral);
		font-weight: 600;
	}

	.pp-bottom-nav__item--ai .pp-icon {
		color: var(--pp-purple);
	}
}

/* ---------------------------------------------------------
   Footer: logo, header links, short description
   --------------------------------------------------------- */

.pp-site-footer {
	margin-top: 64px;
	background: var(--pp-surface-tint);
	border-radius: 40px 40px 0 0;
	color: var(--pp-ink-soft);
	font-size: 15px;
}

.pp-site-footer__inner,
.pp-site-footer__bottom {
	max-width: calc(var(--pp-container) + 2 * var(--pp-gutter));
	margin: 0 auto;
	padding-left: var(--pp-gutter);
	padding-right: var(--pp-gutter);
}

.pp-site-footer__inner {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) minmax(0, 400px);
	align-items: center;
	gap: 48px;
	padding-top: 56px;
	padding-bottom: 48px;
}

.pp-site-footer__brand .custom-logo-link {
	display: block;
}

.pp-site-footer__brand .custom-logo {
	display: block;
	width: 170px;
	max-width: 100%;
	height: auto;
}

.pp-site-footer__menu {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.pp-site-footer__menu > li {
	margin: 0;
}

.pp-site-footer__menu a {
	display: inline-flex;
	align-items: center;
	min-height: 42px;
	padding: 0 18px;
	background: var(--pp-surface);
	border-radius: 999px;
	color: var(--pp-ink);
	font-weight: 600;
	text-decoration: none;
	box-shadow: var(--pp-shadow-sm);
	transition: color 140ms ease, background-color 140ms ease;
}

.pp-site-footer__menu a:hover,
.pp-site-footer__menu a:focus-visible,
.pp-site-footer__menu .current-menu-item > a {
	background: var(--pp-coral-soft);
	color: var(--pp-coral-strong);
}

.pp-site-footer__about {
	margin: 0;
	line-height: 1.7;
}

.pp-site-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 8px 24px;
	padding-top: 20px;
	padding-bottom: 28px;
	/* Divider as wide as the content, not the padded box. */
	background: linear-gradient(var(--pp-line), var(--pp-line)) center top / calc(100% - 2 * var(--pp-gutter)) 1px no-repeat;
	color: var(--pp-muted);
	font-size: 14px;
}

.pp-site-footer__bottom p {
	margin: 0;
}

.pp-site-footer__bottom a {
	color: inherit;
}

.pp-site-footer__links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
}

.pp-site-footer__links a:hover,
.pp-site-footer__links a:focus-visible {
	color: var(--pp-ink);
}

@media (max-width: 1080px) {
	.pp-site-footer__inner {
		grid-template-columns: auto minmax(0, 1fr);
		gap: 28px 40px;
	}

	.pp-site-footer__menu {
		justify-content: flex-end;
	}

	.pp-site-footer__about {
		grid-column: 1 / -1;
		max-width: 60ch;
	}
}

@media (max-width: 767px) {
	.pp-site-footer {
		margin-top: 40px;
		border-radius: 28px 28px 0 0;
	}

	.pp-site-footer__inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 20px;
		padding-top: 36px;
		padding-bottom: 28px;
	}

	.pp-site-footer__brand .custom-logo {
		width: 130px;
	}

	.pp-site-footer__about {
		grid-row: 2;
		font-size: 15px;
	}

	.pp-site-footer__menu {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 8px;
	}

	.pp-site-footer__menu a {
		justify-content: center;
		width: 100%;
		min-height: 46px;
	}

	.pp-site-footer__bottom {
		flex-direction: column;
		padding-bottom: 20px;
	}
}

/* ---------------------------------------------------------
   Account: header button, favourites counter, toast
   --------------------------------------------------------- */

.pp-header-actions__fav,
.pp-bottom-nav__icon {
	position: relative;
}

.pp-fav-count {
	position: absolute;
	top: 2px;
	right: -1px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border: 2px solid var(--pp-bg);
	border-radius: 999px;
	background: var(--pp-coral);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	box-sizing: content-box;
}

.pp-fav-count[hidden] {
	display: none;
}

.pp-bottom-nav__icon {
	display: block;
}

.pp-bottom-nav__icon .pp-fav-count {
	top: -6px;
	right: -12px;
	border-color: var(--pp-surface);
}

.pp-account-chip {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	min-height: 42px;
	padding: 3px 16px 3px 3px;
	border: 1px solid var(--pp-line);
	border-radius: 999px;
	background: var(--pp-surface);
	color: var(--pp-ink);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	box-shadow: var(--pp-shadow-sm);
	transition: border-color 160ms ease;
}

.pp-account-chip:hover,
.pp-account-chip:focus-visible {
	border-color: #e3d6c9;
}

.pp-account-chip .pp-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--pp-coral-soft);
	color: var(--pp-coral-strong);
	font-size: 14px;
	font-weight: 700;
}

@media (max-width: 960px) {
	.pp-account-chip {
		padding: 0;
		border: 0;
		background: none;
		box-shadow: none;
	}

	.pp-account-chip__label {
		display: none;
	}
}

.pp-toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 100;
	display: flex;
	align-items: flex-start;
	gap: 8px;
	width: min(440px, calc(100% - 2 * var(--pp-gutter)));
	padding: 18px 14px 18px 20px;
	border: 1px solid var(--pp-line);
	border-radius: 20px;
	background: var(--pp-surface);
	box-shadow: var(--pp-shadow-lg);
	opacity: 0;
	pointer-events: none;
	transform: translate(-50%, 16px);
	transition: opacity 200ms ease, transform 200ms ease;
}

.pp-toast.is-visible {
	opacity: 1;
	pointer-events: auto;
	transform: translate(-50%, 0);
}

.pp-toast__body {
	flex: 1;
	min-width: 0;
}

.pp-toast__body strong {
	display: block;
	color: var(--pp-ink);
	font-size: 15px;
}

.pp-toast__body strong::before {
	content: "♥";
	margin-right: 8px;
	color: var(--pp-coral);
}

.pp-toast__body p {
	margin: 4px 0 0;
	color: var(--pp-ink-soft);
	font-size: 14px;
	line-height: 1.5;
}

.pp-toast__actions {
	display: flex;
	gap: 8px;
	margin-top: 12px;
}

.pp-toast__actions .pp-button {
	min-height: 38px;
	padding: 0 18px;
	border-radius: 999px;
}

.pp-toast__close {
	flex: none;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--pp-muted);
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}

.pp-toast__close:hover {
	background: var(--pp-surface-tint);
	color: var(--pp-ink);
}

@media (max-width: 767px) {
	.pp-toast {
		bottom: calc(var(--pp-bottom-nav-height) + env(safe-area-inset-bottom, 0px) + 12px);
	}
}

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