:root {
	--ink:    #16181d;
	--muted:  #5a6070;
	--rule:   #e4e6eb;
	--paper:  #ffffff;
	--wash:   #f5f6f8;
	--save:   #0e7a4e;
	--save-d: #0a5c3a;
	--stamp:  #c6362c;

	--sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

	--gap: 24px;
	--radius: 10px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink);
	font-family: var(--sans);
	font-size: 16px;
	line-height: 1.55;
}

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

a { color: var(--save-d); }

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

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

.skip {
	position: absolute;
	left: -9999px;
}
.skip:focus {
	left: 12px; top: 12px;
	z-index: 10;
	background: var(--ink);
	color: #fff;
	padding: 10px 14px;
	border-radius: 6px;
}

.wrap {
	width: min(100% - 32px, 980px);
	margin-inline: auto;
}

/* ---------- Masthead ---------- */

.masthead {
	border-bottom: 1px solid var(--rule);
	background: var(--paper);
}

.masthead__inner {
	display: flex;
	align-items: center;
	gap: 20px;
	flex-wrap: wrap;
	padding: 16px 0;
}

.brand {
	font-size: 1.1rem;
	font-weight: 700;
	letter-spacing: -0.015em;
	text-decoration: none;
	color: var(--ink);
}

.find {
	display: flex;
	flex: 1 1 260px;
	min-width: 0;
}

.find input {
	flex: 1;
	min-width: 0;
	font: inherit;
	padding: 9px 12px;
	border: 1px solid var(--rule);
	border-right: 0;
	border-radius: var(--radius) 0 0 var(--radius);
	background: var(--wash);
}

.find input:focus { background: var(--paper); }

.find button {
	font: inherit;
	font-weight: 600;
	padding: 9px 16px;
	border: 0;
	border-radius: 0 var(--radius) var(--radius) 0;
	background: var(--ink);
	color: #fff;
	cursor: pointer;
}

.nav {
	display: flex;
	gap: 16px;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: .92rem;
}

.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--ink); }

/* ---------- Hero ---------- */

.hero {
	background: var(--wash);
	border-bottom: 1px solid var(--rule);
	padding: 56px 0;
}

.hero h1 {
	margin: 0 0 8px;
	font-size: clamp(1.7rem, 4.5vw, 2.4rem);
	line-height: 1.15;
	letter-spacing: -0.025em;
	max-width: 16ch;
}

.hero p {
	margin: 0 0 24px;
	color: var(--muted);
	max-width: 52ch;
}

.find--big { max-width: 520px; }
.find--big input { padding: 14px 16px; font-size: 1rem; background: var(--paper); }
.find--big button { padding: 14px 22px; }

/* ---------- Blocks ---------- */

.block { margin: 48px 0; }

.block__title {
	margin: 0 0 4px;
	font-size: 1.15rem;
	letter-spacing: -0.01em;
}

.block__note {
	margin: 0 0 16px;
	color: var(--muted);
	font-size: .92rem;
}

.block__title + .coupon-list,
.block__title + .store-grid,
.block__title + .store-list { margin-top: 16px; }

.page-title {
	margin: 40px 0 24px;
	font-size: 1.6rem;
	letter-spacing: -0.02em;
}

.empty {
	background: var(--wash);
	border-radius: var(--radius);
	padding: 24px;
	color: var(--muted);
}

.more {
	display: inline-block;
	margin-top: 16px;
	font-weight: 600;
	font-size: .92rem;
}

/* ---------- Store cards ---------- */

.store-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.store-card a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	height: 100%;
	padding: 20px 12px;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	text-decoration: none;
	color: var(--ink);
}

.store-card a:hover { border-color: var(--ink); }

.store-card__name { font-weight: 600; font-size: .95rem; text-align: center; }
.store-card__count { color: var(--muted); font-size: .82rem; }

.logo {
	width: 48px;
	height: 48px;
	object-fit: contain;
}

.logo--letter {
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: var(--wash);
	font-weight: 700;
	font-size: 1.2rem;
	color: var(--muted);
}

.logo--lg { width: 64px; height: 64px; font-size: 1.6rem; }

.store-list {
	list-style: none;
	margin: 0;
	padding: 0;
	columns: 3 200px;
	column-gap: 32px;
}

.store-list li {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 7px 0;
	border-bottom: 1px solid var(--rule);
	break-inside: avoid;
}

.store-list a { text-decoration: none; color: var(--ink); }
.store-list a:hover { text-decoration: underline; }
.store-list span { color: var(--muted); font-size: .85rem; }

.alpha {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 32px;
}

.alpha a {
	min-width: 34px;
	padding: 6px 0;
	text-align: center;
	border: 1px solid var(--rule);
	border-radius: 6px;
	text-decoration: none;
	color: var(--ink);
	font-size: .9rem;
}

.alpha a:hover { border-color: var(--ink); }

/* ---------- Store page ---------- */

.store__head {
	display: flex;
	align-items: center;
	gap: 18px;
	margin: 40px 0 28px;
}

.store__name {
	margin: 0 0 2px;
	font-size: clamp(1.4rem, 3.5vw, 1.8rem);
	letter-spacing: -0.02em;
}

.store__stat { margin: 0; color: var(--muted); font-size: .9rem; }

.store__about { margin: 48px 0; }

.prose { max-width: 68ch; }
.prose h2 { font-size: 1.15rem; letter-spacing: -0.01em; }
.prose p { color: #2c3140; }

/* ---------- Coupon rows ---------- */

.coupon-list { display: grid; gap: 12px; }

.coupon {
	display: grid;
	grid-template-columns: 92px 1fr auto;
	align-items: center;
	gap: 18px;
	padding: 18px;
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	background: var(--paper);
}

.coupon__value {
	display: grid;
	justify-items: center;
	gap: 2px;
	padding-right: 18px;
	border-right: 2px dashed var(--rule);
	text-align: center;
}

.coupon__value strong {
	font-size: 1.1rem;
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--save);
}

.coupon__value span {
	font-size: .72rem;
	color: var(--muted);
}

.coupon__body { min-width: 0; }

.coupon__title {
	margin: 0 0 6px;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
}

.coupon__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 10px;
	margin: 0;
	font-size: .8rem;
	color: var(--muted);
}

.flag { white-space: nowrap; }

.flag--top {
	color: var(--stamp);
	font-weight: 600;
}

.coupon__terms { margin-top: 8px; font-size: .85rem; }
.coupon__terms summary { cursor: pointer; color: var(--muted); }
.coupon__terms p { margin: 6px 0 0; color: var(--muted); }

.coupon__action {
	display: grid;
	justify-items: stretch;
	gap: 6px;
}

.coupon__store {
	font-size: .8rem;
	color: var(--muted);
	text-align: center;
	text-decoration: none;
}

.coupon__store:hover { color: var(--ink); }

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

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 148px;
	padding: 12px 18px;
	border: 0;
	border-radius: 8px;
	font: inherit;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.btn--deal {
	background: var(--ink);
	color: #fff;
}

.btn--deal:hover { background: #000; }

.btn--code {
	position: relative;
	padding-right: 56px;
	background: var(--save);
	color: #fff;
	overflow: hidden;
}

.btn--code:hover { background: var(--save-d); }

.btn__hint {
	position: absolute;
	inset: 3px 3px 3px auto;
	display: grid;
	place-items: center;
	width: 50px;
	border-left: 2px dashed rgba(255, 255, 255, .5);
	background: rgba(255, 255, 255, .16);
	font-family: var(--mono);
	font-size: .8rem;
	letter-spacing: .04em;
}

.btn--dead {
	background: var(--wash);
	color: var(--muted);
	cursor: default;
}

/* Revealed state, set by app.js */

.code-out {
	display: flex;
	align-items: stretch;
	min-width: 148px;
	border: 2px dashed var(--save);
	border-radius: 8px;
	overflow: hidden;
}

.code-out__value {
	flex: 1;
	padding: 10px 12px;
	font-family: var(--mono);
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: .05em;
	color: var(--save-d);
	text-align: center;
	word-break: break-all;
}

.code-out__copy {
	border: 0;
	border-left: 2px dashed var(--save);
	padding: 0 12px;
	background: rgba(14, 122, 78, .08);
	color: var(--save-d);
	font: inherit;
	font-size: .82rem;
	font-weight: 600;
	cursor: pointer;
}

.code-out__copy:hover { background: rgba(14, 122, 78, .16); }

/* Expired rows */

.coupon--dead { background: var(--wash); border-style: dashed; }
.coupon--dead .coupon__value strong { color: var(--muted); }
.coupon--dead .coupon__title { color: var(--muted); font-weight: 500; }

/* ---------- Footer ---------- */

.colophon {
	margin-top: 64px;
	padding: 32px 0;
	border-top: 1px solid var(--rule);
	background: var(--wash);
	font-size: .88rem;
	color: var(--muted);
}

.colophon p { margin: 0 0 6px; max-width: 64ch; }

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
	.coupon {
		grid-template-columns: 76px 1fr;
		gap: 14px;
	}
	.coupon__action {
		grid-column: 1 / -1;
	}
	.btn, .code-out { width: 100%; }
	.masthead__inner { gap: 12px; }
	.brand { flex: 1 1 100%; }
	.store-list { columns: 1; }
}

@media (prefers-reduced-motion: reduce) {
	* { transition: none !important; animation: none !important; }
}
