:root {
  --paper: #f4f0e7;
  --paper-deep: #e9e2d5;
  --paper-light: #faf8f2;
  --ink: #14252a;
  --ink-soft: #526267;
  --line: #c8c0b3;
  --line-strong: #9c988d;
  --rust: #d66142;
  --rust-dark: #a9432d;
  --blue: #17616b;
  --ochre: #e6ad37;
  --shell: min(1180px, calc(100% - 48px));
  --shadow: 0 24px 70px rgba(20, 37, 42, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }

html {
  background: var(--paper);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(20, 37, 42, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 37, 42, .045) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 1.06rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(230, 173, 55, .5); color: var(--ink); }

a { color: inherit; }

.shell { width: var(--shell); margin-inline: auto; }

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: .55rem .8rem;
  background: var(--ink);
  color: var(--paper-light);
  font-family: "Courier New", monospace;
  font-size: .75rem;
  text-decoration: none;
}

.skip-link:focus { top: 1rem; }

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 5rem;
  border-bottom: 1px solid var(--line);
  font-family: "Courier New", monospace;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.signature { font-weight: 700; text-decoration: none; }

.header-nav { display: flex; align-items: center; gap: 1.5rem; }

.header-nav a { text-decoration: none; }

.header-nav > a:first-child { border-bottom: 1px solid var(--ink); }

.language-switcher { display: inline-flex; align-items: center; gap: .55rem; }
.language-switcher a { position: relative; }
.language-switcher a + a::before { margin-right: .55rem; color: var(--line-strong); content: "/"; }
.language-switcher a[aria-current="page"] { border-bottom: 1px solid var(--rust-dark); color: var(--rust-dark); }

.header-nav a:hover,
.header-nav a:focus-visible,
.signature:hover,
.signature:focus-visible { color: var(--rust-dark); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.24fr) minmax(360px, .76fr);
  gap: clamp(2.5rem, 4vw, 4.5rem);
  align-items: end;
  min-height: min(760px, calc(100vh - 5rem));
  padding-top: clamp(4.5rem, 10vw, 9rem);
  padding-bottom: clamp(4.5rem, 9vw, 8rem);
}

.eyebrow,
.section-kicker,
.meter-meta,
.instrument-topline,
.threshold-key,
.input-label,
.distribution-legend,
.split-line,
.meter-readouts span,
.meter-readouts small {
  font-family: "Courier New", monospace;
  font-size: .68rem;
  letter-spacing: .1em;
  line-height: 1.3;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  justify-content: space-between;
  max-width: 33rem;
  margin: 0 0 2rem;
  color: var(--rust-dark);
  font-weight: 700;
}

.eyebrow span { color: var(--ink-soft); }

h1,
h2,
p { margin-top: 0; }

h1,
h2 {
  max-width: 12ch;
  margin-bottom: 1.3rem;
  font-weight: 800;
  letter-spacing: -.012em;
  line-height: .94;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  text-rendering: optimizeLegibility;
  text-wrap: balance;
}

h1 { font-size: clamp(3.5rem, 8.3vw, 8.6rem); }

h2 { font-size: clamp(2.5rem, 5vw, 5.2rem); }

.hero-lead,
.section-intro {
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: clamp(1.08rem, 1.7vw, 1.35rem);
  line-height: 1.4;
}

.hero-lead { max-width: 35rem; }

.text-link {
  display: inline-flex;
  gap: .65rem;
  align-items: center;
  margin-top: 1.1rem;
  border-bottom: 1px solid var(--ink);
  padding-bottom: .26rem;
  font-family: "Courier New", monospace;
  font-size: .76rem;
  letter-spacing: .03em;
  text-decoration: none;
}

.text-link span { color: var(--rust-dark); font-size: 1.1rem; }

.text-link:hover,
.text-link:focus-visible { border-color: var(--rust); color: var(--rust-dark); }

.instrument {
  position: relative;
  min-height: 26rem;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper-light);
  box-shadow: var(--shadow);
}

.instrument::after {
  position: absolute;
  inset: 2.3rem 2rem 4.3rem;
  border: 1px solid rgba(244, 240, 231, .25);
  content: "";
  pointer-events: none;
}

.instrument-topline {
  display: flex;
  justify-content: space-between;
  padding: 1.1rem 1.2rem;
  color: rgba(244, 240, 231, .66);
  border-bottom: 1px solid rgba(244, 240, 231, .2);
  font-size: .63rem;
}

.instrument-reading {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 17rem;
  padding: 2.1rem 2.35rem 1.8rem;
}

.instrument-reading strong {
  color: var(--ochre);
  font-size: clamp(4.6rem, 10vw, 8rem);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: .9;
  font-kerning: normal;
  font-variant-numeric: tabular-nums;
}

.instrument-reading span {
  margin-top: 1.1rem;
  color: rgba(244, 240, 231, .82);
  font-family: "Courier New", monospace;
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.instrument-scale {
  position: absolute;
  right: 2.6rem;
  bottom: 4.35rem;
  left: 2.6rem;
  display: flex;
  justify-content: space-between;
  height: 2rem;
  border-top: 1px solid rgba(244, 240, 231, .42);
}

.instrument-scale i { display: block; width: 1px; height: .75rem; background: rgba(244, 240, 231, .64); }
.instrument-scale i:nth-child(2n) { height: 1.2rem; }
.instrument-scale i:nth-child(5) { height: 1.7rem; background: var(--rust); }

.instrument figcaption {
  position: absolute;
  right: 1.2rem;
  bottom: 1.05rem;
  left: 1.2rem;
  color: rgba(244, 240, 231, .67);
  font-size: .77rem;
  line-height: 1.35;
}

.section { padding-top: clamp(5rem, 11vw, 10rem); padding-bottom: clamp(5rem, 11vw, 10rem); }

.section + .section { border-top: 1px solid var(--line); }

.section-kicker { margin-bottom: 2rem; color: var(--rust-dark); font-weight: 700; }

.fact-layout,
.tool-heading,
.distribution-layout,
.note-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, .78fr);
  gap: clamp(3rem, 9vw, 10rem);
  align-items: start;
}

.split-reading {
  padding-top: .6rem;
  border-top: 2px solid var(--ink);
}

.split-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-top: .8rem;
  color: var(--ink-soft);
}

.split-line strong { color: var(--ink); font-size: 1.4rem; font-weight: 700; letter-spacing: -.04em; }
.split-line-accent strong { color: var(--rust-dark); }

.split-bar { height: .55rem; margin: .6rem 0 1.35rem; background: var(--paper-deep); }

.split-bar span { display: block; width: var(--share); height: 100%; background: var(--blue); }
.split-bar-accent span { background: var(--rust); }

.split-note { margin: 1.2rem 0 0; color: var(--ink-soft); font-size: .85rem; }

.tool-heading { margin-bottom: 3.2rem; }

.tool-aside {
  max-width: 19rem;
  margin: .5rem 0 0;
  color: var(--rust-dark);
  font-family: "Courier New", monospace;
  font-size: .8rem;
  line-height: 1.5;
}

.tool-wrap {
  position: relative;
  padding: clamp(1.4rem, 3vw, 2.6rem);
  background: var(--paper-light);
  box-shadow: var(--shadow);
}

.tool-wrap::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--rust);
  content: "";
}

.input-label { display: block; margin-bottom: .75rem; color: var(--ink-soft); font-weight: 700; }

textarea {
  display: block;
  width: 100%;
  min-height: 6.2rem;
  resize: vertical;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  padding: 1rem 1.1rem;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: clamp(1.15rem, 2.1vw, 1.55rem);
  line-height: 1.35;
}

textarea:focus { outline: 3px solid rgba(23, 97, 107, .3); outline-offset: 2px; border-color: var(--blue); }

.input-hint { margin: .65rem 0 2.3rem; color: var(--ink-soft); font-size: .78rem; }

.sentence-meter { border-top: 1px solid var(--line); }

.meter-meta { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; color: var(--ink-soft); }

.meter-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: clamp(.4rem, 1.5vw, .9rem);
  min-height: 12rem;
  padding: 2rem .4rem .35rem;
  border-bottom: 1px solid var(--line-strong);
  isolation: isolate;
}

.meter-chart::before {
  position: absolute;
  right: 0;
  bottom: var(--threshold);
  left: 0;
  z-index: -1;
  border-top: 1px solid var(--ochre);
  content: "";
}

.word-cell {
  position: relative;
  display: flex;
  flex: 1 1 0;
  min-width: 2.25rem;
  height: 11.2rem;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
}

.word-block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 2.3rem;
  height: var(--bar-height);
  padding: .25rem;
  overflow-wrap: anywhere;
  background: var(--blue);
  color: var(--paper-light);
  font-size: clamp(.7rem, 1.5vw, .94rem);
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
}

.word-cell.is-short .word-block { background: var(--rust); }

.word-length {
  color: var(--ink-soft);
  font-family: "Courier New", monospace;
  font-size: .7rem;
  font-variant-numeric: tabular-nums;
}

.threshold-key { display: flex; align-items: center; gap: .5rem; margin: .8rem 0 0; color: #8a6414; font-size: .67rem; }
.threshold-key span { display: inline-block; width: 1.3rem; border-top: 2px solid var(--ochre); }

.meter-summary { max-width: 49rem; margin: 1.7rem 0 2rem; font-size: clamp(1.15rem, 2vw, 1.45rem); line-height: 1.35; }

.meter-readouts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; border-top: 1px solid var(--line); padding-top: 1.2rem; }

.meter-readouts > div { display: grid; grid-template-columns: 1fr; gap: .32rem; }
.meter-readouts span { color: var(--ink-soft); }
.meter-readouts strong { font-size: clamp(1.75rem, 3.5vw, 3rem); letter-spacing: -.04em; line-height: 1; font-kerning: normal; font-variant-numeric: tabular-nums; }
.meter-readouts small { color: var(--ink-soft); font-size: .62rem; letter-spacing: .03em; text-transform: none; }

.distribution-layout { gap: clamp(3rem, 7vw, 7rem); }

.distribution-figure { margin: 0; }
.distribution-legend { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; color: var(--ink-soft); font-size: .63rem; }
.legend-dot { display: inline-block; width: .65rem; height: .65rem; margin-right: .4rem; background: var(--rust); }

.distribution-bars { border-top: 1px solid var(--line-strong); }
.dist-row { display: grid; grid-template-columns: 2rem minmax(0, 1fr) 4.2rem; gap: .7rem; align-items: center; min-height: 1.55rem; border-bottom: 1px solid rgba(200, 192, 179, .55); }
.dist-row b { color: var(--ink-soft); font-family: "Courier New", monospace; font-size: .72rem; font-weight: 400; }
.dist-row em { color: var(--ink-soft); font-family: "Courier New", monospace; font-size: .67rem; font-style: normal; text-align: right; }
.dist-track { display: block; height: .48rem; background: var(--paper-deep); }
.dist-track i { display: block; width: var(--share); min-width: 1px; height: 100%; background: var(--blue); }
.dist-row-focus .dist-track i { background: var(--rust); }
.dist-row-focus b,
.dist-row-focus em { color: var(--rust-dark); font-weight: 700; }
.dist-row-threshold { box-shadow: inset 3px 0 var(--ochre); }
.distribution-figure figcaption { margin-top: 1rem; color: var(--ink-soft); font-size: .76rem; line-height: 1.4; }

.section-note { padding-bottom: 7rem; }
.note-layout h2 { max-width: 8ch; }
.note-layout p { max-width: 36rem; color: var(--ink-soft); }
.source-links { display: flex; flex-wrap: wrap; gap: 1.2rem 1.8rem; margin-top: 1.7rem; font-family: "Courier New", monospace; font-size: .73rem; }
.source-links a { text-decoration-thickness: 1px; text-underline-offset: .25rem; }
.source-links a:hover,
.source-links a:focus-visible { color: var(--rust-dark); }

.site-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
  padding-bottom: 2rem;
  color: var(--ink-soft);
  font-family: "Courier New", monospace;
  font-size: .68rem;
  letter-spacing: .03em;
}

.site-footer p { margin: 0; }
.site-footer span { color: var(--ink); font-weight: 700; }
.site-footer a { text-underline-offset: .2rem; }

.back-to-top {
  display: inline-flex;
  gap: .4rem;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--ink);
  padding: .45rem .6rem;
  background: var(--ink);
  color: var(--paper-light);
  font-family: "Courier New", monospace;
  font-size: .7rem;
  text-decoration: none;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top.is-managed {
  position: fixed;
  right: 1.2rem;
  bottom: 1.2rem;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
  transform: translateY(.5rem);
  transition: opacity .2s ease, transform .2s ease;
}

.back-to-top.is-managed.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top.is-managed.is-near-footer { bottom: 7rem; }
.back-to-top:hover,
.back-to-top:focus-visible { background: var(--rust-dark); border-color: var(--rust-dark); }

#joaca { scroll-margin-top: 1.5rem; }

@media (min-width: 821px) {
  .hero {
    padding-top: clamp(3.8rem, 6vw, 6.5rem);
  }

  .hero-copy {
    position: relative;
    z-index: 2;
  }

  .hero-copy::after {
    position: absolute;
    top: 58%;
    right: clamp(-11rem, -12vw, -6rem);
    width: clamp(8rem, 17vw, 13rem);
    border-top: 1px solid var(--rust);
    content: "";
    opacity: .88;
  }

  h1 {
    font-size: clamp(3.5rem, 9.1vw, 9.4rem);
  }

  html[data-language="en"] h1 {
    font-size: clamp(3.5rem, 7.7vw, 8.3rem);
  }

  .instrument-opening {
    z-index: 1;
    min-height: clamp(31rem, 42vw, 38rem);
    margin-right: clamp(-1rem, -3vw, -2.5rem);
    transform: translateY(clamp(2rem, 6vw, 5rem));
  }

  .instrument-opening::before {
    position: absolute;
    top: 4.3rem;
    bottom: 4.3rem;
    left: 0;
    width: 2px;
    background: var(--rust);
    content: "";
    opacity: .9;
  }
}

@media (max-width: 820px) {
  :root { --shell: min(100% - 32px, 660px); }
  .hero,
  .fact-layout,
  .tool-heading,
  .distribution-layout,
  .note-layout { grid-template-columns: 1fr; gap: 2.8rem; }
  .hero { min-height: auto; padding-top: 4.8rem; }
  .instrument { min-height: 22rem; max-width: 33rem; }
  h1 { max-width: 10ch; font-size: clamp(3.6rem, 11vw, 6rem); }
  h2 { max-width: 12ch; }
  .tool-aside { margin-top: -1.4rem; }
  .distribution-figure { max-width: 40rem; }
}

@media (max-width: 480px) {
  :root { --shell: calc(100% - 28px); }
  body { background-size: 24px 24px; font-size: 1rem; }
  .site-header { min-height: 4.2rem; font-size: .62rem; }
  .header-nav { gap: .8rem; }
  .header-nav > a:first-child { display: none; }
  .hero { gap: 3.2rem; padding-top: 4.2rem; padding-bottom: 4rem; }
  .eyebrow { margin-bottom: 1.4rem; font-size: .61rem; }
  h1 { font-size: clamp(3.2rem, 15vw, 4.5rem); }
  h2 { font-size: clamp(2.45rem, 12vw, 3.6rem); }
  .hero-lead,
  .section-intro { font-size: 1.07rem; }
  .instrument { min-height: 20rem; }
  .instrument-reading { min-height: 13.5rem; padding: 1.8rem 1.55rem; }
  .instrument-reading strong { font-size: clamp(4.2rem, 20vw, 6rem); }
  .instrument::after { inset: 2.3rem 1.2rem 4.1rem; }
  .instrument-scale { right: 1.7rem; left: 1.7rem; }
  .section { padding-top: 4.5rem; padding-bottom: 4.5rem; }
  .section-kicker { margin-bottom: 1.5rem; }
  .fact-layout,
  .tool-heading,
  .distribution-layout,
  .note-layout { gap: 2.1rem; }
  .tool-wrap { padding: 1rem; }
  textarea { min-height: 7.2rem; padding: .8rem; }
  .meter-chart { gap: .28rem; min-height: 10.8rem; padding-inline: 0; }
  .word-cell { min-width: 1.9rem; height: 9.8rem; }
  .word-block { min-height: 2rem; padding-inline: .16rem; font-size: .62rem; }
  .word-length { font-size: .62rem; }
  .meter-readouts { gap: .55rem; }
  .meter-readouts strong { font-size: 1.65rem; }
  .meter-readouts small { font-size: .55rem; }
  .dist-row { grid-template-columns: 1.8rem minmax(0, 1fr) 3.65rem; gap: .45rem; }
  .dist-row em { font-size: .61rem; }
  .site-footer { align-items: flex-start; flex-direction: column; gap: .6rem; font-size: .61rem; }
  .back-to-top.is-managed { right: .8rem; bottom: .8rem; }
  .back-to-top.is-managed.is-near-footer { bottom: 7rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

@media print {
  body { background: #fff; }
  .site-header, .back-to-top, .text-link { display: none; }
  .hero { min-height: auto; }
  .section { padding-block: 2rem; }
  .instrument { box-shadow: none; }
}
