/* ---------------------------------------------------------------
   moiki-presskit — page chrome (v2)
   --------------------------------------------------------------- */

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16.5px;
  font-feature-settings: 'kern','liga','calt';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 100% 0%, var(--accent-tint) 0%, transparent 60%),
    radial-gradient(ellipse 40% 30% at 0% 30%, color-mix(in srgb, var(--accent) 6%, transparent) 0%, transparent 70%);
  background-attachment: fixed;
  background-repeat: no-repeat;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  inset-inline-start: var(--sp-3);
  inset-block-start: var(--sp-3);
  background: var(--fg);
  color: var(--bg);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: var(--fz-1);
  letter-spacing: var(--tracking-wide);
  transform: translateY(-200%);
  transition: transform 200ms var(--easing-emph);
  z-index: 100;
  text-decoration: none;
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- Header ---------- */
.page__header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
}
.page__header-inner {
  max-width: var(--container);
  margin-inline: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-4) var(--gutter);
}

/* ---------- Brand mark ---------- */
.brand {
  /* Fix K: align all brand parts on the centre line (mark, name, kicker)
     instead of mixing baseline vs centre across spans of different sizes. */
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 32px;
  text-decoration: none;
  color: var(--fg);
  white-space: nowrap;
  min-width: 0;
  line-height: 1;
}
.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--rule);
  transition: transform 220ms var(--easing-emph),
              box-shadow 220ms var(--easing-standard);
}
.brand__mark .brand-mark-svg {
  width: 22px;
  height: 22px;
  display: block;
}
.brand:hover .brand__mark {
  transform: rotate(-8deg) scale(1.04);
  box-shadow: 0 0 0 1px var(--rule-strong);
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--fz-3);
  letter-spacing: var(--tracking-display);
  line-height: 1;
  font-variation-settings: 'opsz' 24;
}
.brand__sep {
  color: var(--fg-faint);
  margin-inline: var(--sp-1);
  line-height: 1;
}
.brand__kicker {
  color: var(--fg-muted);
  font-size: var(--fz-1);
  line-height: 1;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  font-weight: 600;
}

@media (max-width: 520px) {
  .brand__sep, .brand__kicker { display: none; }
}

/* ---------- Main ---------- */
.page__main {
  flex: 1;
  max-width: var(--container);
  width: 100%;
  margin-inline: auto;
  padding: var(--sp-8) var(--gutter) var(--sp-9);
  display: flex;
  flex-direction: column;
  gap: var(--sp-9);
}

@media (max-width: 640px) {
  .page__main { padding-block-start: var(--sp-6); gap: var(--sp-8); }
}

/* ---------- Footer ---------- */
.page__footer {
  border-top: 1px solid var(--rule);
  margin-block-start: var(--sp-7);
}
.page__footer-inner {
  max-width: var(--container);
  margin-inline: auto;
  padding: var(--sp-6) var(--gutter);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.page__footer-line {
  color: var(--fg-muted);
  font-size: var(--fz-1);
}
.page__footer-line--muted {
  color: var(--fg-faint);
}
.page__footer a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  text-decoration-color: var(--rule-strong);
  transition: text-decoration-color 120ms var(--easing-standard);
}
.page__footer a:hover {
  text-decoration-color: var(--accent);
  color: var(--fg);
}

/* ---------- Header tools wrapper (lang switcher + theme toggle) ---------- */
.page__header-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--bg-elev);
  color: var(--fg-muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1;
  transition: background-color 160ms var(--easing-standard),
              border-color 160ms var(--easing-standard),
              color 160ms var(--easing-standard),
              transform 220ms var(--easing-emph);
}
.theme-toggle:hover {
  color: var(--fg);
  border-color: var(--rule-strong);
  transform: rotate(-12deg);
}
.theme-toggle:focus-visible { outline-offset: 2px; }
.theme-toggle[data-mode='light'] {
  color: #c2710d;
  border-color: color-mix(in srgb, #ffb04a 35%, var(--rule));
}
.theme-toggle[data-mode='dark'] {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, var(--rule));
}
.theme-toggle__icon {
  display: inline-block;
  font-weight: 700;
}

/* ---------- Language switcher (pill segmented control) ---------- */
.lang-switcher__list {
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 3px;
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  background: var(--bg-elev);
  font-size: var(--fz-1);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
}
.lang-switcher__item {
  display: inline-flex;
}
.lang-switcher__current,
.lang-switcher__link {
  display: inline-flex;
  align-items: center;
  padding: 0.4em 0.85em;
  border-radius: var(--r-pill);
  text-decoration: none;
  transition: background-color 200ms var(--easing-standard),
              color 200ms var(--easing-standard);
  text-transform: uppercase;
  font-size: var(--fz-0);
  letter-spacing: var(--tracking-wider);
}
.lang-switcher__current {
  background: var(--fg);
  color: var(--bg);
}
.lang-switcher__link {
  color: var(--fg-muted);
}
.lang-switcher__link:hover {
  color: var(--fg);
  background: var(--rule);
}

/* ---------- Focus styles ---------- */
:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 6px;
}
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
  outline-offset: 4px;
}
