/* ============================================================================
   Maktune v5 — site chrome: announcement bar, header, navigation, mobile drawer
   ----------------------------------------------------------------------------
   Replaces three stacked strips (navy utility bar + white header + blue
   category nav) with one header and one slim announcement bar.

   WHY THE OLD ARRANGEMENT HAD TO GO, beyond looking busy: the category nav was
   a single non-wrapping row that simply overflowed off the right edge of a
   phone, so on mobile the site had categories the customer could not reach.
   A drawer is not a nicety here, it is the fix.
   ========================================================================== */

/* --------------------------------------------------------- Announcement */
/* ONE bar, ONE message. Shipping, warranty, returns and COD were previously
   repeated in the utility bar, the hero, three homepage sections and the
   footer; they now appear once each, in the reassurance chapter. */
.v5-announce {
	background: var(--v5-black);
	color: var(--v5-on-dark-soft);
	font-size: 13px;
	letter-spacing: -0.005em;
	text-align: center;
	padding: 9px var(--mk-gutter);
}
.v5-announce b { color: var(--v5-on-dark); font-weight: 600; }

/* -------------------------------------------------------------- Header */
.v5-hdr {
	position: sticky;
	top: 0;
	z-index: 60;
	background: rgba(251, 250, 248, .86);
	backdrop-filter: saturate(1.6) blur(14px);
	border-bottom: 1px solid var(--v5-paper-3);
}
/* Solid, not translucent, once the page has scrolled — product photography
   passing under a blurred bar reads as a smear. */
.v5-hdr.is-stuck { background: var(--v5-paper); }

.v5-hdr-inner {
	display: flex;
	align-items: center;
	gap: 28px;
	height: 68px;
	max-width: var(--mk-container);
	margin-inline: auto;
	padding-inline: var(--mk-gutter);
}

.v5-logo { display: inline-flex; align-items: center; flex: none; }
.v5-logo img { display: block; width: auto; height: 30px; }

/* ---------------------------------------------------------------- Nav */
.v5-nav { display: flex; align-items: center; gap: 4px; margin-right: auto; }
.v5-nav a {
	display: inline-flex;
	align-items: center;
	height: 38px;
	padding: 0 12px;
	border-radius: var(--mk-r-sm);
	font-size: 14.5px;
	font-weight: 550;
	letter-spacing: -0.008em;
	color: var(--v5-ink);
	text-decoration: none;
	white-space: nowrap;
	transition: background var(--mk-dur) var(--v5-ease), color var(--mk-dur) var(--v5-ease);
}
.v5-nav a:hover { background: rgba(20, 23, 31, .06); }
.v5-nav a[aria-current="page"] { color: var(--v5-blue); }

/* ------------------------------------------------------------ Actions */
.v5-hdr-actions { display: flex; align-items: center; gap: 2px; flex: none; }

.v5-icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* 44px, not 42px. WCAG 2.2 AA accepts 24px with spacing, but these sit in a
	   row on a phone with only 2px between them; 44px is the size a thumb
	   actually hits. */
	width: 44px;
	height: 44px;
	border: 0;
	background: transparent;
	border-radius: var(--mk-r-sm);
	color: var(--v5-ink);
	cursor: pointer;
	text-decoration: none;
	transition: background var(--mk-dur) var(--v5-ease);
}
.v5-icon-btn:hover { background: rgba(20, 23, 31, .06); }

.v5-cart-count {
	position: absolute;
	top: 5px;
	right: 4px;
	min-width: 17px;
	height: 17px;
	padding: 0 4px;
	border-radius: var(--mk-r-pill);
	/* --mk-orange-ink, not the brand coral: this is white text ON the fill, and
	   the brand coral is 3.25:1. See tokens.css. */
	background: var(--mk-orange-ink);
	color: #fff;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 17px;
	text-align: center;
}
/* maktune_cart_count_html() adds `is-empty` at zero rather than omitting the
   element, because the badge is an aria-live region the AJAX fragment swaps in
   place — removing the node would silence the announcement. */
.v5-cart-count.is-empty { display: none; }

.v5-burger { display: none; }

/* ------------------------------------------------------- Search panel */
/* Collapsed by default so the header stays quiet, and because a permanent
   search field is the single widest element in a header — it is what forced
   the old layout to drop the navigation on tablet. */
.v5-search {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows var(--mk-dur-slow) var(--v5-ease);
	background: var(--v5-paper);
	border-bottom: 1px solid transparent;
}
.v5-search.is-open { grid-template-rows: 1fr; border-bottom-color: var(--v5-paper-3); }
.v5-search-inner { overflow: hidden; }
.v5-search form {
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: var(--mk-container);
	margin-inline: auto;
	padding: 0 var(--mk-gutter);
	height: 0;
	transition: height var(--mk-dur-slow) var(--v5-ease);
}
.v5-search.is-open form { height: 72px; }
.v5-search input[type="search"] {
	flex: 1;
	min-width: 0;
	height: 46px;
	border: 1px solid var(--v5-paper-3);
	border-radius: var(--mk-r);
	background: #fff;
	padding: 0 16px;
	font: inherit;
	font-size: 16px;   /* 16px minimum, or iOS zooms the page on focus */
	color: var(--v5-ink);
}
.v5-search input[type="search"]:focus-visible { outline: 2px solid var(--v5-blue); outline-offset: 1px; }

/* ============================================================================
   Mobile drawer
   ========================================================================== */

.v5-scrim {
	position: fixed;
	inset: 0;
	z-index: 70;
	background: rgba(11, 12, 15, .5);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--mk-dur) var(--v5-ease), visibility var(--mk-dur);
}
.v5-scrim.is-open { opacity: 1; visibility: visible; }

.v5-drawer {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 71;
	width: min(400px, 88vw);
	background: var(--v5-paper);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform var(--mk-dur-slow) var(--v5-ease-out);
	overscroll-behavior: contain;
}
.v5-drawer.is-open { transform: none; }

/* THE CLOSED DRAWER MUST LEAVE THE ACCESSIBILITY TREE.
   `hidden` is only `display: none` in the UA sheet, and the rule above sets
   `display: flex` on the class — class beats UA, so the attribute did nothing.
   The drawer was merely translated off-screen: still focusable, still read by
   VoiceOver and TalkBack, and the conversion audit (2026-08-21) found it
   sitting in the semantic snapshot of every mobile page.
   Safe against the open animation because v5.js clears `hidden` a frame before
   it adds .is-open, and only sets it again on transitionend. */
.v5-drawer[hidden],
.v5-scrim[hidden] { display: none; }

.v5-drawer-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 68px;
	padding-inline: 18px var(--mk-gutter);
	border-bottom: 1px solid var(--v5-paper-3);
	flex: none;
}
.v5-drawer-body { overflow-y: auto; padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); flex: 1; }

.v5-drawer-nav { display: flex; flex-direction: column; }
.v5-drawer-nav a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	/* 56px, not 44 — this is the primary navigation on the device where it is
	   hardest to hit. */
	min-height: 56px;
	padding: 0 12px;
	border-radius: var(--mk-r-sm);
	font-size: 17px;
	font-weight: 580;
	letter-spacing: -0.012em;
	color: var(--v5-ink);
	text-decoration: none;
}
.v5-drawer-nav a:active { background: rgba(20, 23, 31, .06); }
.v5-drawer-nav svg { color: var(--mk-muted-soft); flex: none; }

.v5-drawer-sub { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--v5-paper-3); }
.v5-drawer-sub a { min-height: 48px; font-size: 15px; font-weight: 500; color: var(--v5-ink-soft); }

/* ============================================================================
   Breakpoints
   ========================================================================== */

/* The nav is six items of real words; below this it stops fitting beside the
   logo and the actions. It does NOT get squeezed or scrolled — it moves into
   the drawer whole. */
@media (max-width: 1080px) {
	.v5-nav { display: none; }
	.v5-burger { display: inline-flex; }
	.v5-hdr-inner { gap: 8px; justify-content: space-between; }
	.v5-logo { margin-right: auto; }
}

@media (max-width: 560px) {
	.v5-hdr-inner { height: 60px; }
	.v5-logo img { height: 26px; }
	.v5-announce { font-size: 12px; padding-block: 8px; }
	/* Account moves into the drawer on the smallest screens so that search and
	   cart — the two the customer reaches for mid-task — stay comfortably
	   spaced rather than three icons crowding a 320px row. */
	.v5-hdr-actions .v5-icon-btn--account { display: none; }
}

@media (min-width: 1081px) {
	.v5-drawer, .v5-scrim { display: none; }
}

/* ============================================================================
   Footer
   ========================================================================== */

.v5-footer { background: var(--v5-black); color: var(--v5-on-dark-soft); }
.v5-footer-grid {
	display: grid;
	grid-template-columns: 1.5fr repeat(4, 1fr);
	gap: clamp(28px, 3.4vw, 56px);
	padding-block: clamp(48px, 6vw, 80px);
}
.v5-footer-brand img { height: 34px; width: auto; display: block; margin-bottom: 18px; }
.v5-footer-brand p { font-size: 14px; line-height: 1.62; margin: 0 0 20px; max-width: 40ch; }

/*
 * Two classes deep on purpose. The footer is site-wide, so on every route that
 * still loads the v3 sheets it competes with `body.home-v3 h2` at (0,1,2) —
 * which won, and painted these headings v3's near-black on the near-black
 * footer. axe caught it as 56 contrast failures across 14 route/viewport
 * combinations. `.v5-footer .v5-footer-col h2` is (0,2,1) and wins outright
 * rather than relying on load order.
 */
.v5-footer .v5-footer-col h2 {
	font-size: 12px;
	font-weight: 650;
	letter-spacing: var(--v5-eyebrow-track);
	text-transform: uppercase;
	color: var(--v5-on-dark);
	margin: 0 0 16px;
}
.v5-footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.v5-footer-col a {
	font-size: 14px;
	color: var(--v5-on-dark-soft);
	text-decoration: none;
	transition: color var(--mk-dur) var(--v5-ease);
}
.v5-footer-col a:hover { color: var(--v5-on-dark); }

.v5-footer-bottom { border-top: 1px solid var(--v5-graphite-3); padding-block: 22px; }
.v5-footer-bottom .v5-wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	flex-wrap: wrap;
}
.v5-footer-bottom p { margin: 0; font-size: 13px; }
.v5-footer-contact a { color: var(--v5-on-dark-soft); text-decoration: none; }
.v5-footer-contact a:hover { color: var(--v5-on-dark); }
.v5-pay { display: flex; gap: 8px; flex-wrap: wrap; }
.v5-pay span {
	font-size: 11.5px;
	font-weight: 600;
	letter-spacing: .02em;
	padding: 5px 10px;
	border: 1px solid var(--v5-graphite-3);
	border-radius: var(--mk-r-xs);
	color: var(--v5-on-dark);
}

/* Social icons come from maktune_social_links(); they are styled by the v3
   sheet, which no longer loads on the front page. Restated here so the footer
   is self-contained on every route. */
.v5-footer .v3-social,
.v5-footer .mk-social { display: flex; gap: 10px; flex-wrap: wrap; }
.v5-footer .v3-social a,
.v5-footer .mk-social a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--v5-graphite-3);
	border-radius: var(--mk-r-sm);
	color: var(--v5-on-dark-soft);
	transition: border-color var(--mk-dur) var(--v5-ease), color var(--mk-dur) var(--v5-ease);
}
.v5-footer .v3-social a:hover,
.v5-footer .mk-social a:hover { border-color: var(--v5-on-dark); color: var(--v5-on-dark); }
.v5-footer .v3-social svg,
.v5-footer .mk-social svg { width: 17px; height: 17px; fill: currentColor; }

@media (max-width: 1080px) {
	.v5-footer-grid { grid-template-columns: repeat(2, 1fr); }
	.v5-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
	.v5-footer-grid { grid-template-columns: 1fr; gap: 32px; }
	.v5-footer-bottom .v5-wrap { flex-direction: column; align-items: flex-start; }
}

/* ============================================================================
   Chrome atmosphere
   ----------------------------------------------------------------------------
   Part of the v5 colour pass, but it lives HERE rather than in
   v5-atmosphere.css because the header, drawer and footer appear on every
   route — including the pages still running v3 templates. Gating these to v5
   pages would make the chrome change colour as a customer moves between pages,
   which reads as a bug rather than as a journey.

   The chrome is deliberately the calmest surface on the site: it is present in
   all eleven chapter atmospheres, so anything with a strong colour of its own
   would fight most of them. The only brand colour is a hairline under a nav
   item, and it only exists on hover or on the current page.
   ========================================================================== */

.v5-hdr { background: rgba(248, 245, 239, .88); border-bottom-color: #E7E2D8; }
.v5-hdr.is-stuck { background: #F8F5EF; }
.v5-announce { background: #0D0F13; }
.v5-search { background: #F8F5EF; }
.v5-search input[type="search"] { border-color: #E2DCD1; }
.v5-drawer { background: #F8F5EF; }
.v5-drawer-top, .v5-drawer-sub { border-color: #E7E2D8; }

.v5-nav a { position: relative; }
.v5-nav a::after {
	content: "";
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 4px;
	height: 1.5px;
	border-radius: 2px;
	background: var(--mk-blue);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform var(--mk-dur) var(--v5-ease);
}
/* The grey wash is replaced by the underline — two hover affordances on one
   element is one too many. */
.v5-nav a:hover { background: transparent; }
.v5-nav a:hover::after,
.v5-nav a[aria-current="page"]::after { transform: scaleX(1); }

/* Deep graphite, not the near-black it was: the page should come to rest, not
   fall off a cliff. */
.v5-footer { background: linear-gradient(180deg, #1A1D23 0%, #14171C 100%); }
.v5-footer-bottom { border-top-color: #2B313B; }
.v5-pay span { border-color: #2B313B; }

@media (prefers-reduced-motion: reduce) {
	.v5-nav a::after { transition: none; }
}
