/**
 * Meridian – base: design tokens (light/dark), reset, typography, forms, buttons.
 *
 * Brand values (--m-primary, --m-accent, --m-radius, --m-container) come from
 * the theme settings as an inline style "html:root{…}" and override these
 * defaults. Visitor color presets (html[data-accent]) override both.
 */

:root {
  --m-primary: #0f4c81;
  --m-accent: #e63946;
  --m-radius: 14px;
  --m-container: 1240px;
  --m-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --m-font-head: var(--m-font);
  --m-side-w: 272px;
  --m-ease: cubic-bezier(.2, .7, .2, 1);
  --m-speed: .25s;

  /* Light mode */
  color-scheme: light;
  --m-bg: #eef2f7;
  --m-surface: #ffffff;
  --m-surface-2: #f5f7fb;
  --m-text: #172230;
  --m-muted: #5c6878;
  --m-border: #e0e6ee;
  --m-shadow-sm: 0 1px 2px rgb(16 24 40 / .06);
  --m-shadow: 0 1px 2px rgb(16 24 40 / .05), 0 10px 30px -10px rgb(16 24 40 / .18);
  --m-link: var(--m-primary);
  --m-on-primary: #fff;
  --m-primary-soft: color-mix(in srgb, var(--m-primary) 10%, var(--m-surface));
  --m-accent-soft: color-mix(in srgb, var(--m-accent) 12%, var(--m-surface));
  --m-footer-bg: color-mix(in srgb, var(--m-primary) 88%, #000);
  --m-footer-text: #dfe7f1;
}

/* Visitor color presets (only active when chosen in the settings panel). */
html[data-accent="ocean"] { --m-primary: #0f4c81; --m-accent: #00a6d6; }
html[data-accent="lagoon"] { --m-primary: #006d77; --m-accent: #2ec4b6; }
html[data-accent="coral"] { --m-primary: #9b2226; --m-accent: #ee6c4d; }
html[data-accent="violet"] { --m-primary: #4c3a9e; --m-accent: #c0399f; }
html[data-accent="forest"] { --m-primary: #2d6a4f; --m-accent: #e9a03b; }

/* Dark mode: explicit, or following the operating system in "auto". */
html[data-mode="dark"] {
  color-scheme: dark;
  --m-bg: #0a1018;
  --m-surface: #111a25;
  --m-surface-2: #172331;
  --m-text: #e3eaf3;
  --m-muted: #97a6b8;
  --m-border: #233244;
  --m-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --m-shadow: 0 1px 2px rgb(0 0 0 / .35), 0 12px 32px -12px rgb(0 0 0 / .6);
  --m-link: color-mix(in srgb, var(--m-primary) 45%, #ffffff);
  --m-primary-soft: color-mix(in srgb, var(--m-primary) 30%, var(--m-surface));
  --m-accent-soft: color-mix(in srgb, var(--m-accent) 22%, var(--m-surface));
  --m-footer-bg: #070c12;
  --m-footer-text: #c9d4e2;
}
@media (prefers-color-scheme: dark) {
  html[data-mode="auto"] {
    color-scheme: dark;
    --m-bg: #0a1018;
    --m-surface: #111a25;
    --m-surface-2: #172331;
    --m-text: #e3eaf3;
    --m-muted: #97a6b8;
    --m-border: #233244;
    --m-shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --m-shadow: 0 1px 2px rgb(0 0 0 / .35), 0 12px 32px -12px rgb(0 0 0 / .6);
    --m-link: color-mix(in srgb, var(--m-primary) 45%, #ffffff);
    --m-primary-soft: color-mix(in srgb, var(--m-primary) 30%, var(--m-surface));
    --m-accent-soft: color-mix(in srgb, var(--m-accent) 22%, var(--m-surface));
    --m-footer-bg: #070c12;
    --m-footer-text: #c9d4e2;
  }
}

/* Font size preference. */
html { font-size: 100%; }
html[data-font="large"] { font-size: 112.5%; }
html[data-font="xlarge"] { font-size: 125%; }

/* Reduced motion: system setting or visitor preference. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
html[data-motion="reduced"] { scroll-behavior: auto; }

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 6rem; }
body {
  margin: 0;
  font-family: var(--m-font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--m-text);
  background: var(--m-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--m-speed), color var(--m-speed);
}
img, svg, video, canvas { vertical-align: middle; }
img { max-width: 100%; height: auto; }
iframe { max-width: 100%; border: 0; }
figure { margin: 0 0 1.25rem; }

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--m-font-head);
  line-height: 1.25;
  letter-spacing: -.012em;
  margin: 1.6em 0 .6em;
  font-weight: 700;
  text-wrap: balance;
}
h1 { font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem); margin-top: .2em; letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 1.1rem + .9vw, 1.8rem); }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
p, ul, ol, dl, table, pre, blockquote { margin: 0 0 1.1em; }
p { text-wrap: pretty; }
ul, ol { padding-left: 1.4em; }
small, .m-small { font-size: .875rem; }
hr { border: 0; border-top: 1px solid var(--m-border); margin: 2rem 0; }
blockquote {
  margin-inline: 0;
  padding: .8rem 1.2rem;
  border-left: 4px solid var(--m-accent);
  background: var(--m-surface-2);
  border-radius: 0 var(--m-radius) var(--m-radius) 0;
}
code, pre, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; }
pre { padding: 1rem; overflow: auto; background: var(--m-surface-2); border-radius: 10px; }

a {
  color: var(--m-link);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
  transition: color var(--m-speed);
}
a:hover { color: var(--m-accent); }
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--m-accent) 70%, transparent);
  outline-offset: 2px;
  border-radius: 6px;
}
::selection { background: color-mix(in srgb, var(--m-accent) 30%, transparent); }

/* Tables */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .95rem; }
th, td { padding: .7rem .85rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--m-border); }
thead th {
  background: var(--m-surface-2);
  font-weight: 650;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--m-muted);
  border-bottom: 2px solid var(--m-border);
}
thead th a { color: inherit; text-decoration: none; }
tbody tr { transition: background-color .15s; }
tbody tr:hover { background: var(--m-primary-soft); }
@media (max-width: 720px) {
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
}

/* Forms */
.form-item, .form-actions { margin: 0 0 1.1rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
label, legend, .fieldset__label { font-weight: 600; display: block; margin-bottom: .3rem; }
.form-type-checkbox label, .form-type-radio label, .option { display: inline; font-weight: 500; margin: 0 0 0 .35rem; }
.form-required::after { content: " *"; color: var(--m-accent); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="url"], input[type="tel"], input[type="number"], input[type="date"], input[type="time"],
select, textarea {
  font: inherit;
  color: var(--m-text);
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: 10px;
  padding: .6rem .8rem;
  max-width: 100%;
  min-height: 2.75rem;
  transition: border-color var(--m-speed), box-shadow var(--m-speed);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--m-primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--m-primary) 18%, transparent);
}
textarea { width: 100%; min-height: 8rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--m-primary); width: 1.1rem; height: 1.1rem; }
.description, .form-item__description { color: var(--m-muted); font-size: .875rem; margin-top: .3rem; }
fieldset { border: 1px solid var(--m-border); border-radius: var(--m-radius); padding: 1rem 1.25rem; margin: 0 0 1.25rem; }
.form-item--error-message, .form-item .error { color: var(--m-accent); }
input.error, select.error, textarea.error { border-color: var(--m-accent); }

/* Password field with show/hide button (added by meridian.js). The button
   sits on the input row; content added by core (strength meter) flows below. */
.m-pw { position: relative; display: block; max-width: 100%; }
.m-pw > input { width: 100%; max-width: 28rem; padding-right: 3rem; }
.m-pw__toggle {
  position: absolute;
  top: 0;
  left: min(calc(100% - 2.75rem), calc(28rem - 2.75rem));
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 0 10px 10px 0;
  background: transparent;
  color: var(--m-muted);
  cursor: pointer;
}
.m-pw__toggle:hover { color: var(--m-link); }
.m-pw__eye-off { display: none; }
.m-pw.is-visible .m-pw__eye { display: none; }
.m-pw.is-visible .m-pw__eye-off { display: inline; }
.m-pw.is-visible > input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .03em; }

/* Login / PIN forms: compact centered card. */
.path-user .m-main form.user-login-form,
.path-user .m-main form.user-pass,
.path-user .m-main form.user-register-form,
.path-login-guard .m-main form.login-guard-pin-form {
  max-width: 32rem;
  padding: 1.5rem 1.75rem;
  background: var(--m-surface);
  border: 1px solid var(--m-border);
  border-radius: var(--m-radius);
  box-shadow: var(--m-shadow-sm);
}
.login-guard-pin {
  font-size: 1.6rem !important;
  letter-spacing: .4em;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  max-width: 14rem;
}
/* CAPTCHA */
.captcha { margin: 1.25rem 0; padding: 1rem; border: 1px dashed var(--m-border); border-radius: var(--m-radius); background: var(--m-surface-2); }
.captcha img { border-radius: 8px; background: #fff; }
.captcha .details-wrapper, .captcha__element { display: grid; gap: .6rem; }

/* Buttons */
.button, .m-btn,
input[type="submit"], input[type="button"], input[type="reset"], button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.75rem;
  padding: .55rem 1.25rem;
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  color: var(--m-on-primary);
  background: var(--m-primary);
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--m-speed) var(--m-ease), box-shadow var(--m-speed), background-color var(--m-speed), color var(--m-speed);
}
.button:hover, .m-btn:hover,
input[type="submit"]:hover, input[type="button"]:hover, button.button:hover {
  color: var(--m-on-primary);
  background: color-mix(in srgb, var(--m-primary) 85%, #fff);
  transform: translateY(-1px);
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--m-primary) 70%, transparent);
}
.m-btn--accent, .button--primary { background: var(--m-accent); }
.m-btn--accent:hover, .button--primary:hover { background: color-mix(in srgb, var(--m-accent) 85%, #fff); box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--m-accent) 70%, transparent); }
.m-btn--ghost, .button--secondary {
  background: transparent;
  color: var(--m-text);
  border-color: var(--m-border);
}
.m-btn--ghost:hover, .button--secondary:hover { background: var(--m-primary-soft); color: var(--m-link); box-shadow: none; }
input[type="submit"].button--secondary, button.button--secondary { background: transparent; color: var(--m-text); border-color: var(--m-border); }
input[type="submit"].button--secondary:hover, button.button--secondary:hover { background: var(--m-primary-soft); color: var(--m-link); box-shadow: none; }
.messages__list { margin: 0; padding-left: 1.1rem; }
.button--danger { background: #c62828; }
.m-btn--sm { min-height: 2.35rem; padding: .4rem .95rem; font-size: .9rem; }
.button:disabled, input[type="submit"]:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.m-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--m-border);
  border-radius: 999px;
  background: var(--m-surface);
  color: var(--m-text);
  cursor: pointer;
  transition: background-color var(--m-speed), color var(--m-speed), border-color var(--m-speed), transform var(--m-speed);
}
.m-icon-btn:hover { background: var(--m-primary-soft); color: var(--m-link); border-color: color-mix(in srgb, var(--m-primary) 30%, var(--m-border)); }

/* Status messages */
.messages, [data-drupal-messages] > div > div {
  position: relative;
  padding: .9rem 1.1rem .9rem 3rem;
  margin: 0 0 1rem;
  border-radius: var(--m-radius);
  border: 1px solid var(--m-border);
  background: var(--m-surface);
  box-shadow: var(--m-shadow-sm);
}
.messages::before {
  content: "";
  position: absolute;
  left: 1.1rem;
  top: 1.15rem;
  width: .9rem;
  height: .9rem;
  border-radius: 50%;
  background: #2e9e5b;
  box-shadow: 0 0 0 4px color-mix(in srgb, #2e9e5b 20%, transparent);
}
.messages--warning::before { background: #e3a008; box-shadow: 0 0 0 4px color-mix(in srgb, #e3a008 22%, transparent); }
.messages--error::before { background: #d93025; box-shadow: 0 0 0 4px color-mix(in srgb, #d93025 20%, transparent); }
.messages--error { border-color: color-mix(in srgb, #d93025 35%, var(--m-border)); }
.messages a { font-weight: 600; }

/* Accessibility helpers (complements core's system/base). */
.skip-link.focusable:focus {
  position: fixed !important;
  top: .75rem;
  left: .75rem;
  z-index: 1000;
  width: auto;
  height: auto;
  clip: auto;
  padding: .6rem 1rem;
  background: var(--m-accent);
  color: #fff;
  border-radius: 999px;
}

/* Print */
@media print {
  .m-header__tools, .m-nav, .m-hero, .m-top, .m-prefs, .m-overlay, .m-footer__cols { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
}
