:root {
	color-scheme: light;
	--bg: #efe3cf;
	--surface: #fbf5ea;
	--fg: #2a1a10;
	--muted: #6e5643;
	--accent: #a8761f;
	--gold: #c9993f;
	--wood: #3b2416;
	--wood-deep: #22140b;
	--border: #d9c6a8;
	--danger: #a3321d;
	--radius: 6px;
	--space: 1rem;
	--font: "IBM Plex Sans Arabic", Tahoma, "Segoe UI", sans-serif;
	--display: "Reem Kufi", "IBM Plex Sans Arabic", Tahoma, sans-serif;
}

* {
	box-sizing: border-box;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--fg);
	font-family: var(--font);
	line-height: 1.55;
	-webkit-font-smoothing: antialiased;
}

.shell {
	max-width: 42rem;
	margin: 0 auto;
	padding: calc(var(--space) * 3) var(--space);
}

h1 {
	margin: 0 0 0.5rem;
	font-size: clamp(1.6rem, 4vw, 2.25rem);
	letter-spacing: -0.02em;
}

.lede {
	margin: 0 0 0.75rem;
	font-size: 1.05rem;
}

.hint {
	margin: 0;
	color: var(--muted);
}

.btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.55rem 0.9rem;
	border: 1px solid transparent;
	border-radius: var(--radius);
	background: var(--accent);
	color: #fff;
	font: inherit;
	font-weight: 500;
	cursor: pointer;
}

.btn:hover {
	filter: brightness(1.05);
}

.btn-secondary {
	background: transparent;
	color: var(--fg);
	border-color: var(--border);
}

.card {
	padding: var(--space);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
}

.input,
.select,
.textarea {
	width: 100%;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg);
	color: var(--fg);
	font: inherit;
}

.field {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.35rem;
	margin-bottom: var(--space);
}

.field > label {
	font-size: 0.875rem;
	color: var(--muted);
}

/*
 * 390px-safe, like .grid below. A grid with no column list gets one implicit
 * auto column, and an auto column is never narrower than its widest item's
 * min-content width. One nowrap scrolling strip (days, time slots) anywhere
 * inside an item therefore widened the whole column past the screen: the page
 * scrolled sideways instead of the strip scrolling on its own. minmax(0, 1fr)
 * caps the column at the container; the min-width rule keeps a child from
 * bringing the same floor back if an app redefines the columns. :where() adds
 * no specificity, so a min-width the app sets on a child still wins.
 */
.stack {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--space);
}

:where(.field, .stack, .list) > * {
	min-width: 0;
}

.row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

/*
 * 390px-safe. An unclamped minmax track overflows a 390px viewport once the
 * shell padding is subtracted, and nothing in the pipeline ever looked at a
 * phone-width layout, so every generated app inherited the horizontal scroll.
 * min() clamps the track to the container instead.
 */
.grid {
	display: grid;
	gap: var(--space);
	grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr));
}

.list {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.list-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.table {
	width: 100%;
	border-collapse: collapse;
}

.table th,
.table td {
	padding: 0.6rem 0.5rem;
	text-align: left;
	border-bottom: 1px solid var(--border);
}

.table th {
	font-size: 0.8125rem;
	color: var(--muted);
	font-weight: 600;
}

.empty {
	padding: calc(var(--space) * 2);
	text-align: center;
	color: var(--muted);
}

.empty-title {
	margin: 0 0 0.25rem;
	color: var(--fg);
	font-weight: 600;
}

/* Loading. Every fetch has one; without a primitive each app invented its own. */
.loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.6rem;
	padding: calc(var(--space) * 1.5);
	color: var(--muted);
}

.spinner {
	flex: none;
	width: 1.15rem;
	height: 1.15rem;
	border: 2px solid var(--border);
	border-top-color: var(--accent);
	border-radius: 50%;
	animation: fab-spin 0.7s linear infinite;
}

@keyframes fab-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Placeholder for content whose shape is known before its data arrives. */
.skeleton {
	display: block;
	height: 1rem;
	border-radius: calc(var(--radius) / 2);
	background: linear-gradient(90deg, var(--border), transparent, var(--border));
	background-size: 200% 100%;
	animation: fab-shimmer 1.2s linear infinite;
}

@keyframes fab-shimmer {
	to {
		background-position: -200% 0;
	}
}

/* Error strip: a failure the user can see and retry, never a silent no-op. */
.alert {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	flex-wrap: wrap;
	padding: 0.7rem 0.85rem;
	border: 1px solid var(--border);
	border-left: 3px solid var(--muted);
	border-radius: var(--radius);
}

.alert-error {
	border-left-color: var(--danger);
	color: var(--danger);
}

.badge {
	display: inline-block;
	padding: 0.1rem 0.5rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: 0.8125rem;
	color: var(--muted);
}

/*
 * The scaffold had exactly one @media rule (prefers-color-scheme) and no width
 * breakpoint at all, so the shell was a 42rem column at every size.
 * Mobile-first stays the default; these only widen it.
 */
@media (min-width: 48rem) {
	.shell {
		max-width: 52rem;
		padding: calc(var(--space) * 3) calc(var(--space) * 1.5);
	}
}

@media (min-width: 64rem) {
	.shell {
		max-width: 64rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.spinner,
	.skeleton {
		animation: none;
	}
}

:where(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* ---- Mabkhra Haill ---- */
body { font-size: 1.0625rem; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.3; letter-spacing: 0; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0 0 0.75rem; }
h3 { margin: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { max-width: 78rem; margin: 0 auto; padding: 0 1.25rem; }
.table th, .table td { text-align: right; }
.alert { border-left-width: 1px; border-right: 3px solid var(--danger); background: var(--surface); }
.select, .input, .textarea { background: #fff; min-height: 46px; border-color: var(--border); }
.field > label { color: var(--fg); font-weight: 500; }
.muted, .hint { color: var(--muted); }
.between { justify-content: space-between; }

.btn { min-height: 46px; padding: 0.6rem 1.3rem; justify-content: center; text-decoration: none; font-weight: 600; border-radius: var(--radius); }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-gold { background: var(--gold); color: var(--wood-deep); }
.btn-gold:hover { background: #d8aa4f; filter: none; }
.btn-wood { background: var(--wood); color: #f6e9d2; }
.btn-ghost { background: transparent; color: #f6e9d2; border-color: rgba(246, 233, 210, 0.45); }
.btn-ghost-dark { background: transparent; color: var(--fg); border-color: var(--border); }
.btn-block { width: 100%; }

.topbar { position: sticky; top: 0; z-index: 10; background: var(--wood-deep); color: #f6e9d2; border-bottom: 1px solid rgba(201, 153, 63, 0.3); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--display); font-size: 1.25rem; }
.brand img { width: 40px; height: 40px; border-radius: 50%; background: #fbf5ea; object-fit: contain; padding: 2px; }
.nav { display: flex; align-items: center; gap: 1.25rem; }
.nav a:not(.btn) { text-decoration: none; opacity: 0.85; }
.nav a:not(.btn):hover { opacity: 1; color: var(--gold); }

.hero { background: radial-gradient(ellipse at 20% 40%, #4a2d18 0%, var(--wood-deep) 70%); color: #f6e9d2; overflow: hidden; }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2rem; padding-top: 2.5rem; padding-bottom: 3rem; align-items: center; }
.since { color: var(--gold); font-weight: 600; margin: 0 0 0.75rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4rem); margin: 0 0 1rem; color: #fff6e6; }
.hero .lede { color: #e6d3b4; max-width: 36rem; margin-bottom: 1.75rem; }
.hero-art { position: relative; }
.hero-art img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; background: var(--wood); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45); border: 1px solid rgba(201, 153, 63, 0.4); }

.band { padding: 4rem 0; }
.band-sand { background: var(--bg); }
.band-wood { background: var(--wood); color: #f6e9d2; }
.band-stone { background: var(--surface); }
.sec-head { margin-bottom: 2rem; }
.sec-head p { color: var(--muted); margin: 0; }

.products { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(15rem, 100%), 1fr)); }
.product { background: var(--surface); border: 1px solid var(--border); display: flex; flex-direction: column; }
.product-img { position: relative; background: #fff; }
.product-img img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.sale { position: absolute; top: 0.75rem; right: 0.75rem; background: var(--danger); color: #fff; font-size: 0.8rem; padding: 0.15rem 0.6rem; border-radius: 3px; }
.product-body { padding: 1rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.product-body h3 { font-size: 1.15rem; flex: 1; }
.price { margin: 0; display: flex; gap: 0.6rem; align-items: baseline; font-variant-numeric: tabular-nums; }
.price strong { font-size: 1.25rem; color: var(--wood); }
.price s { color: var(--muted); font-size: 0.95rem; }

.craft { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.craft .lede { color: #e6d3b4; }
.craft h2 { color: #fff6e6; }
.craft-list { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; gap: 1.5rem; }
.craft-list li { border-right: 2px solid var(--gold); padding-right: 1rem; }
.craft-list h3 { color: var(--gold); font-size: 1.3rem; margin-bottom: 0.25rem; }
.craft-list p { margin: 0; color: #e6d3b4; }
.craft-fig { margin: 0; background: var(--wood-deep); }
.craft-fig img { width: 100%; aspect-ratio: 2 / 3; max-height: 40rem; object-fit: cover; }

.order { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; }
.steps { padding: 0; margin: 1.5rem 0 0; list-style: none; display: grid; gap: 1rem; }
.steps li { padding: 1rem; background: var(--bg); border-radius: var(--radius); }
.steps strong { display: block; font-family: var(--display); color: var(--wood); }
.order-card { background: #fff; border: 1px solid var(--border); border-top: 4px solid var(--gold); padding: 1.5rem; border-radius: var(--radius); }
.two { display: grid; gap: 0 1rem; grid-template-columns: minmax(0, 1fr); }
.done { display: grid; gap: 1rem; justify-items: start; }
.done h3 { font-size: 1.6rem; color: var(--wood); }
.done p { margin: 0; }

.footer { background: var(--wood-deep); color: #e6d3b4; padding: 3rem 0; }
.footer-in { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr)); }
.footer h3 { color: var(--gold); font-size: 1.1rem; margin-bottom: 0.5rem; }
.footer p { margin: 0.3rem 0; }
.footer-logo { width: 110px; background: #fbf5ea; padding: 8px; border-radius: 4px; margin-bottom: 1rem; }

.owner { min-height: 100vh; background: var(--bg); padding: 1.5rem 0 4rem; }
.owner-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.owner-head .brand img { background: #fff; }
.pass { max-width: 26rem; margin: 3rem auto; }
.pass h1 { font-size: 1.8rem; }
.orders { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr)); }
.order-item { background: var(--surface); border: 1px solid var(--border); padding: 1.25rem; border-radius: var(--radius); }
.order-item h3 { font-size: 1.15rem; }
.order-item .muted { margin: 0.25rem 0 0.75rem; font-size: 0.9rem; }
.order-item dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.35rem 1rem; margin: 0; }
.order-item dt { color: var(--muted); }
.order-item dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 40rem) {
	.nav a:not(.btn) { display: none; }
	.brand span { font-size: 1.05rem; }
}

@media (min-width: 48rem) {
	.two { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 60rem) {
	.hero-in { grid-template-columns: 1.15fr 1fr; gap: 4rem; padding-top: 4.5rem; padding-bottom: 5rem; }
	.craft { grid-template-columns: 1fr 1fr; gap: 4rem; }
	.order { grid-template-columns: 1fr 1.25fr; gap: 4rem; }
	.band { padding: 6rem 0; }
}
