/* Good Door: a white page, ink type, and one warm light coming through a door left open. */

@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/InstrumentSans.woff2") format("woff2");
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --paper: #ffffff;
  --paper-2: #f6f5f1;
  --ink: #111110;
  --soft: #55534d;
  --faint: #8c8a83;
  --rule: #e6e4de;
  --light: #ffbf3f;
  --light-deep: #d98a00;
  --sun: #fda11e;
  --code-bg: #121210;
  --code-ink: #ecebe6;
  --code-dim: #8e8c84;
  --sans: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 48px);
  --measure: 760px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e0d0b;
    --paper-2: #171613;
    --ink: #f2f0ea;
    --soft: #b4b1a8;
    --faint: #7f7c74;
    --rule: #2a2925;
    --code-bg: #171613;
    color-scheme: dark;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .readme pre {
    border: 1px solid var(--rule);
  }
}

:root[data-theme="dark"] .readme pre {
  border: 1px solid var(--rule);
}

:root[data-theme="dark"] {
  --paper: #0e0d0b;
  --paper-2: #171613;
  --ink: #f2f0ea;
  --soft: #b4b1a8;
  --faint: #7f7c74;
  --rule: #2a2925;
  --code-bg: #171613;
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-color: var(--light-deep);
}

:focus-visible {
  outline: 2px solid var(--light-deep);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  z-index: 5;
}

.skip:focus {
  top: 12px;
}

/* ---------- Top ---------- */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 22px var(--gutter);
}

.mark {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 23px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.mark svg {
  width: 24px;
  height: 29px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.mark .mark__leaf {
  fill: var(--paper);
}

.mark .mark__light {
  fill: var(--light);
  stroke: none;
}

.top__links {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gh-stats {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 5px 11px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--soft);
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.gh-stats:hover,
.gh-stats:focus-visible {
  border-color: var(--ink);
  color: var(--ink);
}

.gh-stats__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.gh-stats svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linejoin: round;
}

.gh-stats__item--star svg {
  fill: var(--sun);
  stroke: var(--sun);
}

.top__git {
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: var(--soft);
}

.top__git:hover {
  color: var(--ink);
}

/* ---------- Hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(32px, 7vw, 96px) var(--gutter) clamp(40px, 6vw, 80px);
}

.eyebrow {
  margin: 0 0 18px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--faint);
}

h1 {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(28px, 2.9vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lead {
  max-width: 34ch;
  margin: clamp(20px, 2.4vw, 30px) 0 0;
  font-size: clamp(19px, 1.7vw, 23px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  color: var(--soft);
  text-wrap: pretty;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(28px, 3vw, 40px);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.btn svg.gh {
  fill: currentColor;
  stroke: none;
}

.btn:hover {
  transform: translateY(-1px);
  text-decoration: none;
}

.btn--solid {
  background: var(--ink);
  color: var(--paper);
}

.btn--solid:hover {
  background: var(--light);
  border-color: var(--light);
  color: #111110;
}

.btn--small {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14.5px;
}

.meta {
  margin: 18px 0 0;
  font-size: 14px;
  color: var(--faint);
}

/* ---------- The door ---------- */

.door {
  margin: 0;
  justify-self: center;
  width: min(100%, 380px);
}

.door svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.door__line {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.door__room {
  fill: var(--light);
}

.door__leaf {
  fill: var(--paper);
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.door__knob {
  fill: var(--ink);
}

.door__spill {
  fill: var(--light);
  opacity: 0.38;
}

.door__ray {
  stroke: var(--light-deep);
  stroke-width: 1;
}

/* Door options: refined, engraved, light only, arch. */
.door__floor {
  fill: var(--light-deep);
  opacity: 0.32;
}

.door__cap,
.door__edge,
.door__stud {
  fill: var(--ink);
}

.door__panel {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
}

.door__spill--far {
  opacity: 0.18;
}

.door__spill--near {
  opacity: 0.5;
}

.door__spill--mid {
  opacity: 0.26;
}

.door__spill--faint {
  opacity: 0.12;
}

.door__slit {
  fill: var(--light);
}

.door__glow {
  fill: var(--light);
  opacity: 0.3;
}

.door__line--fine {
  stroke-width: 0.8;
}

.door__line--faint {
  opacity: 0.3;
}

.door__hair {
  stroke: var(--ink);
  stroke-width: 0.8;
  opacity: 0.62;
}

.door__lightline {
  stroke: var(--light-deep);
  stroke-width: 0.8;
  opacity: 0.7;
}

.door__fadein {
  animation: door-fade 1.2s ease 1.6s both;
}

@keyframes door-fade {
  from {
    opacity: 0;
  }
}

.door__hatchfill {
  stroke: none;
}

.door__ring {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.door__sun {
  fill: var(--sun);
}

.door__beam {
  stroke: var(--sun);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
}

.door__rays line {
  stroke: var(--light-deep);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 120;
  stroke-dashoffset: 120;
  animation: door-ray 1.6s cubic-bezier(.2, .7, .2, 1) forwards;
  animation-delay: calc(1.5s + var(--i) * 40ms);
}

@keyframes door-ray {
  to {
    stroke-dashoffset: 0;
  }
}

/* ---------- Sections ---------- */

.toc {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 4px;
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 14px var(--gutter);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-size: 14.5px;
}

.toc a {
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--soft);
  text-decoration: none;
}

.toc a:hover {
  background: var(--paper-2);
  color: var(--ink);
}

/* ---------- README ---------- */

.readme {
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) var(--gutter) clamp(48px, 7vw, 96px);
}

.readme h2 {
  margin: clamp(56px, 7vw, 88px) 0 18px;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.readme h2::before {
  content: "";
  display: block;
  width: 28px;
  height: 3px;
  margin-bottom: 18px;
  background: var(--light);
}

.readme p,
.readme ul {
  margin: 0 0 16px;
}

.readme ul {
  padding-left: 1.2em;
}

.readme li {
  margin: 6px 0;
}

.readme li::marker {
  color: var(--light-deep);
}

.readme code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.1em 0.28em;
  border-radius: 5px;
  background: var(--paper-2);
  overflow-wrap: anywhere;
}

/* Code blocks: ink panels with a copy button. */
.readme .highlight,
.readme pre {
  position: relative;
}

.readme pre {
  margin: 0 0 20px;
  padding: 20px 22px;
  border-radius: 14px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.7;
  overflow-x: auto;
  tab-size: 2;
}

.readme pre code {
  padding: 0;
  background: none;
  font-size: inherit;
  overflow-wrap: normal;
}

.readme .has-copy pre,
.readme pre.has-copy {
  padding-right: 84px;
}

.readme .pl-c,
.readme .pl-c span {
  color: var(--code-dim);
}

.readme .pl-k,
.readme .pl-c1 {
  color: var(--light);
}

.readme .pl-s,
.readme .pl-pds {
  color: #c9e4b0;
}

.copy {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 11px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: var(--code-bg);
  box-shadow: 0 0 0 8px var(--code-bg);
  color: var(--code-ink);
  font: 600 12.5px/1.2 var(--sans);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.copy:hover,
.copy:focus-visible {
  opacity: 1;
  border-color: var(--light);
}

/* Tables scroll inside their own box on small screens, never the page. */
.readme .table {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: 14px;
}

.readme table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 1.5;
}

.readme th,
.readme td {
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

.readme th {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--paper-2);
}

.readme tr:last-child td {
  border-bottom: 0;
}

.readme td code {
  white-space: nowrap;
  overflow-wrap: normal;
}

/* The skill, set apart where the README hands it to agents. */
.skill {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: center;
  margin: 24px 0 8px;
  padding: 22px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: var(--paper-2);
}

.skill__file {
  position: relative;
  width: 74px;
  height: 92px;
  border: 1.4px solid var(--ink);
  border-radius: 6px 18px 6px 6px;
  background: var(--paper);
}

.skill__file::before {
  content: "";
  position: absolute;
  inset: 14px 14px auto 14px;
  height: 34px;
  background: repeating-linear-gradient(var(--rule) 0 2px, transparent 2px 8px);
}

.skill__file span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  text-align: center;
  font: 600 10.5px/1 var(--mono);
}

.skill__file::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -1px;
  width: 18px;
  height: 18px;
  background: var(--light);
  border-radius: 0 18px 0 6px;
}

.skill__text p {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 15.5px;
}

.skill__text .skill__name {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.skill__links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 0 !important;
}

.readme .coda {
  margin-top: clamp(56px, 7vw, 88px);
  padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-size: 15.5px;
  color: var(--soft);
}

/* ---------- Etymology: the closing room, lit ---------- */

.etym {
  --etym-bg: #111110;
  --etym-ink: #f2f0ea;
  --etym-soft: #b4b1a8;
  --etym-faint: #8a877f;
  --etym-rule: rgba(242, 240, 234, 0.14);
  background: var(--etym-bg);
  color: var(--etym-ink);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .etym {
    --etym-bg: #1a1916;
  }
}

:root[data-theme="dark"] .etym {
  --etym-bg: #1a1916;
}

.etym__inner {
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: clamp(72px, 10vw, 136px) var(--gutter) clamp(64px, 9vw, 120px);
}

.etym__label {
  margin: 0 0 clamp(28px, 4vw, 44px);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--etym-faint);
}

.etym__words {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--etym-rule);
  border-bottom: 1px solid var(--etym-rule);
}

.etym__word {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: clamp(24px, 3.4vw, 40px) 0;
}

.etym__word + .etym__word {
  padding-left: clamp(20px, 3vw, 40px);
  border-left: 1px solid var(--etym-rule);
}

.etym__script {
  display: block;
  text-align: left;
  white-space: nowrap;
  font-size: clamp(44px, 6vw, 92px);
  line-height: 1.15;
  color: var(--light);
}

.etym__script[lang="ar"] {
  font-family: "Geeza Pro", "Noto Naskh Arabic", "Amiri", "Segoe UI", serif;
}

.etym__script[lang="he"] {
  font-family: "Arial Hebrew", "Noto Sans Hebrew", "Segoe UI", sans-serif;
  font-weight: 500;
  color: var(--etym-ink);
}

.etym__lang {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--etym-faint);
}

.etym__say {
  display: grid;
  gap: 6px;
  margin: clamp(36px, 5vw, 56px) 0 0;
}

.etym__latin {
  font-size: clamp(34px, 4.6vw, 64px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
}

.etym__means {
  font-size: clamp(22px, 2.6vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--etym-soft);
}

.etym__body {
  max-width: 60ch;
  margin: clamp(22px, 3vw, 32px) 0 0;
  font-size: 18px;
  line-height: 1.6;
  color: var(--etym-soft);
}

@media (max-width: 640px) {
  .etym__words {
    grid-template-columns: minmax(0, 1fr);
  }

  .etym__word + .etym__word {
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--etym-rule);
  }
}

/* ---------- Footer ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 32px;
  max-width: calc(1200px + 2 * var(--gutter));
  margin: 0 auto;
  padding: 28px var(--gutter) 40px;
  font-size: 14.5px;
  color: var(--faint);
}

.foot p {
  margin: 0;
}

.foot__links {
  display: flex;
  gap: 22px;
}

.foot a {
  color: var(--soft);
}

.foot__built {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.2s ease;
}

.foot__built:hover,
.foot__built:focus-visible {
  color: var(--light-deep);
}

/* Code and tables may run wider than the text column when the screen has room. */
@media (min-width: 1080px) {
  .readme .highlight,
  .readme > pre,
  .readme .table {
    margin-left: -90px;
    margin-right: -90px;
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 820px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .door {
    order: -1;
    justify-self: start;
    width: min(46vw, 210px);
    margin-bottom: 4px;
  }

  .toc {
    justify-content: flex-start;
  }
}

@media (max-width: 400px) {
  /* The counter links to GitHub too, and the hero has its own GitHub button. */
  .top__git {
    display: none;
  }
}

@media (max-width: 520px) {
  .readme .has-copy pre,
  .readme pre.has-copy {
    padding-top: 50px;
    padding-right: 22px;
  }

  .btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .skill {
    grid-template-columns: minmax(0, 1fr);
  }

  .skill__file {
    width: 58px;
    height: 72px;
  }

  .skill__links .btn {
    flex: 1 1 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .door__rays line,
  .door__fadein {
    animation: none;
    stroke-dashoffset: 0;
  }

  html {
    scroll-behavior: auto;
  }

  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}
