/* earslang.com. Dark by default, with a light theme beside it. No font is
   fetched. */

:root, :root[data-theme="dark"] {
  --bg: #0a0a0a;
  --fg: #ededed;
  --muted: #a3a3a3;
  --line: #262626;
  --panel: #111111;
  --panel-head: #171717;
  --button: #ededed;
  --button-fg: #0a0a0a;
  --keyword: #f59e0b;
  --structure: #7cc4fa;
  --id: #c4b5fd;
  --tag: #86d39b;
  --error: #f87171;
  --warning: #facc15;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #525252;
  --line: #e5e5e5;
  --panel: #f7f7f7;
  --panel-head: #efefef;
  --button: #111111;
  --button-fg: #ffffff;
  --keyword: #b26a00;
  --structure: #0b63a8;
  --id: #6d28d9;
  --tag: #157f3c;
  --error: #c81e1e;
  --warning: #a16207;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; text-underline-offset: 3px; }
code, pre, textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:not(pre) > code { background: var(--panel-head); border: 1px solid var(--line); border-radius: 5px; padding: 0 .3em; font-size: .9em; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* Navigation */
.nav { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--bg); z-index: 2; }
.brand { font-weight: 700; text-decoration: none; letter-spacing: -.01em; }
/* A link to an anchor lands below the sticky bar. */
[id] { scroll-margin-top: 72px; }
.nav nav { display: flex; align-items: center; gap: 20px; }
.nav nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.nav nav a:hover { color: var(--fg); }
.theme { background: none; border: 1px solid var(--line); border-radius: 999px; width: 34px; height: 34px;
  display: grid; place-items: center; cursor: pointer; color: var(--fg); padding: 0; }
.theme svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.theme .moon { fill: currentColor; stroke: none; }
:root[data-theme="dark"] .theme .moon, :root:not([data-theme]) .theme .moon { display: none; }
:root[data-theme="light"] .theme .sun { display: none; }

/* Front page */
.hero { display: grid; grid-template-columns: 1fr 1.15fr; gap: 48px; align-items: center; padding-top: 72px; padding-bottom: 72px; }
.hero h1 { font-size: clamp(44px, 7vw, 68px); line-height: 1; letter-spacing: -.03em; margin: 0 0 20px; }
.lead { font-size: 20px; line-height: 1.5; margin: 0 0 16px; }
.hero-text p { color: var(--muted); }
.hero-text .lead { color: var(--fg); }
.hero-text .status { font-size: 14px; margin-top: 16px; }
.hero-code { display: grid; gap: 16px; min-width: 0; }
.hero-code p { margin: 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button { display: inline-block; padding: 10px 20px; border-radius: 999px; border: 1px solid var(--line);
  text-decoration: none; font-weight: 600; font-size: 15px; }
.button.primary { background: var(--button); color: var(--button-fg); border-color: var(--button); }
.button:hover { opacity: .88; }

.band { padding-top: 56px; padding-bottom: 56px; border-top: 1px solid var(--line); }
.band h2 { font-size: 30px; letter-spacing: -.02em; margin: 0 0 24px; text-align: center; }
.band > p { max-width: 760px; margin: 0 auto 16px; color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.cols h3 { font-size: 17px; margin: 0 0 8px; }
.cols p { color: var(--muted); margin: 0 0 12px; }
.band > figure.code { max-width: 760px; margin: 16px auto; }
.rules-guide { max-width: 760px; margin: 0 auto; display: grid; gap: 28px; }
.rules-guide h3 { font-size: 17px; margin: 0 0 8px; }
.rules-guide p { color: var(--muted); margin: 0 0 12px; }
details { max-width: 760px; margin: 0 auto; border-bottom: 1px solid var(--line); padding: 14px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { color: var(--muted); margin: 10px 0 0; }

/* Code panels */
figure.code { margin: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); overflow: hidden; }
figure.code figcaption { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px;
  background: var(--panel-head); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); }
figure.code figcaption a { color: var(--muted); text-decoration: none; white-space: nowrap; }
figure.code figcaption a:hover { color: var(--fg); }
figure.code figcaption button.copy { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
figure.code figcaption button.copy:hover { color: var(--fg); }
figure.code pre, pre.code { margin: 0; padding: 16px; overflow-x: auto; font-size: 14px; line-height: 1.65; }
figure.code.prose p { margin: 0; padding: 16px; }
pre.code { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
figure.small pre { font-size: 13px; }
/* Rules are sentences: they wrap, with the wrapped part indented under the text. */
figure.ears pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.t-keyword { color: var(--keyword); font-weight: 600; }
.t-structure { color: var(--structure); font-weight: 600; }
.t-id { color: var(--id); }
.t-tag { color: var(--tag); }
.d-error { text-decoration: underline wavy var(--error); text-decoration-skip-ink: none; text-underline-offset: 4px; }
.d-warning { text-decoration: underline wavy var(--warning); text-decoration-skip-ink: none; text-underline-offset: 4px; }

/* The spec */
.doc { max-width: 860px; padding-top: 40px; padding-bottom: 40px; }
.doc h1 { font-size: 38px; letter-spacing: -.02em; line-height: 1.15; }
.doc h2 { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); }
.doc figure.code, .doc pre.code { margin: 16px 0; }
.doc table { border-collapse: collapse; display: block; overflow-x: auto; margin: 16px 0; font-size: 15px; }
.doc th, .doc td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.doc th { background: var(--panel-head); }
.doc caption { text-align: left; color: var(--muted); padding: 0 0 6px; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

/* The playground */
.play ~ .foot { display: none; }
.status { color: var(--muted); margin: 4px 0; }
/* Read by screen readers, not shown. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.link-status { margin: 0; padding: 8px 16px; border-bottom: 1px solid var(--line); }
.page-status:empty { display: none; }
.play ears-playground { margin: 0; --ears-height: calc(100vh - 63px); --ears-min-height: 480px; }

.foot { border-top: 1px solid var(--line); padding: 24px; text-align: center; font-size: 13px; color: var(--muted); }
.foot p { max-width: 760px; margin: 0 auto; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 32px; padding-top: 40px; padding-bottom: 40px; }
  .cols { grid-template-columns: 1fr; }
  .wrap { padding: 0 16px; }
  .nav { padding: 12px 16px; }
  /* Brand and links wrap onto two lines on a phone, not past its edge. */
  .nav { flex-wrap: wrap; row-gap: 8px; }
  .nav nav { flex-wrap: wrap; gap: 8px 14px; }
  [id] { scroll-margin-top: 140px; }
}

/* The errors page */
.codes { columns: 2 300px; padding-left: 20px; }
.codes a, section > h2 a { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
section > h2 a { color: inherit; text-decoration: none; }

/* The component takes the site's colours, in whichever theme is on. */
ears-playground { margin: 16px 0; --ears-bg: var(--bg); --ears-fg: var(--fg); --ears-muted: var(--muted); --ears-line: var(--line);
  --ears-panel: var(--panel); --ears-panel-head: var(--panel-head); --ears-keyword: var(--keyword); --ears-structure: var(--structure);
  --ears-id: var(--id); --ears-tag: var(--tag); --ears-error: var(--error); --ears-warning: var(--warning); }
