/* Resolved appearance is independent of the selected public design and layout.
   The early appearance script resolves System before the first stylesheet paints. */
html[data-appearance-surface='website'][data-color-mode='light'] {
  color-scheme: light;
  --background: #F0F3EA;
  --surface: #FBFCF7;
  --surface-elevated: #FFFFFF;
  --accent: #E3EBDC;
  --text-primary: #1B3022;
  --text-secondary: #4B6251;
  --text-muted: #4B6251;
  --text: #1B3022;
  --border: #B8C9B6;
  --border-light: #D8E2D2;
  --primary: #83651F;
  --primary-dark: #624611;
  --primary-deep: #49350D;
  --primary-light: #E8D7AE;
  --primary-contrast: #FBFCF7;
  --secondary: #4B6251;
  --secondary-dark: #35463B;
  --success: #267346;
  --warning: #8C5A0D;
  --error: #AE302B;
  --info: #215BA0;
  --guld-ink: #F0F3EA;
  --guld-ink-raised: #FBFCF7;
  --guld-ink-panel: #E3EBDC;
  --guld-paper: #1B3022;
  --guld-muted: #4B6251;
  --guld-subtle: #4B6251;
  --guld-line: #B8C9B6;
  --guld-line-soft: #D8E2D2;
  --guld-gold: #83651F;
  --guld-gold-hover: #624611;
  --appearance-hero-accent: #D3B66F;
  --appearance-header: #E7EEDF;
  --appearance-input: #F4F7EE;
  --appearance-input-border: #7C9279;
  --appearance-card: #FFFFFF;
  --appearance-action-background: #D3B66F;
  --appearance-action-hover: #E0C889;
  --appearance-action-text: #14231C;
  --appearance-control-scheme: light;
}

html[data-appearance-surface='website'][data-color-mode='dark'] {
  color-scheme: dark;
  --background: #14231C;
  --surface: #243C2D;
  --surface-elevated: #2D4936;
  --accent: #243C2D;
  --text-primary: #F3F0E7;
  --text-secondary: #C3CFC0;
  --text-muted: #AFBFAA;
  --text: #F3F0E7;
  --border: #536F58;
  --border-light: #385443;
  --primary: #D3B66F;
  --primary-dark: #E0C889;
  --primary-deep: #14231C;
  --primary-light: #E0C889;
  --primary-contrast: #14231C;
  --secondary: #AFBFAA;
  --secondary-dark: #C3CFC0;
  --success: #6FBF8E;
  --warning: #E2B04A;
  --error: #EE8A7A;
  --info: #8DB8F0;
  --guld-ink: #14231C;
  --guld-ink-raised: #243C2D;
  --guld-ink-panel: #2D4936;
  --guld-paper: #F3F0E7;
  --guld-muted: #C3CFC0;
  --guld-subtle: #AFBFAA;
  --guld-line: #536F58;
  --guld-line-soft: #385443;
  --guld-gold: #D3B66F;
  --guld-gold-hover: #E0C889;
  --appearance-hero-accent: #D3B66F;
  --appearance-header: #1B2D23;
  --appearance-input: #192D22;
  --appearance-input-border: #71896F;
  --appearance-card: #2D4936;
  --appearance-action-background: #D3B66F;
  --appearance-action-hover: #E0C889;
  --appearance-action-text: #14231C;
  --appearance-control-scheme: dark;
}

/* Keep the forest alternative's accent identity in either appearance. */
html[data-appearance-surface='website'][data-design='golden-cottages-forest-test-v1'][data-color-mode='light'],
html[data-appearance-surface='website'][data-design='adelfors-stugor-a-v1'][data-color-mode='light'] {
  --primary: #1A3A2E;
  --primary-dark: #2D5243;
  --primary-deep: #173326;
  --primary-light: #DFE9DC;
}
html[data-appearance-surface='website'][data-design='golden-cottages-forest-test-v1'][data-color-mode='dark'] {
  --primary: #ADD3AB;
  --primary-dark: #C7E5C3;
  --primary-light: #C7E5C3;
}

/* These aliases deliberately outrank source design and OS media-query tokens. */
html[data-appearance-surface='website'][data-color-mode] {
  --sand: var(--background);
  --sand-deep: var(--accent);
  --cream: var(--surface);
  --ink: var(--text-primary);
  --muted: var(--text-muted);
  --forest: var(--primary);
  --forest-hover: var(--primary-dark);
  --gold: var(--guld-gold);
  --line: var(--border);
  --bg: var(--background);
}
html[data-appearance-surface='website'][data-color-mode] body {
  color-scheme: var(--appearance-control-scheme);
  background: var(--background);
  color: var(--text-primary);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site {
  /* The A adapter aliases these back to --ink/--forest. Inherit the root values
     first to avoid a circular alias when the appearance maps them below. */
  --background: inherit;
  --surface: inherit;
  --text-primary: inherit;
  --text-secondary: inherit;
  --text-muted: inherit;
  --border: inherit;
  --primary: inherit;
  --primary-dark: inherit;
  --primary-contrast: inherit;
  --sand: var(--background);
  --sand-deep: var(--accent);
  --cream: var(--surface);
  --ink: var(--text-primary);
  --muted: var(--text-muted);
  --forest: var(--primary);
  --forest-hover: var(--primary-dark);
  --gold: var(--guld-gold);
  --line: var(--border);
  --red: var(--primary);
  --blue: var(--accent);
  --white: var(--surface);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(input, select, textarea) {
  color-scheme: var(--appearance-control-scheme);
}
html[data-appearance-surface='website'][data-color-mode] :is(input, select, textarea, button) {
  accent-color: var(--primary);
}
html[data-appearance-surface='website'][data-color-mode] :is(input, textarea)::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

/* Navigation, footer and secondary actions have source colors outside tokens. */
html[data-appearance-surface='website'][data-color-mode] :is(.header, .site-header) {
  background: var(--appearance-header);
  color: var(--text-primary);
  border-color: var(--border-light);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.button.secondary, .btn--outline) {
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.button.secondary, .btn--outline):hover {
  color: var(--primary);
  border-color: var(--primary);
}
html[data-appearance-surface='website'][data-color-mode] :is(.site-footer, .footer) {
  color: var(--text-secondary);
  background: var(--background);
  border-color: var(--border-light);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.footer-brand p, .footer-column a, .footer-bottom),
html[data-appearance-surface='website'][data-color-mode] .footer :is(.footer__text, .footer__link, .footer__bottom) {
  color: var(--text-secondary);
  border-color: var(--border-light);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .site-footer .brand {
  color: var(--text-primary);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .footer-column h2 {
  color: var(--gold);
}

/* Tannenwald uses flat, distinct green surfaces and warm gold actions. */
html[data-appearance-surface='website'][data-color-mode] body.guest-site .site-header
  :is(.owner-nav--mobile.is-open, .nav__submenu) {
  background: var(--appearance-header);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .stay-search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: none;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site
  :is(.stay-search, .form-stack, .owner-booking, .owner-fields) :is(input, select, textarea, .stay-date-picker__trigger) {
  background: var(--appearance-input);
  color: var(--text-primary);
  border: 1px solid var(--appearance-input-border);
  border-radius: 4px;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .stay-search :is(input, select) {
  padding-inline: .6rem;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site
  :is(.button.primary, .btn--primary, .navigation-menu__control--button, .privacy-dialog .button:not(.secondary)) {
  background: var(--appearance-action-background);
  color: var(--appearance-action-text);
  border-color: var(--appearance-action-background);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site
  :is(.button.primary, .btn--primary, .navigation-menu__control--button, .privacy-dialog .button:not(.secondary)):hover {
  background: var(--appearance-action-hover);
  color: var(--appearance-action-text);
  border-color: var(--appearance-action-hover);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .guld-house {
  padding: clamp(1rem, 2vw, 1.4rem);
  background: var(--appearance-card);
  border: 1px solid var(--border);
  border-radius: 14px;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .guld-house__media {
  border-radius: 8px;
}

/* Photo captions stay light in either mode; layout A uses text on its card photo. */
html[data-appearance-surface='website'][data-color-mode] body.guest-site .adelfors-layout .cottage-body
  :is(h3, h3 a, .amenities, .cottage-description, .location, .card-footer a) {
  color: #F5F0E6;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .adelfors-layout .cottage-body .card-footer {
  border-color: rgb(245 240 230 / .35);
}
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site .cottage-price {
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--gold);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .guld-hero .guld-hero__title {
  color: #F3F0E7;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .guld-hero :is(.guld-eyebrow, .guld-hero__title em, .guld-hero__brand-accent) {
  color: var(--appearance-hero-accent);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .guld-hero .guld-hero__lead {
  color: #F3F0E7;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.guld-hero, .owner-hero:has(.owner-hero-gallery)) :is(.button.primary, .btn--primary) {
  background: var(--appearance-action-background);
  color: var(--appearance-action-text);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.guld-hero, .owner-hero:has(.owner-hero-gallery)) :is(.button.primary, .btn--primary):hover {
  background: var(--appearance-action-hover);
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.guld-hero, .owner-hero:has(.owner-hero-gallery)) .button.secondary {
  color: #F4F0E6;
  border-color: rgb(244 240 230 / .7);
}
/* The search has its own surface, both over the hero photograph and in the compact bar below it. */
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.guld-hero .stay-search, .guld-hero--compact-search ~ .stay-search) .button.secondary {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: transparent;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site :is(.guld-hero .stay-search, .guld-hero--compact-search ~ .stay-search) .button.secondary:is(:hover, :focus-visible) {
  color: var(--primary);
  border-color: var(--primary);
  background: transparent;
}
html[data-appearance-surface='website'][data-color-mode] body.guest-site .owner-hero:has(.owner-hero-gallery) :is(.hero__title, .hero__subtitle) {
  color: #F4F0E6;
}
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site .guld-hero__media::after {
  background: linear-gradient(90deg, rgb(10 14 12 / .42) 0%, rgb(10 14 12 / .18) 45%, rgb(10 14 12 / 0) 75%), linear-gradient(180deg, rgb(10 14 12 / .28), rgb(10 14 12 / .54));
}
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site .guld-hero--video-playing .guld-hero__media::after {
  background: linear-gradient(90deg, rgb(10 14 12 / .5) 0%, rgb(10 14 12 / .25) 45%, rgb(10 14 12 / 0) 75%), linear-gradient(180deg, rgb(10 14 12 / .12), rgb(10 14 12 / .3));
}
/* Light mode keeps a darker gold (#83651F, at least 4.5:1) for text on light
   surfaces. Photos and films always get the light hero gold, also for lines
   and accents; the search panel on the hero keeps its light surface gold
   (decision of 7 November 2026). */
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site :is(.guld-hero, .owner-hero:has(.owner-hero-gallery), .adelfors-layout .cottage-body) {
  --gold: var(--appearance-hero-accent);
  --guld-gold: var(--appearance-hero-accent);
}
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site .guld-hero .stay-search {
  --gold: var(--primary);
  --guld-gold: var(--primary);
}
/* Gold text marks inside the hero sit on a photo or film, so they use the
   light hero gold in both colour modes (decision of 7 November 2026). */
html[data-appearance-surface='website'][data-color-mode] body.guest-site .guld-hero span.website-text-color-gold {
  color: var(--appearance-hero-accent);
}
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site .intro-photo img {
  filter: none;
}
html[data-appearance-surface='website'][data-color-mode='light'] body.guest-site .guld-story--light {
  background: var(--accent);
}

/* Forms, booking wizard, media viewers and alternate activity page compositions. */
/* Whole slider pictures keep their dominant colour beside them (ambient-image-color.mjs). */
html[data-appearance-surface='website'][data-color-mode] .media-main img {
  background: var(--media-ambient-color, var(--surface));
}
html[data-appearance-surface='website'][data-color-mode] :is(.media-card-copy, .media-layout-select select, .media-detail-dialog, .activity-gallery .media-detail-dialog.activity-detail-dialog) {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] :is(.activities-page, .activities-two-page, .activities-two-hero) {
  background: var(--background);
  color: var(--text-primary);
}
html[data-appearance-surface='website'][data-color-mode] :is(.activities-two-card, .activities-two-card:nth-child(2), .activities-two-card__gallery, .activity-card__gallery, .activities-two-card__collection) {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] .activity-card > .activity-card__collection {
  background: var(--surface) !important;
}
html[data-appearance-surface='website'][data-color-mode] :is(.activities-two-hero h1, .activities-two-catalogue__heading h2, .activities-two-card h2) {
  color: var(--text-primary);
}
html[data-appearance-surface='website'][data-color-mode] :is(.activities-two-hero h1 + p, .activities-two-card > p:not(.activities-two-card__category), .activities-two-card__body > p, .activities-two-card__summary, .activities-two-card__source, .activities-two-card__route-pending) {
  color: var(--text-secondary);
}
html[data-appearance-surface='website'][data-color-mode] :is(.activities-two-hero__eyebrow, .activities-two-card__category, .activity-card__meta) {
  color: var(--primary);
}
html[data-appearance-surface='website'][data-color-mode] :is(.activities-two-catalogue__note, .activities-two-card__distance, .activities-two-card__hours) {
  color: var(--text-muted) !important;
}
html[data-appearance-surface='website'][data-color-mode] .activities-two-catalogue__grid {
  background: var(--border);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] .owner-alert[data-error] {
  color: var(--error);
}

/* Editor overlays retain glass geometry but inherit the chosen appearance. */
html[data-appearance-surface='website'][data-color-mode] .website-edit-enabled {
  --website-edit-surface: color-mix(in srgb, var(--surface) 90%, transparent);
  --website-edit-control: color-mix(in srgb, var(--surface-elevated) 92%, transparent);
  --website-edit-control-hover: color-mix(in srgb, var(--primary) 16%, var(--surface));
  --website-edit-ink: var(--text-primary);
}
html[data-appearance-surface='website'][data-color-mode] .website-edit-enabled
  :is(.website-edit-image-menu, .website-edit-toolbar, .website-edit-dialog, .website-edit-collection-preview, .website-edit-layout-dialog) {
  --guld-paper: inherit;
  --guld-muted: inherit;
  --guld-subtle: inherit;
  --surface: var(--guld-ink-raised);
  --surface-elevated: var(--guld-ink-panel);
  --text: var(--guld-paper);
  --text-primary: var(--guld-paper);
  --text-secondary: var(--guld-muted);
  --text-muted: var(--guld-subtle);
  --ink: var(--guld-paper);
  --muted: var(--guld-subtle);
  --line: var(--guld-line);
  --border: var(--guld-line);
  --website-edit-ink: var(--guld-paper);
  --website-edit-readable-surface: var(--guld-ink-raised);
  --website-edit-readable-ink: var(--guld-paper);
  color-scheme: var(--appearance-control-scheme);
  background: var(--website-edit-surface);
  color: var(--website-edit-ink);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] .website-edit-enabled
  :is(.website-edit-dialog, .website-edit-layout-dialog) :is(input:not([type=checkbox]):not([type=radio]), textarea, select) {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] :is(.website-edit-toolbar small, .website-image-picker__help, .website-edit-collection-toolbar [data-edit-collection-layout-scope], .website-text-mini-editor__help, .website-text-mini-editor__format-label) {
  color: var(--text-secondary);
}
html[data-appearance-surface='website'][data-color-mode] .website-text-mini-editor__surface {
  --guld-paper: inherit;
  --guld-muted: inherit;
  --secondary: var(--guld-muted);
  --secondary-dark: var(--guld-gold);
  --text: var(--guld-paper);
  --text-primary: var(--guld-paper);
  --text-secondary: var(--guld-muted);
  --ink: var(--guld-paper);
  background: var(--guld-ink-raised);
  color: var(--guld-paper);
  border-color: var(--guld-line);
}
html[data-appearance-surface='website'][data-color-mode] #website-edit-dialog
  :is(.website-text-mini-editor__toolbar, .website-text-mini-editor__help, .website-text-mini-editor__toolbar label, .website-text-mini-editor__format-label, .website-image-picker__help) {
  background: var(--surface);
  color: var(--text-secondary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] #website-edit-dialog button {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] #website-edit-dialog
  :is(button[data-edit-submit], button[aria-pressed=true]) {
  background: var(--primary);
  color: var(--primary-contrast);
  border-color: var(--primary);
}
html[data-appearance-surface='website'][data-color-mode] #website-edit-dialog button:is(:hover,:focus-visible) {
  background: color-mix(in srgb, var(--primary) 18%, var(--surface));
  color: var(--text-primary);
}
html[data-appearance-surface='website'][data-color-mode]
  :is(.website-edit-progress, .website-image-picker__comparison figure, .website-image-picker__source, .website-edit-provider-status, .website-edit-dialog .website-edit-mode) {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] .website-edit-progress select {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}
html[data-appearance-surface='website'][data-color-mode] .website-edit-progress--complete {
  color: var(--success);
  border-color: var(--success);
}
html[data-appearance-surface='website'][data-color-mode]
  :is(.website-edit-progress--error, .website-edit-provider-status--error, .website-edit-dialog__warning) {
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
  color: var(--warning);
  border-color: var(--warning);
}
