/**
 * global.css — Estelia Norway AS
 * Location: estelia-child/assets/css/global.css
 * Loads:    every page, after GeneratePress core
 * Depends:  assets/fonts/*.woff2
 *
 * Order: 1 fonts · 2 tokens · 3 reset · 4 base type
 *        5 layout · 6 components · 7 utilities · 8 a11y
 *
 * No section file may redefine a colour, size or space in raw units.
 * Use a token or add one here.
 */

/* ========================================================================
   1. FONTS — self-hosted, latin + latin-ext (carries æ ø å)
   No unicode-range: the files are already subset, and a latin-only
   range would block the Norwegian vowels.
   ======================================================================== */

@font-face {
	font-family: 'Instrument Serif';
	src: url('../fonts/instrumentserif-regular.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Instrument Serif';
	src: url('../fonts/instrumentserif-italic.woff2') format('woff2');
	font-weight: 400;
	font-style: italic;
	font-display: swap;
}

/* DM Sans variable: two axes, opsz and wght.
   font-optical-sizing on body (section 4) drives opsz automatically. */
@font-face {
	font-family: 'DM Sans';
	src: url('../fonts/dmsans-variable.woff2') format('woff2');
	font-weight: 100 1000;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'DM Sans';
	src: url('../fonts/dmsans-variable-italic.woff2') format('woff2');
	font-weight: 100 1000;
	font-style: italic;
	font-display: swap;
}

/* ========================================================================
   2. DESIGN TOKENS
   ======================================================================== */

:root {

	/* --- Colour: monochrome. Hierarchy comes from scale and weight,
	       never from hue. Red/green appear only as Woo system states. --- */
	--est-bg: #F8F8F7;
	--est-surface: #EFEFED;
	--est-ink: #131313;
	--est-ink-muted: #6A6A68;
	--est-accent: #131313;
	--est-line: #DFDEDB;

	/* --- Type families --- */
	--est-font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
	--est-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;

	/* --- Type scale: fluid, 360px → 1280px viewport.
	       Sections never override font-size per breakpoint. --- */
	--est-step--2: clamp(0.6875rem, 0.68rem + 0.05vw, 0.75rem);
	--est-step--1: clamp(0.8125rem, 0.79rem + 0.12vw, 0.875rem);
	--est-step-0:  clamp(1rem, 0.98rem + 0.11vw, 1.0625rem);
	--est-step-1:  clamp(1.1875rem, 1.11rem + 0.38vw, 1.4375rem);
	--est-step-2:  clamp(1.5rem, 1.3rem + 0.98vw, 2.125rem);
	--est-step-3:  clamp(2.125rem, 1.66rem + 2.28vw, 3.625rem);
	--est-step-4:  clamp(2.75rem, 1.83rem + 4.5vw, 5.625rem);

	/* --- Type detail --- */
	--est-tracking-display: -0.022em;
	--est-tracking-eyebrow: 0.14em;
	--est-leading-display: 1.06;
	--est-leading-body: 1.65;
	--est-measure: 64ch;

	/* --- Space: one scale, used everywhere --- */
	--est-space-2xs: 0.25rem;
	--est-space-xs: 0.5rem;
	--est-space-s: 0.75rem;
	--est-space-m: 1rem;
	--est-space-l: 1.5rem;
	--est-space-xl: 2.5rem;
	--est-space-2xl: 4rem;
	--est-space-3xl: 6rem;

	/* --- Layout --- */
	--est-container: 1280px;
	--est-container-narrow: 720px;
	--est-gutter: clamp(1rem, 4vw, 2.5rem);
	--est-section-block: clamp(3rem, 8vw, 6rem);
	--est-radius: 0;

	/* --- Motion: fabric, not UI bounce --- */
	--est-ease: cubic-bezier(0.22, 1, 0.36, 1);
	--est-dur: 400ms;
	--est-dur-fast: 200ms;
}

/* Breakpoints used throughout: 48em · 64em · 80em. Mobile-first only. */

/* ========================================================================
   3. RESET
   ======================================================================== */

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

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

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

ul[class],
ol[class] {
	margin: 0;
	padding: 0;
	list-style: none;
}

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

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

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

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

:target {
	scroll-margin-block: var(--est-space-2xl);
}

/* ========================================================================
   4. BASE TYPOGRAPHY
   ======================================================================== */

html {
	scroll-behavior: smooth;
}

body {
	background-color: var(--est-bg);
	color: var(--est-ink);
	font-family: var(--est-font-body);
	font-size: var(--est-step-0);
	font-weight: 400;
	line-height: var(--est-leading-body);
	font-optical-sizing: auto;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

h1, h2, h3 {
	font-family: var(--est-font-display);
	font-weight: 400;
	line-height: var(--est-leading-display);
	letter-spacing: var(--est-tracking-display);
	text-wrap: balance;
}

h1 { font-size: var(--est-step-3); }
h2 { font-size: var(--est-step-2); }
h3 { font-size: var(--est-step-1); }

/* h4–h6 are UI-level, not editorial — body face. */
h4, h5, h6 {
	font-family: var(--est-font-body);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0;
}

h4 { font-size: var(--est-step-0); }
h5,
h6 {
	font-size: var(--est-step--1);
	text-transform: uppercase;
	letter-spacing: var(--est-tracking-eyebrow);
	color: var(--est-ink-muted);
}

p {
	max-width: var(--est-measure);
	text-wrap: pretty;
}

p + p {
	margin-block-start: var(--est-space-m);
}

a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	text-decoration-color: var(--est-line);
	transition: text-decoration-color var(--est-dur-fast) var(--est-ease);
}

a:hover {
	text-decoration-color: currentColor;
}

strong,
b {
	font-weight: 500;
}

small {
	font-size: var(--est-step--1);
}

blockquote {
	font-family: var(--est-font-display);
	font-size: var(--est-step-1);
	font-style: italic;
	line-height: 1.35;
	max-width: 48ch;
}

hr {
	border: 0;
	border-block-start: 1px solid var(--est-line);
	margin-block: var(--est-space-xl);
}

::selection {
	background-color: var(--est-ink);
	color: var(--est-bg);
}

/* ========================================================================
   5. LAYOUT PRIMITIVES
   ======================================================================== */

.est-container {
	width: 100%;
	max-width: var(--est-container);
	margin-inline: auto;
	padding-inline: var(--est-gutter);
}

.est-container--narrow {
	max-width: var(--est-container-narrow);
}

.est-container--flush {
	padding-inline: 0;
}

/* Consistent vertical rhythm between sections. */
.est-section {
	padding-block: var(--est-section-block);
}

.est-section--tight {
	padding-block: calc(var(--est-section-block) / 2);
}

.est-section--surface {
	background-color: var(--est-surface);
}

/* Auto-fitting grid. minmax(0, …) stops wide children blowing out columns. */
.est-grid {
	display: grid;
	gap: var(--est-space-l);
}

.est-grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr)); }
.est-grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); }
.est-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); }

.est-stack > * + * {
	margin-block-start: var(--est-space-m);
}

.est-stack--l > * + * {
	margin-block-start: var(--est-space-l);
}

/* Editorial media — prevents CLS without needing width/height on every img. */
.est-media {
	position: relative;
	overflow: hidden;
	background-color: var(--est-surface);
}

.est-media > img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.est-media--portrait { aspect-ratio: 3 / 4; }
.est-media--square   { aspect-ratio: 1 / 1; }
.est-media--wide     { aspect-ratio: 16 / 9; }

/* ========================================================================
   6. SHARED COMPONENTS
   ======================================================================== */

/* --- Eyebrow label --- */
.est-eyebrow {
	display: block;
	font-family: var(--est-font-body);
	font-size: var(--est-step--1);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: var(--est-tracking-eyebrow);
	color: var(--est-ink-muted);
}

/* --- Buttons --- */
.est-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--est-space-xs);
	min-height: 3rem;
	padding-inline: var(--est-space-l);
	padding-block: var(--est-space-s);
	border: 1px solid var(--est-ink);
	border-radius: var(--est-radius);
	background-color: var(--est-ink);
	color: var(--est-bg);
	font-family: var(--est-font-body);
	font-size: var(--est-step--1);
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-decoration: none;
	text-align: center;
	transition:
		background-color var(--est-dur-fast) var(--est-ease),
		color var(--est-dur-fast) var(--est-ease);
}

.est-btn:hover {
	background-color: transparent;
	color: var(--est-ink);
}

.est-btn--ghost {
	background-color: transparent;
	color: var(--est-ink);
}

.est-btn--ghost:hover {
	background-color: var(--est-ink);
	color: var(--est-bg);
}

.est-btn--bare {
	min-height: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--est-ink);
	text-transform: none;
	letter-spacing: 0;
	border-block-end: 1px solid var(--est-line);
}

.est-btn--bare:hover {
	background: none;
	border-block-end-color: var(--est-ink);
}

.est-btn--full {
	width: 100%;
}

.est-btn[disabled],
.est-btn[aria-disabled='true'] {
	opacity: 0.45;
	cursor: not-allowed;
}

/* --- Form fields --- */
.est-field {
	display: block;
}

.est-label {
	display: block;
	margin-block-end: var(--est-space-2xs);
	font-size: var(--est-step--1);
	font-weight: 500;
}

.est-input,
.est-select,
.est-textarea {
	width: 100%;
	min-height: 3rem;
	padding: var(--est-space-s) var(--est-space-m);
	border: 1px solid var(--est-line);
	border-radius: var(--est-radius);
	background-color: transparent;
	font-size: var(--est-step-0);
	transition: border-color var(--est-dur-fast) var(--est-ease);
}

.est-textarea {
	min-height: 8rem;
	resize: vertical;
}

.est-input:hover,
.est-select:hover,
.est-textarea:hover {
	border-color: var(--est-ink-muted);
}

.est-input::placeholder,
.est-textarea::placeholder {
	color: var(--est-ink-muted);
	opacity: 1;
}

.est-hint {
	margin-block-start: var(--est-space-2xs);
	font-size: var(--est-step--1);
	color: var(--est-ink-muted);
}

/* --- Badge --- */
.est-badge {
	display: inline-block;
	padding: var(--est-space-2xs) var(--est-space-xs);
	border: 1px solid var(--est-ink);
	border-radius: var(--est-radius);
	font-size: var(--est-step--2);
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: var(--est-tracking-eyebrow);
	line-height: 1.4;
}

.est-badge--solid {
	background-color: var(--est-ink);
	color: var(--est-bg);
}

/* --- Breadcrumbs --- */
.est-breadcrumb {
	font-size: var(--est-step--1);
	color: var(--est-ink-muted);
}

.est-breadcrumb a {
	text-decoration: none;
}

.est-breadcrumb a:hover {
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

/* ========================================================================
   7. UTILITIES
   ======================================================================== */

.est-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.est-text-center { text-align: center; }
.est-text-muted  { color: var(--est-ink-muted); }
.est-measure     { max-width: var(--est-measure); }
.est-no-measure  { max-width: none; }

.est-mbs-0  { margin-block-start: 0; }
.est-mbs-m  { margin-block-start: var(--est-space-m); }
.est-mbs-l  { margin-block-start: var(--est-space-l); }
.est-mbs-xl { margin-block-start: var(--est-space-xl); }

/* Horizontal scroller for lookbook / product rows.
   Replaces a carousel library — see section 8 of PROJECT-STACK. */
.est-scroller {
	display: flex;
	gap: var(--est-space-m);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	padding-inline: var(--est-gutter);
	scroll-padding-inline-start: var(--est-gutter);
}

.est-scroller::-webkit-scrollbar {
	display: none;
}

.est-scroller > * {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

/* ========================================================================
   8. ACCESSIBILITY
   ======================================================================== */

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

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

.est-skip-link {
	position: absolute;
	inset-block-start: var(--est-space-xs);
	inset-inline-start: var(--est-space-xs);
	z-index: 999;
	padding: var(--est-space-s) var(--est-space-m);
	background-color: var(--est-ink);
	color: var(--est-bg);
	font-size: var(--est-step--1);
	font-weight: 500;
	text-decoration: none;
	transform: translateY(-200%);
	transition: transform var(--est-dur-fast) var(--est-ease);
}

.est-skip-link:focus {
	transform: translateY(0);
}

@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;
	}
}
button,
a,
[role='button'] {
	-webkit-tap-highlight-color: transparent;
}