/* adlevr.com: one bilingual sheet per page, Thai left and English right, clause by clause.
   Tokens are the app's Ember palette (src/app/globals.css); see DESIGN.md "Public site". */

@font-face { font-family: "IBM Plex Sans Thai Looped"; src: url("/fonts/IBMPlexSansThaiLooped-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Thai Looped"; src: url("/fonts/IBMPlexSansThaiLooped-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IBM Plex Sans Thai Looped"; src: url("/fonts/IBMPlexSansThaiLooped-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("/fonts/fraunces-logo.woff2") format("woff2"); font-weight: 600; font-display: block; }

:root {
  --paper: #eeeef1;
  --paper-deep: #e3e3e8;
  --card: #ffffff;
  --card-sub: #f6f6f8;
  --ink: #19191c;
  --ink-soft: #45454c;
  --ink-mute: #5d5d65;
  --line: #dcdce2;
  --line-soft: #ececf0;
  --accent: #f2763d;
  --accent-ink: #ad4518;
  --accent-wash: #fde6da;
  --accent-deep: #c94d19;
  --good-wash: #d7eadc;
  --good-ink: #23633e;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(20px, 4.4vw, 56px);
  color-scheme: light;
}

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

html {
  background: var(--paper);
  color: var(--ink);
  font-family: "IBM Plex Sans Thai Looped", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--line) transparent;
  scroll-padding-top: 24px;
  -webkit-tap-highlight-color: transparent;
}

body { font-size: 15px; font-weight: 400; line-height: 1.6; min-height: 100dvh; }
/* Thai stacks vowels and tone marks above and below the line (inherited, so headings and
   inline spans can set their own). */
:lang(th) body { line-height: 1.75; }
.sheet [lang="en"] { line-height: 1.6; }

h1, h2, h3 { font-weight: 500; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
:lang(th) h1, :lang(th) h2, :lang(th) h3 { line-height: 1.4; letter-spacing: 0; }
p, li { text-wrap: pretty; }

a { color: inherit; text-decoration: none; touch-action: manipulation; }
.prose a, .link {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent);
  transition: text-decoration-color 160ms var(--ease-out);
}
.prose a:hover, .link:hover { text-decoration-color: currentColor; }

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

.i { width: 16px; height: 16px; flex: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.skip {
  position: absolute; left: 16px; top: 12px; z-index: 10;
  padding: 8px 14px; border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500;
  transform: translateY(-160%);
}
.skip:focus-visible { transform: none; }

/* Wordmark: "adlévr" in Fraunces with the rising accent on the é (src/components/logo.tsx). */
.wordmark { display: inline-flex; align-items: baseline; font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 28px; letter-spacing: -0.01em; color: var(--ink); }
.wordmark, .wordmark * { line-height: 1; }
.wordmark .e { position: relative; }
.wordmark .e svg { position: absolute; top: 0.02em; left: 0.1em; height: 0.26em; width: 0.22em; color: var(--accent); }

/* Layout */
.wrap { max-width: 1240px; margin: 0 auto; padding: 28px clamp(16px, 3vw, 40px) 40px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 48px; }
.top-right { display: flex; align-items: center; }
.home-link { display: inline-flex; padding: 6px 4px; margin: -6px -4px; border-radius: 6px; }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  display: grid; justify-items: start; gap: 0; padding: 6px 12px; border-radius: 10px;
  transition: background-color 160ms var(--ease-out);
}
.nav a:hover { background: var(--paper-deep); }
.nav a > span:first-child { font-size: 14px; font-weight: 500; color: var(--ink-soft); line-height: 1.5; }
.nav a > span:last-child { font-size: 12px; color: var(--ink-mute); line-height: 1.3; }
.nav a[aria-current="page"] > span:first-child { color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"] { background: var(--card); }

.signin {
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; margin-left: 12px;
  border-radius: 999px; background: var(--ink); color: #fff; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.signin span[lang="en"] { color: var(--line); font-weight: 400; opacity: 0.8; }
.signin:hover { background: var(--ink-soft); }
.signin:active { transform: scale(0.97); }

/* The sheet: one white page, a centre hairline, a hairline between clauses. */
.sheet { margin-top: 24px; background: var(--card); border-radius: 24px; overflow: clip; }
.row { display: grid; grid-template-columns: 1fr 1fr; }
.row > * { padding: 24px var(--gutter); min-width: 0; }
.row > :first-child { border-right: 1px solid var(--line-soft); }
.row + .row > * { border-top: 1px solid var(--line); }

.head > * { padding-top: clamp(36px, 5vw, 60px); padding-bottom: clamp(28px, 3.4vw, 40px); }
.lang { font-size: 12px; font-weight: 600; color: var(--ink-mute); margin-bottom: 18px; line-height: 1.4; }
h1, .title { font-size: clamp(26px, 3.2vw, 40px); font-weight: 400; max-width: 18ch; line-height: 1.2; letter-spacing: -0.015em; text-wrap: balance; }
:lang(th) h1 { line-height: 1.4; letter-spacing: 0; }
.lead { margin-top: 16px; font-size: 17px; color: var(--ink-soft); max-width: 46ch; }
.dates { margin-top: 18px; font-size: 13px; color: var(--ink-mute); }

/* A clause: its number links to itself, so other pages can point at "clause 3". */
.clause { scroll-margin-top: 24px; }
.clause:target > * { background: color-mix(in srgb, var(--accent-wash) 45%, transparent); transition: background-color 240ms var(--ease-out); }
.term { display: flex; gap: 12px; align-items: baseline; font-size: 15px; font-weight: 600; color: var(--ink); line-height: 1.45; }
:lang(th) .term { line-height: 1.6; }
.num {
  flex: none; min-width: 18px; font-size: 13px; font-weight: 600; color: var(--accent-ink);
  font-variant-numeric: tabular-nums; border-radius: 6px;
}
.num:hover { text-decoration: underline; text-underline-offset: 3px; }
.prose { margin-top: 6px; padding-left: 30px; color: var(--ink-soft); font-size: 15px; max-width: 58ch; }
.prose > * + * { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 0; list-style: none; }
.prose li { position: relative; padding-left: 18px; }
.prose li + li { margin-top: 6px; }
.prose ul > li::before { content: ""; position: absolute; left: 2px; top: 0.78em; width: 6px; height: 1px; background: var(--ink-mute); }
.prose ol { counter-reset: step; }
.prose ol > li { counter-increment: step; padding-left: 26px; }
.prose ol > li::before { content: counter(step); position: absolute; left: 0; top: 0; font-size: 13px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose code, .mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.88em; color: var(--ink); background: var(--card-sub); padding: 1px 5px; border-radius: 6px; }
.path { color: var(--ink); font-weight: 500; white-space: nowrap; }

/* The big contact line on the contact page. */
.mail {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 4px;
  font-size: clamp(22px, 2.2vw, 26px); font-weight: 500; color: var(--ink);
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; text-decoration-color: var(--line);
  transition: text-decoration-color 160ms var(--ease-out);
}
.mail:hover { text-decoration-color: var(--accent); }
.mail .i { width: 22px; height: 22px; color: var(--accent); }

/* The documents row closes every sheet. */
.docs > * { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 28px; padding-bottom: 32px; }
.docs a {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  background: var(--card-sub); font-size: 14px; font-weight: 500; color: var(--ink);
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.docs a:hover { background: var(--line-soft); }
.docs a:active { transform: scale(0.97); }
.docs a[aria-current="page"] { background: var(--ink); color: #fff; }
.docs .i { color: var(--ink-mute); width: 15px; height: 15px; }
.docs a[aria-current="page"] .i { color: var(--line); }

.foot { margin-top: 20px; padding: 0 4px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 24px; font-size: 13px; color: var(--ink-mute); }
.foot a { color: var(--ink-soft); }
.foot a:hover { color: var(--ink); }

/* Language switch: phones only, where the two columns stack and the page doubles in length. */
.langs { display: none; }

@media (width < 860px) {
  .nav { display: none; }
  .signin { margin-left: 0; height: 40px; padding: 0 16px; }
  .signin span[lang="en"] { display: none; }
  .sheet { border-radius: 20px; margin-top: 16px; }
  .row { grid-template-columns: 1fr; }
  .row > :first-child { border-right: 0; }
  .row > * + * { border-top: 1px solid var(--line-soft); }
  .row > * { padding-top: 18px; padding-bottom: 18px; }
  .head > * { padding-top: 28px; padding-bottom: 24px; }
  .head > * + * { padding-top: 24px; }
  h1, .title { font-size: clamp(28px, 7.4vw, 34px); }
  .prose { padding-left: 0; }
  .term .num { min-width: 22px; }

  .langs {
    display: flex; gap: 2px; width: max-content; margin: 16px auto 0; padding: 3px; border-radius: 999px;
    background: var(--paper-deep);
  }
  .langs button {
    font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-mute); border: 0; background: none; cursor: pointer;
    min-height: 36px; padding: 0 14px; border-radius: 999px;
    transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
  }
  .langs button[aria-pressed="true"] { background: var(--card); color: var(--ink); }

  html[data-lang="th"] .row > [lang="en"],
  html[data-lang="en"] .row > [lang="th"] { display: none; }
  html[data-lang] .row > * + * { border-top: 0; }
  html[data-lang="en"] .row + .row > [lang="en"],
  html[data-lang="th"] .row + .row > [lang="th"] { border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; }
}

@media print {
  html { background: #fff; }
  .top, .langs, .docs, .skip { display: none; }
  .sheet { border-radius: 0; }
}
