/* ==========================================================================
   Katma 2027 — components.css
   Header, navigation, footer, buttons. Phase 1 scope only.
   ========================================================================== */

/* ==========================================================================
   Buttons
   Touch targets stay large — parish staff are often older users. Brief §26.
   ========================================================================== */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2xs);
	min-height: 52px;
	padding: 0 var(--space-md);
	border: 1px solid transparent;
	border-radius: var(--radius-sm);
	font-family: var(--font-ui);
	font-size: var(--text-base);
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color var(--duration) var(--ease),
		border-color var(--duration) var(--ease),
		color var(--duration) var(--ease);
}

.btn--primary {
	background-color: var(--katma-red);
	border-color: var(--katma-red);
	color: var(--katma-white);
}

.btn--primary:hover {
	background-color: var(--katma-red-dark);
	border-color: var(--katma-red-dark);
	color: var(--katma-white);
}

.btn--secondary {
	background-color: var(--katma-white);
	border-color: var(--color-border);
	color: var(--color-heading);
}

.btn--secondary:hover {
	border-color: var(--katma-black);
	color: var(--color-heading);
}

.btn--ghost {
	background-color: transparent;
	border-color: transparent;
	color: var(--color-heading);
	padding-inline: 0;
}

.btn--ghost:hover {
	color: var(--color-accent);
}

.btn__icon {
	width: 18px;
	height: 18px;
	flex: none;
}

/* Text link with a red arrow — the recurring editorial CTA. Brief §4. */
.link-arrow {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2xs);
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--color-accent);
	text-decoration: none;
}

.link-arrow svg {
	width: 16px;
	height: 16px;
	transition: transform var(--duration) var(--ease);
}

.link-arrow:hover {
	color: var(--color-accent-hover);
}

.link-arrow:hover svg {
	transform: translateX(3px);
}

/* ==========================================================================
   Logo
   Inline SVG built from the logo geometry — no raster file, no icon font.
   ========================================================================== */

.site-logo {
	display: inline-flex;
	align-items: center;
	gap: 0.6em;
	text-decoration: none;
	color: var(--katma-black);
}

.site-logo__mark {
	width: auto;
	height: 34px;
	flex: none;
}

.site-logo__word {
	font-family: var(--font-ui);
	font-size: 1.6rem;
	font-weight: 500;
	letter-spacing: -0.01em;
	line-height: 1;
	color: currentColor;
}

@media (max-width: 900px) {
	.site-logo__mark {
		height: 28px;
	}

	.site-logo__word {
		font-size: 1.35rem;
	}
}

/* ==========================================================================
   Site header
   ========================================================================== */

.site-header {
	position: relative;
	z-index: 100;
	background-color: var(--katma-white);
	border-bottom: var(--border-hairline);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	min-height: var(--header-height);
}

.site-header__brand {
	flex: none;
	margin-right: auto;
}

.site-header__actions {
	display: flex;
	align-items: center;
	gap: var(--space-3xs);
	flex: none;
}

/* --- Icon buttons (search, cart, menu) ------------------------------------ */

.icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: var(--radius-sm);
	color: var(--color-heading);
	text-decoration: none;
	transition: color var(--duration) var(--ease),
		background-color var(--duration) var(--ease);
}

.icon-btn:hover {
	color: var(--color-accent);
	background-color: var(--color-bg-warm);
}

.icon-btn svg {
	width: 22px;
	height: 22px;
}

/* Cart count bubble. Populated by WooCommerce in phase 4. */
.icon-btn__count {
	position: absolute;
	top: 2px;
	right: 2px;
	display: grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	padding-inline: 4px;
	background-color: var(--katma-red);
	color: var(--katma-white);
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Primary navigation
   ========================================================================== */

.nav-primary__list {
	display: flex;
	align-items: center;
	gap: var(--space-md);
}

.nav-primary__link {
	position: relative;
	display: block;
	padding-block: var(--space-2xs);
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--color-heading);
	text-decoration: none;
	white-space: nowrap;
}

.nav-primary__link:hover {
	color: var(--color-accent);
}

/* Thin red underline for the current page. Brief §8. */
.nav-primary__link::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 2px;
	background-color: var(--katma-red);
	transform: scaleX(0);
	transition: transform var(--duration) var(--ease);
}

.nav-primary .current-menu-item > .nav-primary__link,
.nav-primary .current_page_item > .nav-primary__link,
.nav-primary .current-menu-ancestor > .nav-primary__link {
	color: var(--color-accent);
}

.nav-primary .current-menu-item > .nav-primary__link::after,
.nav-primary .current_page_item > .nav-primary__link::after,
.nav-primary .current-menu-ancestor > .nav-primary__link::after {
	transform: scaleX(1);
}

/* --- Mobile ---------------------------------------------------------------
   Off-canvas panel, no library. Toggled by assets/js/navigation.js.
   -------------------------------------------------------------------------- */

.nav-toggle {
	display: none;
}

@media (max-width: 1024px) {
	.nav-toggle {
		display: inline-flex;
	}

	.nav-primary {
		position: fixed;
		inset: var(--header-height) 0 0 0;
		z-index: 90;
		background-color: var(--katma-white);
		border-top: var(--border-hairline);
		padding: var(--space-md) var(--gutter) var(--space-2xl);
		overflow-y: auto;
		transform: translateY(-8px);
		opacity: 0;
		visibility: hidden;
		transition: opacity var(--duration) var(--ease),
			transform var(--duration) var(--ease),
			visibility var(--duration) var(--ease);
	}

	.nav-primary[data-open="true"] {
		transform: translateY(0);
		opacity: 1;
		visibility: visible;
	}

	.nav-primary__list {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.nav-primary__link {
		padding-block: var(--space-sm);
		font-size: var(--text-md);
		border-bottom: var(--border-hairline);
	}

	.nav-primary__link::after {
		display: none;
	}

	/* Lock the page behind the open panel. */
	body[data-nav-open="true"] {
		overflow: hidden;
	}
}

/* ==========================================================================
   Site footer
   ========================================================================== */

.site-footer {
	background-color: var(--color-bg-alt);
	border-top: var(--border-hairline);
}

.site-footer__main {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr);
	gap: var(--space-xl) var(--space-lg);
	padding-block: var(--space-2xl);
}

@media (max-width: 900px) {
	.site-footer__main {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.site-footer__brand {
		grid-column: 1 / -1;
	}
}

@media (max-width: 560px) {
	.site-footer__main {
		grid-template-columns: minmax(0, 1fr);
	}
}

.site-footer__tagline {
	margin-top: var(--space-sm);
	max-width: 30ch;
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.site-footer__heading {
	font-family: var(--font-ui);
	font-size: var(--text-sm);
	font-weight: 700;
	color: var(--color-heading);
	margin-bottom: var(--space-sm);
}

/* Contact / payment rows: icon + text, aligned on the first line. */
.info-list {
	display: grid;
	gap: var(--space-2xs);
	font-size: var(--text-sm);
}

.info-list__item {
	display: grid;
	grid-template-columns: 20px 1fr;
	gap: var(--space-2xs);
	align-items: start;
	color: var(--color-text);
}

.info-list__item svg {
	width: 16px;
	height: 16px;
	margin-top: 0.25em;
	color: var(--katma-red);
}

.info-list a {
	color: inherit;
	text-decoration: none;
}

.info-list a:hover {
	color: var(--color-accent);
	text-decoration: underline;
}

/* --- Footer bottom bar ---------------------------------------------------- */

.site-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-sm) var(--space-md);
	padding-block: var(--space-md);
	border-top: var(--border-hairline);
	font-size: var(--text-xs);
	color: var(--color-muted);
}

.site-footer__legal-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-md);
}

.site-footer__legal a {
	color: var(--color-muted);
	text-decoration: none;
}

.site-footer__legal a:hover {
	color: var(--color-accent);
}

/* ==========================================================================
   Geometric accents
   The logo's diamond, cropped and oversized. Used sparingly. Brief §4.
   ========================================================================== */

.accent-shape {
	position: absolute;
	pointer-events: none;
	color: var(--katma-red);
	z-index: 0;
}

.accent-shape svg {
	width: 100%;
	height: auto;
}

/* ==========================================================================
   Search form
   ========================================================================== */

.search-form {
	display: flex;
	gap: var(--space-2xs);
	max-width: 34rem;
}

.search-form__input {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 52px;
	padding: 0 var(--space-sm);
	background-color: var(--katma-white);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: var(--text-base);
}

.search-form__input::placeholder {
	color: var(--color-muted);
}

.search-form__input:focus-visible {
	border-color: var(--katma-red);
}

/* ==========================================================================
   Entry / card
   ========================================================================== */

.entry + .entry {
	padding-top: var(--space-lg);
	border-top: var(--border-hairline);
}

.entry__title {
	font-size: var(--text-lg);
}

.entry__title a {
	text-decoration: none;
}

.entry__meta {
	margin-top: var(--space-3xs);
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.card {
	display: flex;
	flex-direction: column;
	background-color: var(--color-bg-warm);
	border-radius: var(--radius-sm);
	overflow: hidden;
	transition: background-color var(--duration) var(--ease);
}

.card:hover {
	background-color: var(--katma-white);
	box-shadow: 0 0 0 1px var(--color-border);
}

.card__media img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
	padding: var(--space-md);
}

.card__title {
	font-size: var(--text-md);
}

.card__title a {
	text-decoration: none;
}

/* Whole card is clickable via the title link, without nesting interactives. */
.card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.card {
	position: relative;
}

.card__text {
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.card .link-arrow {
	margin-top: auto;
	padding-top: var(--space-2xs);
}

/* ==========================================================================
   Pagination
   ========================================================================== */

.pagination {
	padding-block: var(--space-lg);
	border-top: var(--border-hairline);
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2xs);
	align-items: center;
}

.pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 44px;
	height: 44px;
	padding-inline: var(--space-2xs);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-weight: 600;
	text-decoration: none;
}

.pagination .page-numbers:hover {
	border-color: var(--katma-black);
}

.pagination .page-numbers.current {
	background-color: var(--katma-red);
	border-color: var(--katma-red);
	color: var(--katma-white);
}

/* ==========================================================================
   Value cards (mission / vision)
   ========================================================================== */

.value-card {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
	padding: var(--space-lg);
	background-color: var(--katma-white);
	border: var(--border-hairline);
	border-radius: var(--radius-sm);
}

.value-card__icon {
	color: var(--katma-red);
	margin-bottom: var(--space-2xs);
}

.value-card__icon svg {
	width: 32px;
	height: 32px;
}

.value-card__title {
	font-size: var(--text-lg);
}

.value-card__text {
	color: var(--color-muted);
	line-height: var(--leading-relaxed);
}

/* ==========================================================================
   Closing call to action
   ========================================================================== */

.cta-band {
	border-top: var(--border-hairline);
}

.cta-band__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-lg);
	padding-block: var(--space-2xl);
}

.cta-band__title {
	font-size: var(--text-xl);
}

.cta-band__text {
	margin-top: var(--space-2xs);
	max-width: 46ch;
	color: var(--color-muted);
}

@media (max-width: 560px) {
	.cta-band__inner .btn {
		width: 100%;
	}

	.cta-band__inner .cluster {
		width: 100%;
	}
}

/* ==========================================================================
   Price tables ("Cjenik")
   Modern and quiet: no ruled grid, a rounded hairline frame around each
   table, and a warm zebra tint every second row instead of borders between
   cells. Reuses the site's own line and background tokens, not grey.
   ========================================================================== */

.price-lists > * + * {
	margin-top: var(--space-xl);
}

.price-table__head {
	margin-bottom: var(--space-sm);
}

.price-table__title {
	font-size: var(--text-lg);
}

.price-table__desc {
	margin-top: var(--space-3xs);
	max-width: 62ch;
	font-size: var(--text-sm);
	color: var(--color-muted);
}

/* Horizontal scroll is a safety net on very narrow screens — three lean
   columns fit down to phone width, this just guarantees nothing clips. */
.price-table__scroll {
	overflow-x: auto;
	border: var(--border-hairline);
	border-radius: var(--radius-sm);
}

/* No min-width: the name column wraps naturally (see the long "Presveto
   Srce…" row) and pack/price stay compact via white-space: nowrap below, so
   all three columns already fit down to phone width without scrolling. A
   forced min-width would just clip the price column off-screen with no
   visible cue that the table scrolls — exactly the hidden gesture brief §26
   asks this site to avoid, given how often the reader is older parish staff.
   .price-table__scroll stays as a harmless safety net for extreme cases. */
.price-table__table {
	width: 100%;
	border-collapse: collapse;
}

.price-table__table th {
	padding: var(--space-xs) var(--space-sm);
	background-color: var(--color-bg-warm);
	font-family: var(--font-ui);
	font-size: var(--text-xs);
	font-weight: 700;
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--color-muted);
	text-align: left;
}

/* Only the two narrow numeric columns need to stay on one line — "Proizvod"
   is the column with room to spare, so an unnecessary nowrap on it was
   setting a wider floor than the table actually needs on a small phone. */
.price-table__table th:not(:first-child) {
	text-align: right;
	white-space: nowrap;
}

.price-table__table td {
	padding: var(--space-xs) var(--space-sm);
	border-top: var(--border-hairline);
	font-size: var(--text-sm);
	vertical-align: middle;
}

.price-table__table tbody tr:first-child td {
	border-top: 0;
}

/* Zebra: a faint warm tint on every second row instead of ruled columns. */
.price-table__table tbody tr:nth-child(even) td {
	background-color: var(--color-bg-warm);
}

/* Plain text, not a link: the price list is a reference sheet, and the client
   asked that nothing on it lead off to a product page. */
.price-table__name {
	font-weight: 600;
	color: var(--color-heading);
}

.price-table__pack {
	text-align: right;
	color: var(--color-muted);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* Three columns of cell padding (--space-sm horizontally) add up to more than
   a phone screen has to spare once the name column needs room to wrap. Trim
   it back on narrow viewports rather than shrinking text further. */
@media (max-width: 480px) {
	.price-table__table th,
	.price-table__table td {
		padding-inline: var(--space-2xs);
	}
}

.price-table__price {
	text-align: right;
	font-weight: 700;
	color: var(--katma-red);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* ==========================================================================
   Product card
   One card for every listing on the site — homepage strip, shop archive,
   category archives, related products — rendered from
   template-parts/product/card.php. Lives here rather than in home.css or
   shop.css because it is no longer specific to either.
   ========================================================================== */

.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background-color: var(--katma-white);
	border: var(--border-hairline);
	border-radius: var(--radius-sm);
	overflow: hidden;
	transition: border-color var(--duration) var(--ease);
}

.product-card:hover {
	border-color: var(--katma-stone);
}

.product-card__media {
	padding: var(--space-sm) var(--space-sm) 0;
}

/* Square box, contained: the catalog mixes portrait covers with landscape
   single-sheet calendars, and this shows both whole rather than favouring one. */
.product-card__media img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
}

.product-card__body {
	display: flex;
	flex-direction: column;
	gap: var(--space-2xs);
	flex: 1;
	padding: var(--space-sm);
}

.product-card__title {
	font-family: var(--font-ui);
	font-size: var(--text-sm);
	font-weight: 600;
	line-height: var(--leading-snug);
	letter-spacing: 0;
	color: var(--color-heading);
}

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

/* Stretches the title link across the whole card. The quantity form sits
   above it on z-index so its input and button stay independently usable. */
.product-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

/* --- Category label -------------------------------------------------------
   Quiet uppercase kicker under the name, so a product read out of context —
   on the homepage strip or the full shop archive — still says what it is.
   -------------------------------------------------------------------------- */

.product-card__cat {
	display: flex;
	align-items: center;
	gap: var(--space-3xs);
	font-size: 0.6875rem;
	font-weight: 600;
	letter-spacing: var(--tracking-wide);
	text-transform: uppercase;
	color: var(--color-muted);
	line-height: var(--leading-snug);
}

.product-card__cat svg {
	width: 14px;
	height: 14px;
	flex: none;
	color: var(--katma-red);
}

/* --- Price and package ---------------------------------------------------- */

.product-card__foot {
	margin-top: auto;
	padding-top: var(--space-2xs);
}

.product-card__price {
	font-size: var(--text-base);
	font-weight: 700;
	color: var(--katma-red);
	font-variant-numeric: tabular-nums;
}

.product-card__unit {
	font-size: var(--text-xs);
	font-weight: 500;
	color: var(--color-muted);
}

.product-card__pack {
	margin-top: 2px;
	font-size: var(--text-xs);
	color: var(--color-muted);
}

/* ==========================================================================
   Quantity + add control
   Sits on every card and is reusable on its own (brief §27, "Brza narudžba").
   ========================================================================== */

.qty-add {
	position: relative;
	z-index: 1;
	display: flex;
	gap: var(--space-3xs);
	margin-top: var(--space-2xs);
}

/* Pre-filled with one package and stepping in packages, so the common case is
   already correct and the uncommon one is a single edit (brief §11). */
.qty-add__input {
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
	min-height: 44px;
	padding-inline: var(--space-2xs);
	background-color: var(--katma-white);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	font-size: var(--text-sm);
	font-weight: 600;
	text-align: center;
	color: var(--color-heading);
	font-variant-numeric: tabular-nums;
}

.qty-add__input:focus-visible {
	border-color: var(--katma-red);
}

.qty-add__submit {
	display: grid;
	place-items: center;
	flex: none;
	width: 44px;
	height: 44px;
	padding: 0;
	background-color: var(--katma-red);
	border: 1px solid var(--katma-red);
	border-radius: var(--radius-sm);
	color: var(--katma-white);
	transition: background-color var(--duration) var(--ease),
		border-color var(--duration) var(--ease);
}

.qty-add__submit:hover {
	background-color: var(--katma-red-dark);
	border-color: var(--katma-red-dark);
}

.qty-add__submit svg {
	width: 20px;
	height: 20px;
}

/* ==========================================================================
   Category cards
   Global, not homepage-only: the same cards run under every category archive
   as the "Možda vas zanima" row (template-parts/content/category-grid.php).
   They lived in home.css until then, which is enqueued on the front page
   alone — so on an archive they rendered with no styling at all.
   ========================================================================== */

.cat-card {
	position: relative;
	display: flex;
	flex-direction: column;
}

.cat-card__media {
	overflow: hidden;
	background-color: var(--color-bg-warm);
	border-radius: var(--radius-sm);
}

.cat-card__media img {
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	/* The artwork is devotional: crop from the top so figures keep their heads.
	   Cards whose art sits off-centre override this with --focus. */
	object-position: var(--focus, center top);
	transition: transform 400ms var(--ease);
}

.cat-card:hover .cat-card__media img {
	transform: scale(1.03);
}

.cat-card__body {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: end;
	gap: var(--space-2xs) var(--space-sm);
	padding-top: var(--space-sm);
}

.cat-card__title {
	grid-column: 1;
	font-size: var(--text-lg);
}

.cat-card__title a {
	text-decoration: none;
}

/* One click target covering the card, without nesting interactive elements. */
.cat-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.cat-card__desc {
	grid-column: 1;
	font-size: var(--text-sm);
	color: var(--color-muted);
}

.cat-card__arrow {
	grid-column: 2;
	grid-row: 1 / -1;
	align-self: end;
	color: var(--katma-red);
	transition: transform var(--duration) var(--ease);
}

.cat-card__arrow svg {
	width: 22px;
	height: 22px;
}

.cat-card:hover .cat-card__arrow {
	transform: translateX(4px);
}

/* The two homepage choices — Naruči and Pogledaj cjenik — carry the whole
   entry to the site, so they sit a size above the ordinary button. */
.btn--lg {
	min-height: 60px;
	padding-inline: var(--space-lg);
	font-size: var(--text-md);
}

/* Cards that only state what is on offer, with no link behind them: the hover
   lift and the zoom would promise a click that never comes. */
.cat-card--static .cat-card__media img {
	transition: none;
}

.cat-card--static:hover .cat-card__media img {
	transform: none;
}
