/* Shared Editorial Foundation — median.bechou.dev (Landing + All Subpages)
 * Zero resting shadows, zero glass blur, zero gradients, flat stepped tonal surfaces.
 */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-body);
  font-weight: 400;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color var(--dur-short) var(--ease-out), color var(--dur-short) var(--ease-out);
}

::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.04;
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: var(--step-display); line-height: 0.98; letter-spacing: -0.035em; }
h2 { font-size: var(--step-head); line-height: 1.06; }
h3 { font-size: var(--step-lead); line-height: 1.2; letter-spacing: -0.02em; }
h4 { font-size: var(--step-body); font-weight: 600; }

p { margin: 0; text-wrap: pretty; }
a { color: inherit; text-underline-offset: 0.2em; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.92em; } /* taste-skill-ignore */

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

.num { font-variant-numeric: tabular-nums; }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink); }

/* Thin top scroll progress indicator */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 95;
  pointer-events: none;
}
.scroll-progress__bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  will-change: transform;
}

/* Plain Architectural Header (Flat ground, zero glass blur, crisp spacing) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 70;
  background: var(--bg);
  transition: background-color var(--dur-short) var(--ease-out);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 72px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--step-lead);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--ink);
  flex-shrink: 0;
}
.brand img { width: 28px; height: 28px; border-radius: 6px; }

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-desktop a {
  text-decoration: none;
  font-size: var(--step-small);
  font-weight: 500;
  color: var(--muted);
  padding: 6px 0;
  position: relative;
  transition: color var(--dur-micro) var(--ease-out);
}
.nav-desktop a:hover,
.nav-desktop a[aria-current="page"] {
  color: var(--ink);
}
.nav-desktop a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Circular icon & language trigger buttons (matching user preference for circular VN flag button) */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(0); }
.icon-btn svg { width: 17px; height: 17px; }
html[data-theme="dark"] .icon-sun { display: block; }
html[data-theme="dark"] .icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

/* Circular Flag + 2-Letter Code Language Switcher */
.lang-picker { position: relative; }
.lang-trigger {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  border: 0;
  background: var(--surface);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.lang-trigger:hover,
.lang-trigger[aria-expanded="true"] {
  background: var(--surface-2);
  transform: translateY(-1px);
}
.lang-trigger__flag {
  width: 16px;
  height: 11px;
  border-radius: 2px;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.lang-trigger__flag svg { width: 16px; height: 11px; display: block; }
.lang-trigger__code {
  font-size: var(--step-small);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  transform: scale(0.72);
  transform-origin: center top;
}

/* Floating Language Popover (real overlay menu) */
.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 152px;
  padding: 6px;
  background: var(--surface-2);
  box-shadow: 0 18px 40px -12px rgba(16, 22, 20, 0.28); /* taste-skill-ignore */
  display: grid;
  gap: 2px;
  z-index: 90;
}
.lang-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: var(--step-small);
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color var(--dur-micro) ease;
}
.lang-opt svg { width: 18px; height: 13px; border-radius: 2px; flex-shrink: 0; }
.lang-opt__code { font-weight: 700; min-width: 24px; }
.lang-opt__name { color: var(--muted); }
.lang-opt:hover { background: var(--surface); }
.lang-opt[aria-checked="true"] { background: var(--accent-soft); color: var(--accent); }
.lang-opt[aria-checked="true"] .lang-opt__name { color: var(--accent); }

/* Compact VI/EN toggle on subpages */
.lang-toggle {
  display: inline-flex;
  background: var(--surface);
  padding: 3px;
  gap: 2px;
}
.lang-toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 12px;
  font-size: var(--step-small);
  font-weight: 600;
  cursor: pointer;
  transition: background-color var(--dur-micro) ease, color var(--dur-micro) ease;
}
.lang-toggle button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.menu-toggle { display: none; }

.mobile-drawer {
  background: var(--surface);
  padding: 16px var(--gutter) 24px;
  display: grid;
  gap: 4px;
}
.mobile-drawer a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 12px;
  text-decoration: none;
  font-weight: 500;
  color: var(--ink);
  transition: background-color var(--dur-micro) ease;
}
.mobile-drawer a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

@media (max-width: 58rem) {
  .nav-desktop { display: none; }
  .menu-toggle { display: grid; }
}

/* Flat Architectural Buttons (Square corners decided once across the whole site) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: var(--step-small);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn--quiet {
  background: var(--surface);
  color: var(--ink);
}
.btn--quiet:hover { background: var(--surface-2); }

.btn--ink {
  background: var(--ink);
  color: var(--bg);
}
.btn--ink:hover { opacity: 0.9; }

.btn--sm { min-height: 40px; padding: 0 16px; }
.btn--block { width: 100%; }

/* Real Form Fields (borders belong on genuine form controls) */
.field { display: grid; gap: 8px; }
.field label { font-size: var(--step-small); font-weight: 600; color: var(--ink); }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius-field);
  border: 1px solid var(--field-border); /* taste-skill-ignore */
  background: var(--surface-2);
  color: var(--ink);
  font-size: var(--step-body);
  transition: border-color var(--dur-micro) ease;
}
.textarea { min-height: 104px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  outline: none;
}
.help { font-size: var(--step-small); color: var(--muted); line-height: 1.5; }

/* Flat Tonal Panels & Status Blocks (zero shadows, zero decorative borders) */
.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface-2);
  font-size: var(--step-small);
  font-weight: 600;
  color: var(--ink);
}
.pill--accent { background: var(--accent-soft); color: var(--accent); }
.pill--signal { background: var(--signal-soft); color: var(--signal); }
.pill--danger { background: var(--danger-soft); color: var(--danger); }

.alert {
  padding: 16px 18px;
  background: var(--surface-2);
  font-size: var(--step-small);
  display: grid;
  gap: 6px;
}
.alert--success { background: var(--accent-soft); color: var(--ink); }
.alert--warn { background: var(--signal-soft); color: var(--ink); }
.alert--error { background: var(--danger-soft); color: var(--danger); }

/* Staggered Section Entrances (transform + opacity only; content never trapped hidden without JS) */
.js-ready [data-reveal] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-med) var(--ease-out), transform var(--dur-med) var(--ease-out);
}
.js-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
[data-delay="1"] { transition-delay: 70ms; }
[data-delay="2"] { transition-delay: 140ms; }
[data-delay="3"] { transition-delay: 210ms; }
[data-delay="4"] { transition-delay: 280ms; }

/* Floating Mobile Bottom Bar (appears only after scrolling past hero) */
.mobile-sticky-cta { display: none; }
@media (max-width: 48rem) {
  .mobile-sticky-cta {
    position: fixed;
    left: 14px;
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
    z-index: 65;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--field-inv);
    color: var(--field-inv-ink);
    box-shadow: 0 18px 40px -12px rgba(16, 22, 20, 0.32); /* taste-skill-ignore */
    transform: translateY(140%);
    opacity: 0;
    transition: transform var(--dur-short) var(--ease-spring), opacity var(--dur-short) var(--ease-out);
  }
  .mobile-sticky-cta.is-shown { transform: translateY(0); opacity: 1; }
  .mobile-sticky-cta__meta { display: grid; line-height: 1.2; }
  .mobile-sticky-cta__meta strong { font-size: 0.96rem; }
  .mobile-sticky-cta__meta span { font-size: 0.8125rem; color: var(--field-inv-muted); }
  .mobile-sticky-cta .btn {
    min-height: 42px;
    padding: 0 18px;
    background: var(--field-inv-accent);
    color: var(--field-inv-accent-ink);
  }
}

/* Subpage Minimal Editorial Footer */
.site-footer {
  margin-top: var(--section-gap);
  background: var(--surface);
  padding-block: 44px 56px;
  color: var(--muted);
  font-size: var(--step-small);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 32px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-links a { text-decoration: none; font-weight: 500; }
.footer-links a:hover { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .js-ready [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
