/* ==========================================================================
   Naše Vykrajovátko — Generátor STL
   Single stylesheet, no build step. Vendored Roboto woff2 same-origin.
   ========================================================================== */


/* ---------- 1. Roboto vendored, latin + latin-ext, weights 400/500/700 ---- */
/* unicode-range subsetting: browser fetches latin-ext only when ČŠŘŽ etc.
   actually appear on the page. font-display:swap = text is visible during
   font load (no FOIT). */

@font-face {
	font-family: 'Roboto';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/roboto-latin-400-normal.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Roboto';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('../fonts/roboto-latin-ext-400-normal.woff2') format('woff2');
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}
@font-face {
	font-family: 'Roboto';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('../fonts/roboto-latin-500-normal.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Roboto';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('../fonts/roboto-latin-ext-500-normal.woff2') format('woff2');
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}
@font-face {
	font-family: 'Roboto';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/roboto-latin-700-normal.woff2') format('woff2');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
		U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC,
		U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Roboto';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('../fonts/roboto-latin-ext-700-normal.woff2') format('woff2');
	unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F,
		U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F,
		U+A720-A7FF;
}


/* ---------- 2. Design tokens ---------------------------------------------- */
/* Two font vars — --font-brand and --font-body — split so we can swap the
   brand face later without touching the body face (or vice versa). Today
   both are Roboto. */

:root {
	/* Brand — deep raspberry, cousin of eshop's pinkish mauve */
	--color-brand:         #9c246a;
	--color-brand-dark:    #7a1a52;
	--color-brand-soft:    #f6e4ee;

	/* Action accent — punchier cousin of the brand raspberry. Same hue
	   family as --color-brand, higher saturation + lightness so primary
	   CTAs read louder than the brand-coloured wordmark/links around
	   them. White text on this passes WCAG AA (~6.4:1). */
	--color-accent:        #b81a73;
	--color-accent-dark:   #8c1359;

	/* Neutrals */
	--color-fg:            #1f2228;
	--color-fg-muted:      #5a5f6a;
	--color-bg:            #ffffff;
	--color-surface:       #f6f7f9;
	--color-border:        #e3e5ea;
	--color-border-strong: #c8ccd4;

	/* Status */
	--color-success:       #0fa88a;
	--color-success-soft:  #def5ee;
	--color-warning:       #d49a2a;
	--color-warning-soft:  #fbf2dd;
	--color-danger:        #d04545;
	--color-danger-soft:   #fbe5e5;
	--color-info-soft:     #e2ecf7;

	/* Type */
	--font-brand: 'Roboto', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--font-body:  'Roboto', -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--font-mono:  ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

	/* Spacing — 4px base */
	--space-1:  4px;
	--space-2:  8px;
	--space-3: 12px;
	--space-4: 16px;
	--space-5: 24px;
	--space-6: 32px;
	--space-7: 48px;
	--space-8: 64px;

	/* Shape */
	--radius-sm:  4px;
	--radius-md:  8px;
	--radius-lg: 16px;

	/* Elevation */
	--shadow-sm: 0 1px 2px rgba(0,0,0,.06), 0 1px 3px rgba(0,0,0,.04);
	--shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.04);

	/* Layout */
	--container-width: 1080px;
}


/* ---------- 3. Reset (minimal modern) ------------------------------------- */

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

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

body {
	margin: 0;
	font-family: var(--font-body);
	font-size: 16px;
	line-height: 1.55;
	color: var(--color-fg);
	background: var(--color-bg);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;

	/* Sticky-footer pattern: body is a flex column min-height 100vh, footer
	 * gets margin-top:auto which consumes leftover free space and pushes it
	 * to the bottom of the viewport on short pages — main stays at its
	 * natural content height (so cards inside it don't get stretched). */
	min-height: 100vh;
	display: flex;
	flex-direction: column;
}
/* Ensure flex children of body don't refuse to shrink below intrinsic size
 * when descendants (e.g. a freshly-loaded full-resolution upload image)
 * have huge min-content widths. Without this, a 4000-px source image
 * would force main wider than the viewport and blow out the layout. */
header, main, footer { min-width: 0; }

img, svg, video { max-width: 100%; height: auto; display: block; }

/* Honour the [hidden] attribute even when our own display: flex / inline-flex
 * rules would otherwise override the UA stylesheet (author > UA). Used by the
 * generator step machine — `hidden` is the source of truth for visibility. */
[hidden] { display: none !important; }

button, input, select, textarea {
	font: inherit;
	color: inherit;
}

h1, h2, h3, h4, h5, h6, p, ul, ol, dl, figure { margin: 0; }

ul, ol { padding-left: var(--space-5); }


/* ---------- 4. Typography ------------------------------------------------- */

h1, h2, h3, h4 {
	font-family: var(--font-brand);
	font-weight: 700;
	color: var(--color-fg);
	line-height: 1.2;
}

h1 { font-size: 2.0rem; }
h2 { font-size: 1.5rem; margin-top: var(--space-6); margin-bottom: var(--space-3); }
h3 { font-size: 1.2rem; margin-top: var(--space-5); margin-bottom: var(--space-2); }
h4 { font-size: 1.0rem; font-weight: 500; }

p { margin-bottom: var(--space-3); }
p:last-child { margin-bottom: 0; }

a {
	color: var(--color-brand);
	text-decoration: underline;
	text-underline-offset: 2px;
	text-decoration-thickness: 1px;
	transition: color .15s;
}
a:hover, a:focus-visible { color: var(--color-brand-dark); }

strong { font-weight: 700; }

code, pre, .text-mono { font-family: var(--font-mono); font-size: .92em; }


/* ---------- 5. Layout: container, header, footer -------------------------- */

.container {
	max-width: var(--container-width);
	margin: 0 auto;
	padding: 0 var(--space-4);
}

.site-header {
	border-bottom: 1px solid var(--color-border);
	background: var(--color-bg);
	padding: var(--space-3) 0;
	margin-bottom: var(--space-5);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--space-4);
	flex-wrap: wrap;
}

.site-header__brand {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	text-decoration: none;
	color: var(--color-fg);
}
.site-header__brand:hover { color: var(--color-fg); }

.site-header__brand img {
	height: 44px;
	width: auto;
}

.site-header__subtitle {
	font-family: var(--font-brand);
	font-size: .8rem;
	font-weight: 500;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--color-fg-muted);
	border-left: 2px solid var(--color-border-strong);
	padding-left: var(--space-3);
	line-height: 1.2;
}

/* Push nav and language switch to the right of the brand */
.site-header__nav { margin-left: auto; }

.site-nav ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-4);
	padding: 0;
	margin: 0;
	align-items: center;
}

.site-nav a {
	color: var(--color-fg);
	text-decoration: none;
	font-weight: 500;
	padding: var(--space-2) 0;
	font-size: .95rem;
}
.site-nav a:hover, .site-nav a:focus-visible {
	color: var(--color-brand);
}

.site-nav__user {
	color: var(--color-fg-muted);
	font-size: .9rem;
}
.site-nav__user strong { color: var(--color-fg); font-weight: 500; }

.lang-switch {
	display: inline-flex;
	gap: var(--space-1);
	font-size: .85rem;
	color: var(--color-fg-muted);
	margin-left: var(--space-3);
}
.lang-switch a {
	color: var(--color-fg-muted);
	text-decoration: none;
	padding: 2px 6px;
	border-radius: var(--radius-sm);
}
.lang-switch a:hover { background: var(--color-surface); color: var(--color-fg); }
.lang-switch strong {
	color: var(--color-brand);
	padding: 2px 6px;
	border-radius: var(--radius-sm);
	background: var(--color-brand-soft);
}


/* ---------- 6. Components: card, alert ------------------------------------ */

.card {
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-5);
	margin-bottom: var(--space-5);
}

.card--brand {
	background: var(--color-brand-soft);
	border-color: transparent;
}

.alert {
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	margin: var(--space-2) 0;
	border: 1px solid transparent;
}
.alert-info,
.alert-notice  { background: var(--color-info-soft);    border-color: #c4d4ea; }
.alert-success { background: var(--color-success-soft); border-color: #b9e6d3; color: #185c45; }
.alert-warning { background: var(--color-warning-soft); border-color: #ecd089; color: #6b4d11; }
.alert-error,
.alert-danger  { background: var(--color-danger-soft);  border-color: #efb6b6; color: #6f1e1e; }

/* Low-contrast notice in the generator: inline label + toggle button. */
.contrast-notice {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-2) var(--space-3);
	align-items: baseline;
	justify-content: space-between;
}
.contrast-notice .btn--link { padding: 0; }


/* ---------- 7. Forms ------------------------------------------------------ */

label {
	display: inline-block;
	font-weight: 500;
	margin-bottom: var(--space-1);
	color: var(--color-fg);
}

form .required > label,
form .required label { font-weight: 700; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
	width: 100%;
	max-width: 420px;
	padding: var(--space-2) var(--space-3);
	font-family: inherit;
	font-size: 1rem;
	color: var(--color-fg);
	background: var(--color-bg);
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius-sm);
	transition: border-color .15s, box-shadow .15s;
}

input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: var(--color-brand);
	box-shadow: 0 0 0 3px var(--color-brand-soft);
}

input[type="number"] { max-width: 100px; }

input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 240px;
	max-width: 100%;
	height: 6px;
	background: var(--color-border);
	border-radius: 3px;
	vertical-align: middle;
}
input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 24px; height: 24px;     /* ≥44 px tap target via padding hit area below */
	border-radius: 50%;
	background: var(--color-brand);
	cursor: pointer;
	border: 2px solid var(--color-bg);
	box-shadow: var(--shadow-sm);
}
input[type="range"]::-moz-range-thumb {
	width: 24px; height: 24px;
	border-radius: 50%;
	background: var(--color-brand);
	cursor: pointer;
	border: 2px solid var(--color-bg);
	box-shadow: var(--shadow-sm);
}

button,
.btn,
input[type="submit"],
input[type="button"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	font-family: var(--font-brand);
	font-weight: 500;
	font-size: 1rem;
	line-height: 1.2;
	min-height: 44px;
	padding: var(--space-2) var(--space-4);
	background: var(--color-brand);
	color: #fff;
	border: 1px solid var(--color-brand);
	border-radius: var(--radius-sm);
	cursor: pointer;
	text-decoration: none;
	transition: background .15s, border-color .15s, transform .05s;
}
button:hover, .btn:hover,
input[type="submit"]:hover, input[type="button"]:hover {
	background: var(--color-brand-dark);
	border-color: var(--color-brand-dark);
	color: #fff;
}
button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .btn:focus-visible {
	outline: 3px solid var(--color-brand-soft);
	outline-offset: 1px;
}
button:disabled, .btn:disabled {
	opacity: .55;
	cursor: not-allowed;
	transform: none;
}

.btn--accent {
	background: var(--color-accent);
	border-color: var(--color-accent);
}
.btn--accent:hover {
	background: var(--color-accent-dark);
	border-color: var(--color-accent-dark);
}

.btn--ghost {
	background: transparent;
	color: var(--color-fg);
	border-color: var(--color-border-strong);
}
.btn--ghost:hover {
	background: var(--color-surface);
	color: var(--color-fg);
	border-color: var(--color-border-strong);
}

.btn--danger {
	background: var(--color-danger);
	border-color: var(--color-danger);
}
.btn--danger:hover { background: #a93535; border-color: #a93535; }

.btn--link {
	background: transparent;
	color: var(--color-brand);
	border-color: transparent;
	min-height: 0;
	padding: 0;
	text-decoration: underline;
}
.btn--link:hover { background: transparent; color: var(--color-brand-dark); }

/* Nette default-renderer table-based form layout. Most forms in the app
 * render via {control xxxForm}, which produces <table><tr><th>label</th>
 * <td>input</td></tr></table>. Style it as a borderless, generously-spaced
 * stack rather than try to swap renderers globally. */
form table:not(.data-table) {
	border-collapse: collapse;
	width: 100%;
	max-width: 480px;
}
form table:not(.data-table) th,
form table:not(.data-table) td {
	padding: var(--space-2) 0;
	text-align: left;
	vertical-align: top;
	font-weight: normal;
	border: none;
}
form table:not(.data-table) th {
	width: 35%;
	padding-right: var(--space-3);
	padding-top: calc(var(--space-2) + 8px); /* visually centre on input */
	color: var(--color-fg);
}
form table:not(.data-table) tr.required th { font-weight: 700; }

/* On mobile, stack label above input */
@media (max-width: 540px) {
	form table:not(.data-table),
	form table:not(.data-table) tbody,
	form table:not(.data-table) tr,
	form table:not(.data-table) th,
	form table:not(.data-table) td {
		display: block;
		width: 100%;
	}
	form table:not(.data-table) th {
		padding: 0 0 var(--space-1) 0;
	}
	form table:not(.data-table) td {
		padding: 0 0 var(--space-3) 0;
	}
}

/* Form-level error list (rendered by Nette above the field rows) */
form ul.error,
form .form-errors {
	list-style: none;
	padding: var(--space-3) var(--space-4);
	margin: 0 0 var(--space-3) 0;
	background: var(--color-danger-soft);
	border: 1px solid #efb6b6;
	border-radius: var(--radius-sm);
	color: #6f1e1e;
}

/* Nette form error/help conventions */
.error, span.error, .form-error {
	color: var(--color-danger);
	font-size: .9rem;
	margin-top: var(--space-1);
}
.help, .description {
	color: var(--color-fg-muted);
	font-size: .9rem;
}


/* ---------- 8. Tables ----------------------------------------------------- */

.data-table,
table.data-table {
	width: 100%;
	border-collapse: collapse;
	margin: var(--space-3) 0;
	background: var(--color-bg);
}
.data-table th, .data-table td {
	padding: var(--space-2) var(--space-3);
	text-align: left;
	border-bottom: 1px solid var(--color-border);
	vertical-align: top;
}
.data-table thead th {
	background: var(--color-surface);
	font-weight: 500;
	color: var(--color-fg);
	border-bottom: 1px solid var(--color-border-strong);
}
.data-table tbody tr:hover { background: var(--color-surface); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Mobile-card transform for tables that should remain readable on phones.
 * Opt-in via .data-table--responsive on the <table> + data-label="…" on each
 * <td>. Hides the <thead>, lets each <tr> become a card with label/value
 * pairs flowing as flex rows. */
@media (max-width: 640px) {
	.data-table--responsive,
	.data-table--responsive thead,
	.data-table--responsive tbody,
	.data-table--responsive tr,
	.data-table--responsive td,
	.data-table--responsive th { display: block; }

	.data-table--responsive thead {
		position: absolute;
		left: -10000px;       /* visually hidden, kept in DOM for AT */
	}

	.data-table--responsive tr {
		border: 1px solid var(--color-border);
		border-radius: var(--radius-md);
		padding: var(--space-3);
		margin-bottom: var(--space-3);
		background: var(--color-bg);
	}
	.data-table--responsive tbody tr:hover { background: var(--color-bg); }

	.data-table--responsive td {
		display: flex;
		justify-content: space-between;
		align-items: baseline;
		gap: var(--space-3);
		padding: var(--space-1) 0;
		border: none;
		text-align: left;
	}
	.data-table--responsive td.num { text-align: right; }
	.data-table--responsive td::before {
		content: attr(data-label);
		font-weight: 500;
		color: var(--color-fg-muted);
		font-size: .85rem;
		flex: 0 0 auto;
	}
	/* If a cell has no data-label, suppress the empty pseudo to avoid the gap */
	.data-table--responsive td:not([data-label])::before { content: none; }
}


/* ---------- 9. Generator (three-step flow) -------------------------------- */

/* Hide the file input — the drop zone + "Vybrat soubor" link drive it. */
#imageInput { display: none; }

/* Container around the step cards. */
.generator { margin-top: var(--space-4); }

/* One numbered step card. The list itself is a real <ol> so screen readers
 * announce step numbers; the visual numbering is rendered by the chip. */
.generator__steps {
	list-style: none;
	padding: 0;
	margin: 0;
}

.generator-step {
	display: flex;
	gap: var(--space-4);
	padding: var(--space-5);
	background: var(--color-surface);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-4);
}
.generator-step[aria-current="step"] {
	background: var(--color-bg);
	border-color: var(--color-brand);
	box-shadow: var(--shadow-sm);
}

.generator-step__num {
	flex: 0 0 auto;
	width: 36px; height: 36px;
	border-radius: 50%;
	background: var(--color-border);
	color: var(--color-fg-muted);
	font-family: var(--font-brand);
	font-weight: 700;
	font-size: 1.1rem;
	display: flex;
	align-items: center;
	justify-content: center;
}
.generator-step[aria-current="step"] .generator-step__num {
	background: var(--color-brand);
	color: #fff;
}

.generator-step__body {
	flex: 1 1 auto;
	min-width: 0;
}
.generator-step__body > h2:first-child {
	margin-top: 0;
	margin-bottom: var(--space-3);
	font-size: 1.25rem;
}

/* Drop zone — large tap-friendly area, brand-tinted on drag-hover. */
#drop {
	border: 2px dashed var(--color-border-strong);
	background: var(--color-bg);
	padding: var(--space-6);
	text-align: center;
	border-radius: var(--radius-md);
	color: var(--color-fg-muted);
	min-height: 160px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: var(--space-2);
	transition: border-color .15s, background .15s;
	cursor: pointer;
}
#drop:hover { border-color: var(--color-brand); background: var(--color-brand-soft); }
#drop.hovering {
	border-color: var(--color-brand);
	background: var(--color-brand-soft);
	color: var(--color-fg);
}
#drop #imageSelect {
	font-weight: 500;
	font-size: 1.05rem;
}
#drop p { margin: 0; font-size: .9rem; }

/* Image + outline previews side-by-side, stacked on tablet portrait. */
.generator-previews {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
}
@media (max-width: 720px) {
	.generator-previews { grid-template-columns: 1fr; }
}
.generator-previews figure {
	margin: 0;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	padding: var(--space-3);
	box-shadow: var(--shadow-sm);
	/* Allow the grid item to shrink below its intrinsic min-content size,
	 * so a freshly-loaded full-resolution <img> doesn't widen the column. */
	min-width: 0;
}
.generator-previews figcaption {
	font-size: .85rem;
	font-weight: 500;
	color: var(--color-fg-muted);
	margin-bottom: var(--space-2);
}
.generator-previews img,
.generator-previews svg {
	width: 100%;
	height: 240px;
	object-fit: contain;
	display: block;
}

/* Adjust controls — labels left-aligned to a fixed column on desktop, stack on mobile. */
.generator-controls {
	display: flex;
	flex-direction: column;
	gap: var(--space-3);
	margin: var(--space-4) 0 0 0;
}
.generator-controls__row {
	display: flex;
	gap: var(--space-3);
	align-items: center;
	flex-wrap: wrap;
}
.generator-controls__row > label {
	min-width: 9em;
	margin-bottom: 0;
	font-weight: 500;
}
.generator-controls__row input[type="number"] { max-width: 90px; min-height: 40px; }
.generator-controls__row input[type="range"] { flex: 1 1 220px; }
@media (max-width: 540px) {
	.generator-controls__row > label { min-width: 100%; }
}

#offsetValue {
	font-variant-numeric: tabular-nums;
	font-weight: 500;
	color: var(--color-fg);
	min-width: 2.5em;
	display: inline-block;
}

.status-line {
	color: var(--color-fg-muted);
	font-size: .92rem;
	flex: 1 1 100%;
}
.status-line a { font-weight: 500; }

/* Preview-pay step (#previewPane). Renders top + iso views, summary, actions. */
.preview-info {
	background: var(--color-brand-soft);
	color: var(--color-fg);
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-sm);
	margin-bottom: var(--space-4);
}
.preview-info strong { color: var(--color-brand-dark); }

.preview-images {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
}
@media (max-width: 720px) {
	.preview-images { grid-template-columns: 1fr; }
}
.preview-images img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
}

/* Iso "spinner": draggable container with a hint overlay that fades on
 * first interaction. Cursor signals "you can grab this and rotate".
 * Touch pan is disabled so swipes go to the JS handler, not page-scroll. */
.iso-spinner {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
	cursor: grab;
	overflow: hidden;
	user-select: none;
	-webkit-user-select: none;
	touch-action: none;
}
.iso-spinner.is-grabbing { cursor: grabbing; }
.iso-spinner img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	pointer-events: none;       /* let the parent capture drag */
	-webkit-user-drag: none;
	border: none;
	box-shadow: none;
	background: transparent;
	border-radius: 0;
}

.iso-spinner__hint {
	position: absolute;
	bottom: var(--space-2);
	left: 50%;
	transform: translateX(-50%);
	background: rgba(31, 34, 40, 0.78);
	color: #fff;
	font-size: .82rem;
	font-weight: 500;
	padding: 4px 12px;
	border-radius: 999px;
	pointer-events: none;
	transition: opacity .25s;
	white-space: nowrap;
}
.iso-spinner.is-touched .iso-spinner__hint { opacity: 0; }

/* Loader overlay shown while orbit frames load in the background. */
.iso-spinner__loader {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: var(--space-3);
	background: rgba(255, 255, 255, 0.82);
	color: var(--color-fg-muted);
	font-size: .85rem;
	font-weight: 500;
}
.iso-spinner__loader::before {
	content: "";
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 3px solid var(--color-border);
	border-top-color: var(--color-brand);
	animation: iso-spin .8s linear infinite;
}
@keyframes iso-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.iso-spinner__loader::before { animation: none; }
}

.preview-actions {
	display: flex;
	gap: var(--space-3);
	flex-wrap: wrap;
	align-items: center;
}

/* In-progress state for image upload+trace. Drop zone hides; this panel
 * (matching the drop zone's bordered look) shows a spinner + "tracing"
 * text. potrace+downsample on a large phone photo can take 2-4 seconds. */
.drop-loading {
	border: 2px solid var(--color-brand-soft);
	background: var(--color-bg);
	padding: var(--space-6);
	text-align: center;
	border-radius: var(--radius-md);
	color: var(--color-fg);
	min-height: 160px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: var(--space-3);
}
.drop-loading p { margin: 0; }

.loading-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--color-brand-soft);
	border-top-color: var(--color-brand);
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
}
@keyframes spin {
	from { transform: rotate(0deg); }
	to   { transform: rotate(360deg); }
}

/* Transient error overlay on the drop zone — set via JS data-error on
 * upload/trace failure. Flashes for a few seconds, then JS clears it. */
#drop[data-error]::after {
	content: attr(data-error);
	display: block;
	margin-top: var(--space-2);
	color: var(--color-danger);
	font-size: .9rem;
	font-weight: 500;
}

/* "Change image" button shown after upload — small affordance to start over. */
.change-image-btn {
	margin-top: 0;
	min-height: 36px;
	font-size: .9rem;
}

/* Step-1 collapses once an image is picked: smaller chip turns green, drop
 * zone hidden, only the "Change image" button remains. h2 hidden because
 * the chip + button alone are already self-explanatory. */
.generator-step--minimized {
	padding: var(--space-3) var(--space-4);
	gap: var(--space-3);
	align-items: center;
}
.generator-step--minimized .generator-step__body > h2 { display: none; }
.generator-step--minimized .generator-step__num {
	background: var(--color-success);
	color: #fff;
	width: 28px; height: 28px;
	font-size: .9rem;
}


/* ---------- 10. Utilities ------------------------------------------------- */

.text-muted  { color: var(--color-fg-muted); }
.text-brand  { color: var(--color-brand); }
.text-accent { color: var(--color-accent); }

.stack > * + * { margin-top: var(--space-3); }
.stack-lg > * + * { margin-top: var(--space-5); }

.visually-hidden {
	position: absolute !important;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0,0,0,0);
	white-space: nowrap; border: 0;
}

/* Honeypot — invisible-but-DOM-present field on auth forms.
 * Off-screen positioning (NOT display:none — some bots skip hidden fields).
 * tabindex=-1 + autocomplete=off cover keyboard / password-manager paths.
 */
.hp-field {
	position: absolute !important;
	left: -10000px !important;
	top: 0 !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
}


/* ---------- 10b. Page-level patterns -------------------------------------- */

/* Narrow centered form pages — sign in, sign up, forgot password, etc. */
.auth-card {
	max-width: 420px;
	margin: var(--space-5) 0;
}

/* Toolbar row: filter links + primary CTA, separated by space-between */
.toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3) var(--space-4);
	align-items: center;
	margin: var(--space-3) 0;
}
.toolbar .filter-links {
	display: flex;
	gap: var(--space-1) var(--space-3);
	flex-wrap: wrap;
	color: var(--color-fg-muted);
}
.toolbar .spacer { flex: 1; }

/* Pagination nav */
.pagination {
	margin-top: var(--space-4);
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	align-items: center;
	color: var(--color-fg-muted);
	font-size: .95rem;
}
.pagination a, .pagination strong {
	display: inline-block;
	padding: 2px 10px;
	border-radius: var(--radius-sm);
	min-width: 1.8em;
	text-align: center;
}
.pagination a { color: var(--color-brand); text-decoration: none; }
.pagination a:hover { background: var(--color-brand-soft); }
.pagination strong { background: var(--color-brand-soft); color: var(--color-brand); }

/* Status pills + text colors */
.status--success { color: var(--color-success); font-weight: 500; }
.status--danger  { color: var(--color-danger);  font-weight: 500; }
.status--muted   { color: var(--color-fg-muted); }
.status--warning { color: var(--color-warning); font-weight: 500; }

/* Big credit-balance display */
.balance {
	font-family: var(--font-brand);
	font-size: 3rem;
	font-weight: 700;
	color: var(--color-brand);
	font-variant-numeric: tabular-nums;
	line-height: 1;
}
.balance__unit {
	font-size: .9rem;
	font-weight: 500;
	color: var(--color-fg-muted);
	letter-spacing: .04em;
	margin-left: var(--space-1);
}
.balance__label {
	display: block;
	font-size: .85rem;
	font-weight: 500;
	color: var(--color-fg-muted);
	letter-spacing: .08em;
	text-transform: uppercase;
	margin-bottom: var(--space-1);
}

/* Generation thumbnail in /account history rows — the top-view SVG preview
 * served by /api/preview, displayed at a small inline size. */
.gen-thumb {
	width: 56px;
	height: 56px;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-sm);
	object-fit: contain;
	flex: 0 0 auto;
}

/* Pending-section accent bar — highlight the "needs your action" rows */
.section--pending h2 { color: var(--color-warning); }
.section--pending {
	border-left: 3px solid var(--color-warning);
	padding-left: var(--space-4);
	margin-bottom: var(--space-6);
}

/* Tight cluster of two/three action buttons inside a table cell */
.action-cluster {
	display: flex;
	gap: var(--space-2);
	flex-wrap: wrap;
	align-items: center;
}
.action-cluster .btn { min-height: 32px; padding: 4px 10px; font-size: .9rem; }
.action-cluster .inline-form { margin: 0; }

/* Account hero — balance + email + top-up CTA in one card. Stacks on mobile. */
.account-hero {
	display: flex;
	align-items: center;
	gap: var(--space-5);
	padding: var(--space-5) var(--space-6);
	background: var(--color-brand-soft);
	border-radius: var(--radius-md);
	margin-bottom: var(--space-5);
	flex-wrap: wrap;
}
.account-hero__balance { flex: 0 0 auto; }
.account-hero__user {
	flex: 1 1 auto;
	min-width: 0;
	color: var(--color-fg-muted);
	font-size: .95rem;
}
.account-hero__user strong {
	display: block;
	color: var(--color-fg);
	font-weight: 500;
	word-break: break-all;
}
.account-hero .btn { flex: 0 0 auto; }
@media (max-width: 640px) {
	.account-hero { padding: var(--space-4); gap: var(--space-3); }
	.account-hero .btn { width: 100%; }
	.balance { font-size: 2.4rem; }
}

/* Table-row "deactivated/disabled" hint */
.data-table tr.muted-row td { color: var(--color-fg-muted); }

/* Mono-tone "code-like" cell content (audit type, kupon kódy) */
.data-table .mono { font-family: var(--font-mono); font-size: .92em; }

/* Inline form (e.g. revoke-code reason input next to a Submit) */
.inline-form {
	display: inline-flex;
	gap: var(--space-2);
	align-items: center;
	flex-wrap: wrap;
	margin: 0;
}
.inline-form input[type="text"] {
	max-width: 160px;
	min-height: auto;
	padding: 4px 8px;
}
.inline-form button {
	min-height: auto;
	padding: 4px 12px;
	font-size: .9rem;
}

/* Danger zone — destructive admin actions framed in red. Used on the user
 * edit page for GDPR redact. */
.danger-zone {
	margin-top: var(--space-6);
	padding: var(--space-4);
	border: 1px solid var(--color-danger);
	border-radius: var(--radius-md);
	background: var(--color-danger-soft);
}
.danger-zone h2 {
	margin-top: 0;
	color: var(--color-danger);
}

/* Admin nav variant — slightly more compact, subtle accent in subtitle */
.site-header--admin .site-header__subtitle { color: var(--color-brand); }

/* Empty-state placeholder — used where a list/table has zero rows.
 * Centered text + muted colour + soft surface, with optional icon line. */
.empty-state {
	background: var(--color-surface);
	border: 1px dashed var(--color-border-strong);
	border-radius: var(--radius-md);
	padding: var(--space-6) var(--space-5);
	text-align: center;
	color: var(--color-fg-muted);
}
.empty-state__title {
	font-family: var(--font-brand);
	font-weight: 500;
	font-size: 1.05rem;
	color: var(--color-fg);
	margin-bottom: var(--space-2);
}
.empty-state p { margin-bottom: var(--space-3); }
.empty-state p:last-child { margin-bottom: 0; }

/* Pre-formatted blocks inside table cells (audit payload, error_message) */
.data-table pre {
	margin: 0;
	white-space: pre-wrap;
	word-break: break-word;
	font-size: .88em;
	font-family: var(--font-mono);
	color: var(--color-fg);
}


/* ---------- 10c. Landing page --------------------------------------------- */

.hero {
	padding: var(--space-7) 0 var(--space-6);
	text-align: center;
}
.hero h1 {
	font-size: 2.5rem;
	max-width: 24ch;
	margin: 0 auto var(--space-3);
	color: var(--color-fg);
}
.hero h1 .accent { color: var(--color-brand); }
.hero .lead {
	font-size: 1.15rem;
	color: var(--color-fg-muted);
	max-width: 50ch;
	margin: 0 auto var(--space-5);
}

.cta-cluster {
	display: flex;
	gap: var(--space-3);
	justify-content: center;
	flex-wrap: wrap;
}
.cta-cluster .btn { min-width: 180px; }

/* Generic content section between hero and footer. */
.section {
	padding: var(--space-6) 0;
	border-top: 1px solid var(--color-border);
}
.section h2 {
	font-size: 1.6rem;
	text-align: center;
	margin-top: 0;
	margin-bottom: var(--space-2);
}
.section .lead {
	text-align: center;
	color: var(--color-fg-muted);
	max-width: 60ch;
	margin: 0 auto var(--space-6);
}

/* "How it works" 3-step strip. */
.steps-strip {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: var(--space-5);
	margin-top: var(--space-5);
}
@media (max-width: 720px) {
	.steps-strip { grid-template-columns: 1fr; gap: var(--space-4); }
}
.steps-strip__item {
	text-align: center;
	padding: var(--space-4);
}
.steps-strip__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px; height: 48px;
	background: var(--color-brand-soft);
	color: var(--color-brand);
	font-family: var(--font-brand);
	font-weight: 700;
	font-size: 1.4rem;
	border-radius: 50%;
	margin-bottom: var(--space-3);
}
.steps-strip__item h3 {
	margin: 0 0 var(--space-2);
	font-size: 1.1rem;
}
.steps-strip__item p {
	color: var(--color-fg-muted);
	font-size: .95rem;
	margin: 0;
}

/* Feature row: text + image, side-by-side on desktop, stacked on tablet. */
.feature {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: var(--space-6);
	align-items: center;
	margin-top: var(--space-5);
}
@media (max-width: 720px) {
	.feature { grid-template-columns: 1fr; gap: var(--space-4); }
}
.feature--reverse > :first-child { order: 2; }
@media (max-width: 720px) {
	.feature--reverse > :first-child { order: 0; }
}
.feature__text h3 {
	margin-top: 0;
	font-size: 1.3rem;
}
.feature__media img {
	width: 100%;
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-md);
}
.feature__media figcaption {
	font-size: .85rem;
	color: var(--color-fg-muted);
	text-align: center;
	margin-top: var(--space-2);
}

/* Highlighted call-out for "Where to get codes" — eshop-coloured tint. */
.section--highlight {
	background: var(--color-brand-soft);
	border-radius: var(--radius-lg);
	padding: var(--space-6) var(--space-5);
	margin: var(--space-6) 0;
	border: none;
	text-align: center;
}
.section--highlight h2 { color: var(--color-brand-dark); }

/* ---------- 10d. Footer --------------------------------------------------- */

.site-footer {
	/* margin-top:auto pushes footer to viewport bottom on short pages
	 * (sticky-footer pattern; works because body is a flex column with
	 * min-height:100vh — see body rule above). */
	margin-top: auto;
	padding: var(--space-5) 0 var(--space-6);
	border-top: 1px solid var(--color-border);
	background: var(--color-surface);
	color: var(--color-fg-muted);
	font-size: .9rem;
}
.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3) var(--space-5);
	align-items: center;
	justify-content: space-between;
}
.site-footer ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-4);
}
.site-footer a {
	color: var(--color-fg-muted);
	text-decoration: none;
}
.site-footer a:hover { color: var(--color-brand); text-decoration: underline; }
.site-footer__brand {
	display: flex;
	align-items: center;
	gap: var(--space-2);
}
.site-footer__brand img { height: 24px; width: auto; opacity: .8; }


/* ---------- 11. Responsive ------------------------------------------------ */

@media (max-width: 640px) {
	body { font-size: 15.5px; }
	h1   { font-size: 1.65rem; }
	h2   { font-size: 1.3rem; }
	.hero { padding: var(--space-5) 0 var(--space-5); }
	.hero h1 { font-size: 1.9rem; }
	.hero .lead { font-size: 1.05rem; }

	.site-header__inner {
		gap: var(--space-2);
	}
	.site-header__nav { margin-left: 0; width: 100%; }

	#imgdiv img, #svgdiv svg { height: 200px; }

	/* Tables become cards-ish on phone — opt-in via data-label cells later */
	.data-table { font-size: .92rem; }
	.data-table th, .data-table td { padding: var(--space-2); }
}
