/* ==========================================================================
   AI Canvas Studio — front end
   Palette: gallery plaster, ink, brass hardware, slate sage.
   ========================================================================== */

.acs {
	--acs-wall: #edebe6;
	--acs-paper: #fbfaf8;
	--acs-ink: #17161b;
	--acs-ink-soft: #5b5a63;
	--acs-brass: #a8863c;
	--acs-brass-deep: #7d6329;
	--acs-slate: #5a6b66;
	--acs-line: #d9d5cc;
	--acs-shadow: 0 1px 2px rgba(23, 22, 27, .06), 0 8px 24px rgba(23, 22, 27, .07);
	--acs-radius: 10px;

	font-family: "Tajawal", system-ui, -apple-system, "Segoe UI", sans-serif;
	color: var(--acs-ink);
	background: var(--acs-wall);
	padding: clamp(20px, 4vw, 44px);
	border-radius: 16px;
	max-width: 1100px;
	margin-inline: auto;
	position: relative;
	line-height: 1.65;
}

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

/* The `hidden` attribute must beat every author `display` rule below.
   Without this, .acs__loader { display: grid } keeps the overlay on screen
   even while the element is marked hidden. */
.acs [hidden] { display: none !important; }

/* ---------- header ---------- */

.acs__head { text-align: center; margin-bottom: 28px; }

.acs__eyebrow {
	font-size: 12px;
	letter-spacing: .18em;
	color: var(--acs-brass-deep);
	margin: 0 0 8px;
	text-transform: uppercase;
}

.acs__title {
	font-family: "Reem Kufi", "Tajawal", sans-serif;
	font-size: clamp(26px, 4vw, 40px);
	font-weight: 600;
	margin: 0 0 6px;
	line-height: 1.25;
}

.acs__sub { margin: 0; color: var(--acs-ink-soft); font-size: 15px; }

/* ---------- step rail ---------- */

.acs__rail {
	display: flex;
	gap: 4px;
	list-style: none;
	margin: 0 0 26px;
	padding: 0;
	counter-reset: acsstep;
}

.acs__railitem {
	flex: 1;
	counter-increment: acsstep;
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	color: var(--acs-ink-soft);
	padding-block-end: 10px;
	border-block-end: 2px solid var(--acs-line);
	transition: color .2s, border-color .2s;
}

.acs__railitem::before {
	content: counter(acsstep);
	inline-size: 22px;
	block-size: 22px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: var(--acs-line);
	color: var(--acs-ink);
	font-size: 12px;
	font-weight: 700;
	flex: none;
}

.acs__railitem.is-active { color: var(--acs-ink); border-block-end-color: var(--acs-brass); }
.acs__railitem.is-active::before { background: var(--acs-brass); color: #fff; }
.acs__railitem.is-done::before { background: var(--acs-slate); color: #fff; }

/* ---------- steps ---------- */

.acs__step { display: none; animation: acs-fade .28s ease both; }
.acs__step.is-active { display: block; }

@keyframes acs-fade {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

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

/* ---------- alert ---------- */

.acs__alert {
	background: #fdf3f2;
	border: 1px solid #e6bcb6;
	color: #8a2f22;
	padding: 12px 14px;
	border-radius: var(--acs-radius);
	margin-bottom: 18px;
	font-size: 14px;
}

/* ---------- upload ---------- */

.acs__drop {
	display: grid;
	place-items: center;
	gap: 8px;
	text-align: center;
	padding: clamp(34px, 7vw, 66px) 20px;
	background: var(--acs-paper);
	border: 1.5px dashed var(--acs-line);
	border-radius: 14px;
	cursor: pointer;
	transition: border-color .2s, background .2s;
}

.acs__drop:hover,
.acs__drop:focus-visible,
.acs__drop.is-over { border-color: var(--acs-brass); background: #fff; }

.acs__drop:focus-visible { outline: 2px solid var(--acs-brass); outline-offset: 3px; }

.acs__dropmark {
	inline-size: 46px;
	block-size: 34px;
	border: 2px solid var(--acs-ink);
	border-radius: 3px;
	position: relative;
}

.acs__dropmark::before {
	content: "";
	position: absolute;
	inset-inline-start: 5px;
	inset-block-end: 5px;
	inline-size: 16px;
	block-size: 16px;
	border-radius: 50%;
	background: var(--acs-brass);
}

.acs__dropmark::after {
	content: "";
	position: absolute;
	inset-inline-end: 4px;
	inset-block-end: 4px;
	inline-size: 22px;
	block-size: 12px;
	background: var(--acs-slate);
	clip-path: polygon(0 100%, 45% 0, 100% 100%);
}

.acs__droptitle { font-weight: 700; font-size: 17px; }
.acs__dropnote { font-size: 13px; color: var(--acs-ink-soft); }

.acs__uploaded {
	display: flex;
	gap: 16px;
	align-items: center;
	background: var(--acs-paper);
	padding: 14px;
	border-radius: var(--acs-radius);
	border: 1px solid var(--acs-line);
}

.acs__uploaded img {
	inline-size: 110px;
	block-size: 110px;
	object-fit: cover;
	border-radius: 6px;
	flex: none;
}

.acs__uploadmeta { display: grid; gap: 4px; font-size: 14px; }
.acs__uploadmeta [data-acs-quality] { color: var(--acs-ink-soft); font-size: 13px; }
.acs__uploadmeta.is-low [data-acs-quality] { color: #a4602a; }

/* ---------- orientation ---------- */

.acs__orient { display: flex; gap: 10px; margin-bottom: 20px; }

.acs__orientbtn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: var(--acs-paper);
	border: 1px solid var(--acs-line);
	border-radius: 999px;
	padding: 8px 18px;
	font: inherit;
	font-size: 14px;
	cursor: pointer;
	transition: border-color .2s, background .2s;
}

.acs__orientbtn.is-on { border-color: var(--acs-ink); background: #fff; font-weight: 700; }

.acs__orienticon { background: var(--acs-slate); border-radius: 2px; display: block; }
.acs__orienticon--land { inline-size: 20px; block-size: 14px; }
.acs__orienticon--port { inline-size: 14px; block-size: 20px; }

/* ---------- sizes + wall preview ---------- */

.acs__sizewrap {
	display: grid;
	grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.1fr);
	gap: 24px;
	align-items: start;
}

@media (max-width: 860px) {
	.acs__sizewrap { grid-template-columns: 1fr; }
}

.acs__sizes { display: grid; gap: 10px; }

.acs__size {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 14px;
	align-items: center;
	text-align: start;
	background: var(--acs-paper);
	border: 1px solid var(--acs-line);
	border-radius: var(--acs-radius);
	padding: 12px 14px;
	font: inherit;
	cursor: pointer;
	transition: border-color .18s, box-shadow .18s, background .18s;
}

.acs__size:hover { border-color: var(--acs-slate); }

.acs__size.is-on {
	border-color: var(--acs-ink);
	background: #fff;
	box-shadow: var(--acs-shadow);
}

.acs__sizechip {
	inline-size: 46px;
	block-size: 34px;
	border: 1.5px solid var(--acs-ink);
	border-radius: 2px;
	background: linear-gradient(135deg, #fff, #e7e3da);
	flex: none;
}

.acs__sizename { font-weight: 700; font-size: 16px; display: block; }
.acs__sizenote { font-size: 12.5px; color: var(--acs-ink-soft); display: block; }
.acs__sizeprice { font-weight: 700; color: var(--acs-brass-deep); white-space: nowrap; }

/* the signature element: a true-to-scale wall */

.acs__wall {
	margin: 0;
	background: linear-gradient(180deg, #f3f1ec, #e6e2d9);
	border-radius: var(--acs-radius);
	padding: 16px;
	border: 1px solid var(--acs-line);
}

.acs__wall figcaption {
	font-size: 12px;
	color: var(--acs-ink-soft);
	margin-block-end: 12px;
}

.acs__wallstage {
	position: relative;
	block-size: 260px;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	align-items: center;
}

.acs__wallcanvas {
	position: absolute;
	inset-block-start: 8px;
	inset-inline-start: 50%;
	transform: translateX(50%);
	background: #fff;
	border: 1px solid rgba(23, 22, 27, .18);
	box-shadow: 4px 6px 14px rgba(23, 22, 27, .18);
	display: grid;
	place-items: center;
	font-size: 11px;
	color: var(--acs-ink-soft);
	transition: inline-size .3s ease, block-size .3s ease;
}

.acs__sofa { position: relative; inline-size: 100%; }

.acs__sofaback {
	block-size: 26px;
	background: var(--acs-slate);
	opacity: .55;
	border-radius: 8px 8px 0 0;
	margin-inline: 8%;
}

.acs__sofaseat {
	block-size: 14px;
	background: var(--acs-slate);
	opacity: .38;
	border-radius: 0 0 6px 6px;
	margin-inline: 5%;
}

/* ---------- styles grid ---------- */

.acs__filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.acs__filter {
	background: transparent;
	border: 1px solid var(--acs-line);
	border-radius: 999px;
	padding: 6px 14px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
	color: var(--acs-ink-soft);
}

.acs__filter.is-on { background: var(--acs-ink); border-color: var(--acs-ink); color: #fff; }

.acs__styles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
	gap: 12px;
}

/* each card is hung like a small canvas */
.acs__style {
	position: relative;
	text-align: start;
	background: var(--acs-paper);
	border: 1px solid var(--acs-line);
	border-radius: 8px;
	padding: 0;
	overflow: hidden;
	font: inherit;
	cursor: pointer;
	transition: transform .18s, box-shadow .18s, border-color .18s;
	box-shadow: 2px 3px 0 rgba(23, 22, 27, .05);
}

.acs__stylethumb {
	display: block;
	aspect-ratio: 4 / 3;
	background: linear-gradient(135deg, #e9e6df, #d8d3c8);
	overflow: hidden;
}

.acs__stylethumb img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
	transition: transform .35s ease;
}

.acs__style:hover .acs__stylethumb img { transform: scale(1.04); }

@media (prefers-reduced-motion: reduce) {
	.acs__stylethumb img { transition: none; }
	.acs__style:hover .acs__stylethumb img { transform: none; }
}

.acs__stylebody { display: block; padding: 12px 13px 13px; }

.acs__style:hover { transform: translateY(-2px); box-shadow: 3px 6px 14px rgba(23, 22, 27, .12); }

.acs__style.is-on {
	border-color: var(--acs-ink);
	background: #fff;
	box-shadow: 0 0 0 2px var(--acs-brass);
}

/* a brass tick in the corner, so the choice reads at a glance on a grid of images */
.acs__style.is-on::after {
	content: "";
	position: absolute;
	inset-block-start: 8px;
	inset-inline-end: 8px;
	inline-size: 22px;
	block-size: 22px;
	border-radius: 50%;
	background: var(--acs-brass) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center / 13px no-repeat;
	box-shadow: 0 1px 4px rgba(23, 22, 27, .35);
}

.acs__stylename { display: block; font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.acs__styleen { display: block; font-size: 11px; letter-spacing: .04em; color: var(--acs-brass-deep); direction: ltr; text-align: start; }
.acs__styledesc { display: block; font-size: 12.5px; color: var(--acs-ink-soft); margin-top: 6px; }

.acs__wish { display: block; margin-top: 20px; font-size: 13px; color: var(--acs-ink-soft); }
.acs__wish textarea {
	inline-size: 100%;
	margin-top: 6px;
	border: 1px solid var(--acs-line);
	border-radius: 8px;
	padding: 10px;
	font: inherit;
	font-size: 14px;
	background: var(--acs-paper);
	resize: vertical;
}

/* ---------- result ---------- */

.acs__result {
	display: grid;
	grid-template-columns: 1.5fr 1fr;
	gap: 26px;
	align-items: start;
}

@media (max-width: 780px) {
	.acs__result { grid-template-columns: 1fr; }
}

.acs__frame {
	background: #fff;
	padding: 14px;
	border-radius: 4px;
	box-shadow: 6px 10px 30px rgba(23, 22, 27, .18);
}

.acs__frame img { inline-size: 100%; block-size: auto; display: block; border-radius: 2px; }

.acs__panel h3 {
	font-family: "Reem Kufi", "Tajawal", sans-serif;
	font-size: 22px;
	margin: 0 0 14px;
}

.acs__specs { margin: 0 0 18px; display: grid; gap: 8px; font-size: 14px; }
.acs__specs > div { display: flex; justify-content: space-between; gap: 12px; border-block-end: 1px dotted var(--acs-line); padding-block-end: 6px; }
.acs__specs dt { color: var(--acs-ink-soft); margin: 0; }
.acs__specs dd { margin: 0; font-weight: 500; }

.acs__price {
	font-family: "Reem Kufi", "Tajawal", sans-serif;
	font-size: 28px;
	color: var(--acs-brass-deep);
	margin-bottom: 14px;
}

.acs__qty { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 14px; }
.acs__qty input {
	inline-size: 74px;
	padding: 8px;
	border: 1px solid var(--acs-line);
	border-radius: 8px;
	font: inherit;
	text-align: center;
}

.acs__fineprint { font-size: 12px; color: var(--acs-ink-soft); margin-top: 14px; }

/* ---------- buttons ---------- */

.acs__actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

.acs__btn {
	background: var(--acs-ink);
	color: #fff;
	border: 1px solid var(--acs-ink);
	border-radius: 999px;
	padding: 12px 26px;
	font: inherit;
	font-weight: 700;
	font-size: 15px;
	cursor: pointer;
	transition: background .18s, opacity .18s;
}

.acs__btn:hover:not(:disabled) { background: #000; }
.acs__btn:disabled { opacity: .38; cursor: not-allowed; }
.acs__btn--ghost { background: transparent; color: var(--acs-ink); }
.acs__btn--ghost:hover:not(:disabled) { background: rgba(23, 22, 27, .06); }
.acs__btn--wide { inline-size: 100%; }

.acs__link {
	background: none;
	border: 0;
	padding: 6px 0;
	font: inherit;
	font-size: 13px;
	color: var(--acs-brass-deep);
	text-decoration: underline;
	cursor: pointer;
}

/* ---------- loader ---------- */

.acs__loader {
	position: absolute;
	inset: 0;
	background: rgba(237, 235, 230, .93);
	display: grid;
	place-items: center;
	border-radius: 16px;
	z-index: 5;
}

.acs__loaderbox { text-align: center; max-inline-size: 320px; }
.acs__loaderbox p { font-weight: 700; margin: 16px 0 4px; }
.acs__loaderbox small { color: var(--acs-ink-soft); font-size: 13px; }

.acs__brush { display: flex; gap: 6px; justify-content: center; }

.acs__brush span {
	inline-size: 8px;
	block-size: 34px;
	border-radius: 4px;
	background: var(--acs-brass);
	animation: acs-stroke 1.1s ease-in-out infinite;
}

.acs__brush span:nth-child(2) { background: var(--acs-slate); animation-delay: .15s; }
.acs__brush span:nth-child(3) { background: var(--acs-ink); animation-delay: .3s; }

@keyframes acs-stroke {
	0%, 100% { transform: scaleY(.45); opacity: .5; }
	50% { transform: scaleY(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
	.acs__brush span { animation: none; }
}

/* ---------- LTR override ---------- */

.acs[dir="ltr"] .acs__wallcanvas { transform: translateX(-50%); }
