/*
 * MGK FreshMart v2 — shell: reset, layout primitives, chrome.
 *
 * Every declaration below is COPIED from the P1 prototype
 * (freshmart-p1-srs_6.html), not approximated. Only two things are translated:
 * token names (`--g` → `--mgk-green`, see mgk-tokens.css for the full map) and
 * selector names, since the theme uses v1's `.mgk-<block>__<element>`
 * convention rather than the prototype's terse single-file classes.
 *
 * SELECTOR MAP — prototype → theme, so a rule can be checked against the source:
 *
 *   .top            → .mgk-topbar            .nav        → .mgk-nav
 *   .top-in         → .mgk-topbar__in        .nav-in     → .mgk-nav__in
 *   .top .r         → .mgk-topbar__meta      .browse     → .mgk-nav__browse
 *   .hd             → .mgk-hd                .nav-m      → .mgk-nav__items
 *   .hd-in          → .mgk-hd__in            .nav-m a    → .mgk-nav__item
 *   .hd-r           → .mgk-hd__actions       .dealcta    → .mgk-nav__deals
 *   .logo           → .mgk-hd__logo          footer      → .mgk-ft
 *   .logo-m         → .mgk-hd__logo-mark     .fg         → .mgk-ft__grid
 *   .logo .nm       → .mgk-hd__logo-name     footer h5   → .mgk-ft__h
 *   .logo .sb       → .mgk-hd__logo-sub      .fbar       → .mgk-ft__bar
 *   .srch           → .mgk-hd__search        .pay        → .mgk-ft__pay
 *   .srch-in        → .mgk-hd__search-in     .sm         → .mgk-sm
 *   .srch .go       → .mgk-hd__search-go     .mut        → .mgk-mut
 *   .sug            → .mgk-hd__suggest       .num        → .mgk-num
 *   .hb             → .mgk-hd__btn           .pg         → .mgk-pg
 *   .hb .ic         → .mgk-hd__btn-icon
 *   .hb .lb         → .mgk-hd__btn-label
 *   .av             → .mgk-hd__avatar
 *   .dot            → .mgk-hd__dot
 *
 * Components live one file per screen (mgk-<screen>.css); this file stays the
 * shell so parallel screen work never collides in it.
 */

/* ── reset ─────────────────────────────────────────────────────────────── */

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

body {
	margin: 0;
	background: var(--mgk-wash);
	color: var(--mgk-ink);
	font-family: var(--mgk-font);
	/* 14.5px, not 14: the prototype sets 14 then overrides it further down. */
	font-size: 14.5px;
	line-height: 1.6;
	letter-spacing: -.005em;
	/* single-storey l, better currency glyphs */
	font-feature-settings: 'cv05' 1, 'ss03' 1;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

/* Headings are INTER, not the display serif — Fraunces is reserved for h1/h2
   and a few hero elements. Getting this wrong makes every card title wrong. */
h1, h2, h3, h4, h5 {
	margin: 0;
	font-family: var(--mgk-font);
	font-weight: 800;
	letter-spacing: -.025em;
}

h1, h2 {
	font-family: var(--mgk-font-display);
	font-weight: 600;
	letter-spacing: -.012em;
	line-height: 1.12;
	font-variation-settings: 'opsz' 60;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--mgk-green); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .001ms !important;
		transition-duration: .001ms !important;
	}
}

/* WordPress markup expects this class to exist. */
.screen-reader-text {
	position: absolute; width: 1px; height: 1px;
	padding: 0; margin: -1px; overflow: hidden;
	clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── layout primitives ─────────────────────────────────────────────────── */

.mgk-wrap { max-width: var(--mgk-wrap); margin: 0 auto; padding: 0 var(--mgk-gutter); }

main { min-height: 60vh; }
.mgk-pg { padding: 24px 0 40px; }

.mgk-sm  { font-size: 12.5px; }
.mgk-mut { color: var(--mgk-ink-3); }
.mgk-num { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* ── chrome: top bar ───────────────────────────────────────────────────── */

.mgk-topbar { background: var(--mgk-ink); color: #B9C5CB; font-size: 12.5px; }
.mgk-topbar__in { display: flex; align-items: center; gap: 18px; height: 36px; }
.mgk-topbar a:hover { color: #fff; }
.mgk-topbar b { color: #fff; font-weight: 600; }

.mgk-topbar__links { display: flex; align-items: center; gap: 18px; }
.mgk-topbar__meta { margin-left: auto; display: flex; gap: 18px; }

/* ── chrome: masthead ──────────────────────────────────────────────────── */

.mgk-hd { padding: 14px 0; border-bottom: 1px solid var(--mgk-line-2); }
.mgk-hd__in { display: flex; align-items: center; gap: 22px; }

.mgk-hd__logo { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }

.mgk-hd__logo-mark {
	width: 38px; height: 38px;
	border-radius: var(--mgk-radius);
	background: var(--mgk-green);
	display: grid;
	place-items: center;
	color: #fff;
	font-family: var(--mgk-font);
	font-weight: 800;
	font-size: 14px;
}

.mgk-hd__logo-name {
	font-family: var(--mgk-font);
	font-size: 21px;
	font-weight: 800;
	letter-spacing: -.03em;
	display: block;
	line-height: 1.1;
	color: var(--mgk-ink);
}

.mgk-hd__logo-sub { display: block; font-size: 11px; color: var(--mgk-ink-3); }

/* search */

.mgk-hd__search { flex: 1; max-width: 560px; position: relative; }

.mgk-hd__search-in {
	display: flex;
	height: 42px;
	border: 1.5px solid var(--mgk-line-d);
	border-radius: var(--mgk-radius-b);
	overflow: hidden;
	background: #fff;
	transition: border-color var(--mgk-t1);
}

.mgk-hd__search-in:focus-within { border-color: var(--mgk-green); }

.mgk-hd__search-in input {
	flex: 1;
	border: 0;
	padding: 0 12px;
	outline: none;
	min-width: 0;
	height: 100%;
}

.mgk-hd__search-go {
	width: 44px;
	display: grid;
	place-items: center;
	background: var(--mgk-green);
	color: #fff;
}

.mgk-hd__suggest {
	position: absolute;
	top: calc(100% + 6px);
	left: 0; right: 0;
	background: #fff;
	border: 1px solid var(--mgk-line);
	border-radius: var(--mgk-radius);
	box-shadow: var(--mgk-elev-2);
	z-index: 70;
	padding: 6px;
}

/* actions */

.mgk-hd__actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.mgk-hd__btn {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 7px 9px;
	border-radius: var(--mgk-radius-b);
	position: relative;
	transition: background var(--mgk-t1);
}

.mgk-hd__btn:hover { background: var(--mgk-wash); }

.mgk-hd__btn-icon { position: relative; color: var(--mgk-ink-2); }

.mgk-hd__btn-label {
	font-size: 11.5px;
	color: var(--mgk-ink-3);
	line-height: 1.25;
	text-align: left;
}

.mgk-hd__btn-label b {
	display: block;
	font-size: 12.5px;
	color: var(--mgk-ink);
	font-weight: 600;
}

.mgk-hd__avatar {
	width: 30px; height: 30px;
	border-radius: 50%;
	background: var(--mgk-green-tint);
	color: var(--mgk-green);
	display: grid;
	place-items: center;
	font-family: var(--mgk-font);
	font-weight: 800;
	font-size: 12px;
}

/* Hidden by default and scaled in, exactly as the prototype does it — the
   count is rendered server-side here, so the partial adds --on when there is
   something to show. Keeping the transform means the pop animation still has
   somewhere to live when the basket becomes live-updating. */
.mgk-hd__dot {
	position: absolute;
	top: -6px; right: -8px;
	min-width: 17px; height: 17px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--mgk-red);
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	display: grid;
	place-items: center;
	transform: scale(0);
	transition: transform var(--mgk-t1) var(--mgk-ease);
}

.mgk-hd__dot--on { transform: scale(1); }

/* ── chrome: category nav ──────────────────────────────────────────────── */

.mgk-nav {
	border-bottom: 1px solid var(--mgk-line);
	position: sticky;
	top: 0;
	z-index: 50;
	background: #fff;
	transition: box-shadow var(--mgk-t2);
}

.mgk-nav__in { display: flex; align-items: center; gap: 22px; height: 52px; }

.mgk-nav__browse {
	display: flex;
	align-items: center;
	gap: 9px;
	flex: 0 0 auto;
	height: 36px;
	padding: 0 15px;
	background: var(--mgk-green);
	color: #fff;
	border-radius: var(--mgk-radius-b);
	font-family: var(--mgk-font);
	font-weight: 700;
	font-size: 13px;
	white-space: nowrap;
}

.mgk-nav__browse:hover { background: var(--mgk-green-hover); color: #fff; }

.mgk-nav__items { display: flex; align-items: center; gap: 20px; }

.mgk-nav__item { font-size: 13.5px; font-weight: 500; color: var(--mgk-ink-2); white-space: nowrap; }
.mgk-nav__item:hover, .mgk-nav__item--on { color: var(--mgk-green); }

.mgk-nav__deals {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 9px;
	flex: 0 0 auto;
	height: 36px;
	padding: 0 8px 0 12px;
	background: var(--mgk-red-tint);
	border: 1px solid #F5CFCA;
	border-radius: var(--mgk-radius-b);
	white-space: nowrap;
}

.mgk-nav__deals:hover { background: #FBE2DE; }
.mgk-nav__deals-label { font-size: 12px; color: #8E2418; font-weight: 600; }
.mgk-nav__countdown { display: flex; align-items: center; gap: 3px; }
.mgk-nav__countdown i { display: grid; place-items: center; min-width: 25px; height: 22px; border-radius: var(--mgk-radius-s); background: var(--mgk-red); color: #fff; font-family: var(--mgk-font); font-size: 12px; font-style: normal; font-weight: 800; }
.mgk-nav__countdown s { color: var(--mgk-red); font-weight: 800; text-decoration: none; }
.mgk-nav__deals-go { font-size: 12px; font-weight: 700; color: var(--mgk-red); padding: 0 6px; }

/* ── chrome: footer ────────────────────────────────────────────────────── */

.mgk-ft {
	margin-top: 46px;
	border-top: 1px solid var(--mgk-line);
	padding: 38px 0 22px;
	background: var(--mgk-wash);
}

.mgk-ft__grid { display: grid; grid-template-columns: 1.6fr repeat(4, 1fr); gap: 26px; }

.mgk-ft__h { font-family: var(--mgk-font); font-size: 14px; margin-bottom: 12px; }

.mgk-ft a { display: block; font-size: 13px; color: var(--mgk-ink-2); padding: 4px 0; }
.mgk-ft a:hover { color: var(--mgk-green); }

/* The brand column's identity block is a run of lines, not links. */
.mgk-ft__ident { line-height: 1.9; }
.mgk-ft__ident b { color: var(--mgk-ink-2); font-weight: 600; }
.mgk-ft__logo { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }

.mgk-ft__bar {
	margin-top: 28px;
	padding-top: 17px;
	border-top: 1px solid var(--mgk-line);
	display: flex;
	justify-content: space-between;
	gap: 14px;
	flex-wrap: wrap;
	font-size: 12.5px;
	color: var(--mgk-ink-3);
	align-items: center;
}

.mgk-ft__pay { display: flex; gap: 6px; }

.mgk-ft__pay span {
	height: 24px;
	padding: 0 9px;
	border: 1px solid var(--mgk-line);
	border-radius: var(--mgk-radius-s);
	background: #fff;
	font-size: 10px;
	font-weight: 700;
	color: var(--mgk-ink-2);
	display: grid;
	place-items: center;
}

/* ── responsive — the prototype's own breakpoints ──────────────────────── */

@media (max-width: 1180px) {
	.mgk-nav__items { display: none; }
}

@media (max-width: 900px) {
	.mgk-hd__in { flex-wrap: wrap; gap: 12px; }
	.mgk-hd__actions { margin-left: auto; }
	.mgk-hd__btn-label { display: none; }
	.mgk-hd__search { order: 3; flex: 1 0 100%; max-width: none; }
	.mgk-ft__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
	.mgk-topbar__in { gap: 12px; overflow-x: auto; }
	.mgk-topbar__meta { display: none; }
	.mgk-nav__in { height: auto; padding: 9px 0; flex-wrap: wrap; gap: 9px; }
	.mgk-nav__browse { flex: 1 0 100%; justify-content: center; }
	.mgk-nav__deals { margin-left: 0; flex: 1 0 100%; justify-content: center; }
	.mgk-ft__grid { grid-template-columns: 1fr; }
}

/* ── shared primitives ─────────────────────────────────────────────────────
 *
 * Buttons, the card surface and the two page grids. These live in the shell
 * rather than in a per-screen file because every screen needs them: a screen
 * defining its own .mgk-<screen>__btn is a fourth copy of the same 12 rules,
 * and they drift.
 */

.mgk-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 44px;
	padding: 0 22px;
	border-radius: var(--mgk-radius-b);
	font-family: var(--mgk-font);
	font-weight: 700;
	font-size: 14px;
	letter-spacing: -.01em;
	transition: background var(--mgk-t1), color var(--mgk-t1), border-color var(--mgk-t1), opacity var(--mgk-t1);
}

.mgk-btn--green { background: var(--mgk-green); color: #fff; box-shadow: var(--mgk-highlight); }
.mgk-btn--green:hover { background: var(--mgk-green-hover); color: #fff; }

.mgk-btn--outline { border: 1.5px solid var(--mgk-line-d); color: var(--mgk-ink); }
.mgk-btn--outline:hover { border-color: var(--mgk-green); color: var(--mgk-green); }

.mgk-btn[disabled], .mgk-btn--dis { opacity: .45; pointer-events: none; }

/* Compact step, for buttons that sit inside a card rather than ending a form. */
.mgk-btn--sm { height: 34px; padding: 0 14px; font-size: 12.5px; }

.mgk-card {
	border: 1px solid var(--mgk-line);
	border-color: var(--mgk-line) var(--mgk-line) var(--mgk-line-d);
	border-radius: var(--mgk-radius);
	padding: 18px;
	background: var(--mgk-paper);
	box-shadow: var(--mgk-highlight);
}

/* Content + sticky rail (cart, checkout, PDP) and account shell. */
.mgk-two  { display: grid; grid-template-columns: 1fr 372px; gap: 24px; align-items: start; }
.mgk-acct { display: grid; grid-template-columns: 236px 1fr; gap: 24px; align-items: start; }

@media (max-width: 1180px) {
	/* Inline grid-template overrides on individual screens must collapse too. */
	.mgk-two, .mgk-acct { grid-template-columns: 1fr !important; }
	.mgk-two > *, .mgk-acct > * { min-width: 0; }
}

/* Sign-in wall — small enough to live in the shell rather than ship a file. */
.mgk-signin { max-width: 420px; margin: 40px auto; text-align: center; padding: 34px 24px; }
.mgk-signin__h { font-size: 21px; }
.mgk-signin__body { margin: 8px 0 18px; }
.mgk-signin__cta { width: 100%; }

/* ── merchant reply to a review (reviews page + PDP reviews tab) ────────────────────────────────────────────────────────
 * Indented and tinted so it reads as an answer to the review above it rather
 * than as a second review. The left rule carries the relationship; the icon and
 * "Reply from <store>" carry who is speaking. Optional by construction: no
 * reply, no block — nothing here renders a placeholder. */

.mgk-reviews__reply {
	margin: 12px 0 0 18px;
	padding: 11px 14px;
	border-left: 2px solid var(--mgk-green);
	border-radius: 0 var(--mgk-radius-b) var(--mgk-radius-b) 0;
	background: var(--mgk-green-tint-2);
}

.mgk-reviews__reply-head { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.mgk-reviews__reply-head svg { color: var(--mgk-green); flex: 0 0 auto; }
.mgk-reviews__reply-head b { font-size: 12.5px; color: var(--mgk-green-deep); }
.mgk-reviews__reply p { margin: 5px 0 0; font-size: 13px; line-height: 1.65; color: var(--mgk-ink-2); }

@media (max-width: 520px) { .mgk-reviews__reply { margin-left: 10px; padding: 10px 12px; } }
