/* ==========================================================================
   Ambrosi Metropolis · base.css
   Tokens, reset, typography, editorial grid and primitives.
   The component layer lives in theme.css.
   ========================================================================== */

:root {
	/*
	 * Palette · warm editorial paper (coreoftransylvania.ro; mirrored in theme.json).
	 * Paper is the page, ink is the text: every surface in this theme is light.
	 */
	--amb-paper: #f3ecdf;
	--amb-paper-light: #fbf7ef;
	--amb-paper-deep: #ece2d1;
	--amb-ink: #1b1812;
	--amb-ink-soft: #4f493d;
	--amb-muted: #6b6152;
	--amb-gold: #c18b2b;
	--amb-gold-bright: #e4b24c;
	--amb-gold-pale: #ecd5a5;
	--amb-gold-ink: #8a5f12;
	--amb-wine: #772b36;
	--amb-wine-deep: #5c212a;
	--amb-steel: #2e5668;
	--amb-dark: #17150f;
	--amb-cream: #f2e9da;
	--amb-line: rgba(27, 24, 18, 0.14);
	--amb-line-strong: rgba(27, 24, 18, 0.28);

	/* Text on the saturated surfaces (dark bands, wine, gold) */
	--amb-on-dark: var(--amb-cream);
	--amb-on-dark-muted: rgba(242, 233, 218, 0.62);
	--amb-on-wine: #fbf7ef;
	--amb-on-gold: var(--amb-dark);

	/*
	 * Legacy dark-era names, kept so the component layer stays valid.
	 * --amb-acid was the lime hover accent; on paper it becomes wine.
	 * --amb-parchment was the cream text colour; it is now ink.
	 */
	--amb-lichen: var(--amb-steel);
	--amb-acid: var(--amb-wine);
	--amb-parchment: var(--amb-ink);
	--amb-parchment-2: var(--amb-paper-deep);
	--amb-ink-2: var(--amb-paper-light);
	--amb-ink-3: var(--amb-paper-deep);

	/* Semantic layer: components read these, sections can re-map them */
	--amb-fg: var(--amb-ink);
	--amb-fg-muted: var(--amb-ink-soft);
	--amb-accent: var(--amb-gold-ink);
	--amb-accent-strong: var(--amb-wine);
	--amb-border: var(--amb-line);
	--amb-surface: var(--amb-paper-light);
	--amb-bg: var(--amb-paper);

	/* Shadows · warm, low-contrast, never black */
	--amb-shadow-soft: 0 22px 60px rgba(47, 34, 13, 0.09);
	--amb-shadow-lift: 0 30px 80px rgba(47, 34, 13, 0.16);

	/* Type · Fraunces (display) + Manrope (body), self-hosted in fonts.css */
	--amb-font-display: "Fraunces", "Georgia", "Times New Roman", Times, serif;
	--amb-font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--amb-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

	--amb-fs--2: clamp(0.6875rem, 0.66rem + 0.12vw, 0.75rem);
	--amb-fs--1: clamp(0.75rem, 0.73rem + 0.14vw, 0.8125rem);
	--amb-fs-0: clamp(0.9375rem, 0.9rem + 0.22vw, 1.0625rem);
	--amb-fs-1: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
	--amb-fs-2: clamp(1.25rem, 1.12rem + 0.75vw, 1.75rem);
	--amb-fs-3: clamp(1.625rem, 1.35rem + 1.5vw, 2.75rem);
	--amb-fs-4: clamp(2rem, 1.5rem + 2.8vw, 4rem);
	--amb-fs-5: clamp(2.5rem, 1.6rem + 4.6vw, 6rem);
	--amb-fs-6: clamp(3.25rem, 1.6rem + 8vw, 9.5rem);

	--amb-lh-tight: 1.02;
	--amb-lh-body: 1.65;
	--amb-track-display: -0.02em;
	--amb-track-label: 0.18em;

	/* Space */
	--amb-s-1: 0.25rem;
	--amb-s-2: 0.5rem;
	--amb-s-3: 0.75rem;
	--amb-s-4: 1rem;
	--amb-s-5: 1.5rem;
	--amb-s-6: 2rem;
	--amb-s-7: 3rem;
	--amb-s-8: 4.5rem;
	--amb-s-9: 6rem;
	--amb-gutter: clamp(1.25rem, 4.5vw, 4.5rem);
	--amb-section-y: clamp(3.5rem, 8vw, 8rem);
	--amb-maxw: 90rem;
	--amb-measure: 68ch;

	/* Chrome */
	--amb-header-h: calc(4.75rem + 1cm);
	--amb-radius: 2px;
	--amb-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--amb-ease-inout: cubic-bezier(0.65, 0.05, 0.36, 1);
	--amb-z-header: 80;
	--amb-z-progress: 90;
	--amb-z-mobile: 70;
	--amb-z-lightbox: 120;

	--amb-lang: "ro";
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

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

html {
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--amb-header-h) + 1.5rem);
	background: var(--amb-paper);
}

body {
	margin: 0;
	background: var(--amb-paper);
	color: var(--amb-ink);
	font-family: var(--amb-font-body);
	font-size: var(--amb-fs-0);
	font-weight: 400;
	line-height: var(--amb-lh-body);
	letter-spacing: 0.005em;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
	overflow-x: clip;
}

body.amb-no-scroll {
	overflow: hidden;
}

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

/*
 * Zero-specificity list reset: keeps editor/content lists tidy while letting
 * layout classes (.amb-wrap, .amb-stats, .amb-timeline__track, ...) set their own
 * padding. A plain `ul[class]` reset (0,1,1) would beat those (0,1,0) rules.
 */
:where(ul[class], ol[class]) {
	padding: 0;
	list-style: none;
}

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

img {
	height: auto;
}

picture {
	display: block;
	max-width: 100%;
}

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

iframe,
embed,
object {
	max-width: 100%;
}

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

button {
	cursor: pointer;
	background: none;
	border: 0;
	padding: 0;
}

a {
	color: inherit;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.22em;
}

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

hr {
	border: 0;
	border-top: 1px solid var(--amb-border);
	margin: var(--amb-s-6) 0;
}

[hidden] {
	display: none !important;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1,
h2,
h3 {
	font-family: var(--amb-font-display);
	font-weight: 300;
	line-height: var(--amb-lh-tight);
	letter-spacing: var(--amb-track-display);
	text-wrap: balance;
}

h1 {
	font-size: var(--amb-fs-5);
}

h2 {
	font-size: var(--amb-fs-4);
}

h3 {
	font-size: var(--amb-fs-2);
	font-weight: 400;
	line-height: 1.12;
}

h4,
h5,
h6 {
	font-family: var(--amb-font-body);
	font-size: var(--amb-fs--1);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

p {
	text-wrap: pretty;
}

strong,
b {
	font-weight: 600;
	color: var(--amb-fg);
}

em,
i {
	font-style: italic;
}

small {
	font-size: var(--amb-fs--1);
}

code,
kbd,
samp,
pre {
	font-family: var(--amb-font-mono);
	font-size: 0.9em;
}

pre {
	overflow-x: auto;
	padding: var(--amb-s-5);
	background: var(--amb-paper-light);
	border: 1px solid var(--amb-border);
}

code {
	color: var(--amb-lichen);
}

a:hover {
	color: var(--amb-acid);
}

::selection {
	background: var(--amb-gold);
	color: var(--amb-ink);
}

:focus-visible {
	outline: 2px solid var(--amb-acid);
	outline-offset: 3px;
}

:focus:not(:focus-visible) {
	outline: none;
}

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

.amb-wrap {
	width: 100%;
	max-width: var(--amb-maxw);
	margin-inline: auto;
	padding-inline: var(--amb-gutter);
}

.amb-section {
	position: relative;
	padding-block: var(--amb-section-y);
}

.amb-grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: var(--amb-gutter);
}

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

.amb-skip {
	position: absolute;
	top: 0;
	left: 50%;
	z-index: 200;
	transform: translate(-50%, -120%);
	padding: 0.9rem 1.4rem;
	background: var(--amb-wine);
	color: var(--amb-on-wine);
	font-family: var(--amb-font-mono);
	font-size: var(--amb-fs--1);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
	transition: transform 0.2s var(--amb-ease);
}

.amb-skip:focus {
	transform: translate(-50%, 0);
	color: var(--amb-on-wine);
}

/* --------------------------------------------------------------------------
   Primitives: label, lead, prose, rule, buttons, icons
   -------------------------------------------------------------------------- */

.amb-label {
	margin: 0;
	font-family: var(--amb-font-mono);
	font-size: var(--amb-fs--2);
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: var(--amb-track-label);
	text-transform: uppercase;
	color: var(--amb-accent);
}

.amb-lead {
	font-size: var(--amb-fs-1);
	line-height: 1.55;
	color: var(--amb-fg-muted);
	max-width: 52ch;
}

.amb-prose {
	max-width: var(--amb-measure);
	color: var(--amb-fg-muted);
}

.amb-prose > * + * {
	margin-top: 1.1em;
}

.amb-prose p {
	margin: 0;
}

.amb-prose h2,
.amb-prose h3,
.amb-prose h4 {
	margin-top: 1.75em;
	color: var(--amb-fg);
}

.amb-prose h2 {
	font-size: var(--amb-fs-3);
}

.amb-prose h3 {
	font-size: var(--amb-fs-2);
}

.amb-prose a {
	color: var(--amb-accent);
}

.amb-prose a:hover {
	color: var(--amb-acid);
}

.amb-prose strong {
	color: var(--amb-fg);
}

.amb-prose blockquote {
	margin: 1.75em 0;
	padding-left: var(--amb-s-5);
	border-left: 1px solid var(--amb-accent);
	font-family: var(--amb-font-display);
	font-size: var(--amb-fs-2);
	line-height: 1.3;
	color: var(--amb-fg);
}

.amb-prose--lead {
	font-size: var(--amb-fs-1);
	line-height: 1.6;
}

.amb-prose--article {
	font-size: var(--amb-fs-0);
}

.amb-prose--article > p:first-of-type::first-letter {
	float: left;
	font-family: var(--amb-font-display);
	font-size: 3.6em;
	line-height: 0.82;
	padding-right: 0.12em;
	color: var(--amb-accent);
}

.amb-rule {
	display: block;
	width: 100%;
	height: 1px;
	background: var(--amb-border);
}

.amb-icon {
	width: 1.1em;
	height: 1.1em;
	flex: none;
}

.amb-icon--arrow {
	width: 0.95em;
	height: 0.95em;
	transition: transform 0.3s var(--amb-ease);
}

.amb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.7rem;
	padding: 1rem 1.4rem;
	border: 1px solid var(--amb-border);
	border-radius: var(--amb-radius);
	background: transparent;
	color: var(--amb-fg);
	font-family: var(--amb-font-mono);
	font-size: var(--amb-fs--1);
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	text-decoration: none;
	transition:
		background-color 0.3s var(--amb-ease),
		border-color 0.3s var(--amb-ease),
		color 0.3s var(--amb-ease),
		transform 0.3s var(--amb-ease);
}

.amb-btn:hover,
.amb-btn:focus-visible {
	border-color: var(--amb-accent);
	color: var(--amb-fg);
	background: rgba(193, 139, 43, 0.1);
}

.amb-btn:hover .amb-icon--arrow {
	transform: translate(2px, -2px);
}

.amb-btn--primary {
	background: var(--amb-wine);
	border-color: var(--amb-wine);
	color: var(--amb-on-wine);
}

.amb-btn--primary:hover,
.amb-btn--primary:focus-visible {
	background: var(--amb-dark);
	border-color: var(--amb-dark);
	color: var(--amb-on-dark);
}

.amb-btn--ghost {
	background: transparent;
}

.amb-btn--dark {
	background: var(--amb-dark);
	border-color: var(--amb-dark);
	color: var(--amb-on-dark);
}

.amb-btn--dark:hover,
.amb-btn--dark:focus-visible {
	background: var(--amb-wine);
	border-color: var(--amb-wine);
	color: var(--amb-on-wine);
}

.amb-link-arrow {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	padding-bottom: 0.3rem;
	border-bottom: 1px solid var(--amb-border);
	color: var(--amb-fg);
	font-family: var(--amb-font-mono);
	font-size: var(--amb-fs--1);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	transition:
		color 0.25s var(--amb-ease),
		border-color 0.25s var(--amb-ease);
}

.amb-link-arrow:hover,
.amb-link-arrow:focus-visible {
	color: var(--amb-acid);
	border-color: var(--amb-acid);
}

.amb-link-arrow:hover .amb-icon--arrow {
	transform: translate(2px, -2px);
}

/* Sharing form controls */
.amb-input,
.amb-search__input {
	width: 100%;
	padding: 0.95rem 1.1rem;
	background: var(--amb-paper-light);
	border: 1px solid var(--amb-border);
	border-radius: var(--amb-radius);
	color: var(--amb-fg);
	font-family: var(--amb-font-body);
	font-size: var(--amb-fs-0);
}

.amb-input:focus-visible,
.amb-search__input:focus-visible {
	border-color: var(--amb-acid);
	outline-offset: 1px;
}

.amb-field {
	display: grid;
	gap: var(--amb-s-2);
}

/* Grain: a single fixed overlay, GPU-cheap and pointer-transparent */
body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: 150;
	pointer-events: none;
	opacity: 0.035;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.92' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
	mix-blend-mode: multiply;
}

/*
 * "Parchment" band: on the light page this is the deeper paper surface that
 * gives the archive and visit sections their rhythm. The class name is kept
 * because the template parts use it, but no section inverts to dark anymore.
 */
.amb-section--parchment {
	--amb-fg: var(--amb-ink);
	--amb-fg-muted: var(--amb-ink-soft);
	--amb-accent: var(--amb-gold-ink);
	--amb-border: var(--amb-line);
	--amb-surface: var(--amb-paper-light);
	background: var(--amb-paper-deep);
	color: var(--amb-fg);
}

.amb-section--parchment::before {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background-image: radial-gradient(rgba(27, 24, 18, 0.09) 0.6px, transparent 0.6px);
	background-size: 7px 7px;
	opacity: 0.35;
	mask-image: linear-gradient(180deg, #000, transparent 42%);
	-webkit-mask-image: linear-gradient(180deg, #000, transparent 42%);
}

.amb-section--parchment > * {
	position: relative;
	z-index: 1;
}

.amb-section--parchment .amb-label {
	color: var(--amb-accent);
}

.amb-section--parchment .amb-btn--dark {
	background: var(--amb-dark);
	border-color: var(--amb-dark);
	color: var(--amb-on-dark);
}

.amb-section--parchment .amb-btn--dark:hover {
	background: var(--amb-wine);
	border-color: var(--amb-wine);
	color: var(--amb-on-wine);
}

.amb-section--parchment a:hover {
	color: var(--amb-wine);
}

/* Scrollbar */
@supports (scrollbar-color: auto) {
	html {
		scrollbar-color: var(--amb-gold) var(--amb-paper-deep);
		scrollbar-width: thin;
	}
}

::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

::-webkit-scrollbar-track {
	background: var(--amb-paper-deep);
}

::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, var(--amb-gold), var(--amb-wine));
	border: 2px solid var(--amb-paper-deep);
	border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--amb-gold);
}

/* Reveal animation (main.js adds .amb-reveal on curated selectors) */
.amb-reveal {
	opacity: 0;
	transform: translate3d(0, 1.75rem, 0);
	transition:
		opacity 0.7s var(--amb-ease),
		transform 0.7s var(--amb-ease);
	transition-delay: var(--amb-delay, 0ms);
	will-change: opacity, transform;
}

.amb-reveal.is-in {
	opacity: 1;
	transform: none;
	will-change: auto;
}

/* View Transitions */
@view-transition {
	navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
	animation-duration: 0.35s;
	animation-timing-function: var(--amb-ease);
}

/* --------------------------------------------------------------------------
   Motion preference
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}

	.amb-reveal {
		opacity: 1;
		transform: none;
	}
}

/* --------------------------------------------------------------------------
   Forced colours
   -------------------------------------------------------------------------- */

@media (forced-colors: active) {
	* {
		box-shadow: none !important;
	}

	.amb-btn,
	.amb-chip,
	.amb-card,
	.amb-doc,
	.amb-partner,
	.amb-header,
	.amb-footer {
		border: 1px solid CanvasText;
	}

	.amb-progress__bar {
		background: Highlight;
	}

	.amb-reveal {
		opacity: 1;
		transform: none;
	}
}
