:root {
  --paper: #F5F1E9;
  --paper-deep: #E8DCC4;
  --chalk: #FBF9F4;
  --press-white: #FFFFFF;
  --pitch: #181A15;
  --ink: #202320;
  --ink-soft: #5E6360;
  --line: #B8ADA0;
  --accent: #3E5F54;
  --accent-2: #8C4943;
  --display: "Source Serif 4", Georgia, serif;
  --sans: "Poppins", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
}

::selection {
  background: var(--accent);
  color: var(--chalk);
}

a {
  color: inherit;
}

nav {
  position: sticky;
  z-index: 100;
  top: 0;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(10px);
}

.nav-brand,
.nav-tag,
.kicker,
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  text-transform: uppercase;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  white-space: nowrap;
}

.nav-brand::before {
  content: "" !important;
  width: 16px;
  height: 20px;
  flex: 0 0 16px;
  background: currentColor;
  -webkit-mask: url("mp-mark.svg") center / contain no-repeat;
  mask: url("mp-mark.svg") center / contain no-repeat;
  color: var(--accent);
  font-size: 0 !important;
}

.nav-brand b {
  color: inherit;
  font-weight: 600;
}

.nav-brand img {
  display: none !important;
}

.nav-tag {
  color: var(--ink-soft);
  text-align: right;
}

header {
  display: flex;
  min-height: min(68vh, 680px);
  flex-direction: column;
  justify-content: center;
  padding: 84px max(28px, calc((100vw - 1120px) / 2)) 68px;
}

.hex {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 0 24px;
  place-items: center;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.hex span {
  display: block;
  width: 38px;
  height: 38px;
  background: var(--paper);
  clip-path: inherit;
}

.kicker,
.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
}

h1,
h2,
h3,
.gloss-h,
.tp-h .t,
.root .tl {
  font-family: var(--display);
  font-weight: 600;
  text-transform: none;
}

h1 {
  max-width: 960px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(44px, 7vw, 92px);
  line-height: .98;
}

h1 .gild {
  background: none;
  color: var(--accent);
}

.hero-sub {
  max-width: 680px;
  margin: 26px 0 0;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(20px, 2.4vw, 27px);
  font-style: italic;
  line-height: 1.45;
}

.doorway {
  max-width: 720px;
  margin: 20px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.75;
}

.doorway b {
  color: var(--ink);
  font-weight: 600;
}

.scroll-hint {
  margin: 28px 0 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  font-style: normal;
  text-transform: uppercase;
}

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 76px 28px 100px;
}

.letter,
.article {
  margin: 0;
}

.letter h2,
.article h2,
.gloss-h {
  max-width: 760px;
  margin: 0 0 24px;
  color: var(--ink);
  font-size: clamp(28px, 4vw, 43px);
  line-height: 1.14;
}

.letter p {
  max-width: 760px;
  margin: 0 0 18px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 20px;
  line-height: 1.72;
}

.letter p.lead {
  color: var(--ink);
  font-size: 23px;
}

.article p {
  margin: 0 0 18px;
  color: var(--ink-soft);
}

.caravan {
  display: flex;
  max-width: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 66px 0;
  opacity: 1;
}

.caravan::before,
.caravan::after {
  content: "";
  width: min(180px, 22vw);
  height: 1px;
  background: var(--line);
}

.caravan .d {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--ink-soft);
}

.caravan .hx {
  width: 10px;
  height: 10px;
  background: var(--accent);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.glossary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.root {
  position: relative;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: color-mix(in srgb, var(--paper) 76%, var(--chalk));
}

.root .ar {
  margin-bottom: 12px;
  color: var(--accent);
  font-family: "Noto Naskh Arabic", serif;
  font-size: 42px;
  line-height: 1;
}

.root .tl {
  color: var(--ink);
  font-size: 20px;
}

.root .pr,
.root .ln {
  color: var(--ink-soft);
  font-size: 14px;
}

.root .pr {
  margin: 2px 0 12px;
  font-family: var(--mono);
}

.root .ln {
  margin: 0 0 7px;
  line-height: 1.6;
}

.root .ln b,
.root .ch {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.sgn,
.qlist {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.sgn li,
.qlist li {
  position: relative;
  padding: 7px 0 7px 18px;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 17px;
  font-style: italic;
}

.sgn li::before,
.qlist li::before {
  content: "◇";
  position: absolute;
  top: 7px;
  left: 0;
  color: var(--accent);
}

.pull {
  max-width: 760px;
  margin: 44px 0;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.35;
  text-align: left;
  text-transform: none;
}

.pull span {
  background: none;
  color: inherit;
}

.method {
  counter-reset: method;
}

.step {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 18px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.step .no {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  background: var(--accent);
  color: var(--chalk);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.step .bd h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 20px;
}

.step .bd p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.toolindex {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.ti-card {
  display: grid;
  min-height: 92px;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--sans);
  text-align: left;
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.ti-card:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  transform: translateY(-2px);
}

.ti-card:focus-visible,
.btn:focus-visible,
.fpill:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 3px;
}

.ti-card .n {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  background: var(--accent);
  color: var(--chalk);
  font-family: var(--mono);
  font-size: 11px;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.ti-card .t {
  display: block;
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  text-transform: none;
}

.ti-card .s {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.45;
}

.toolpanel {
  position: relative;
  margin-top: 18px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: color-mix(in srgb, var(--paper) 68%, var(--chalk));
}

.toolpanel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 30px;
  width: 84px;
  height: 4px;
  background: var(--accent);
}

.tp-h {
  margin-bottom: 26px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tp-h .t {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.2;
}

.tp-h .s {
  margin-top: 5px;
  color: var(--ink-soft);
  font-family: var(--display);
  font-size: 17px;
  font-style: italic;
}

.tp-sec {
  margin-bottom: 24px;
}

.tp-sec > .tl {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.tp-grid,
.opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
}

.tp-field {
  margin-bottom: 14px;
}

.tp-field label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}

input[type="text"],
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--chalk);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
}

textarea {
  min-height: 76px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: #8A8C88;
}

.opts label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
}

.opts input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.doorbox {
  padding: 17px 19px;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--chalk));
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  font-style: italic;
}

.tp-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
}

.tp-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.tp-table th {
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  text-align: left;
  text-transform: uppercase;
}

.tp-table td {
  min-width: 145px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.tp-table textarea {
  min-height: 90px;
  border: 0;
}

.tp-actions,
.deck-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  transition: background .15s ease, color .15s ease;
}

.btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.btn-solid {
  background: var(--accent);
  color: var(--chalk);
}

.btn-solid:hover {
  background: color-mix(in srgb, var(--accent) 88%, var(--pitch));
}

.saved {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  opacity: 0;
  transition: opacity .2s ease;
}

.saved.show {
  opacity: 1;
}

.howto {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 28px;
}

.closing {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.closing .q {
  color: var(--ink);
  font-family: var(--display);
  font-size: 23px;
  font-style: italic;
  line-height: 1.55;
}

.src-note {
  max-width: 660px;
  margin: 20px auto 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
  text-align: center;
}

footer {
  margin: 0;
  padding: 30px 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
  text-align: center;
  text-transform: uppercase;
}

footer p {
  margin: 0;
}

@media (max-width: 720px) {
  nav {
    align-items: flex-start;
    padding: 10px 16px;
  }

  .nav-tag {
    max-width: 46%;
    font-size: 9px;
    line-height: 1.4;
  }

  header {
    min-height: 620px;
    padding: 76px 20px 58px;
  }

  h1 {
    font-size: clamp(43px, 15vw, 68px);
  }

  main {
    padding: 58px 18px 80px;
  }

  .glossary,
  .toolindex,
  .tp-grid,
  .opts,
  .howto {
    grid-template-columns: 1fr;
  }

  .toolpanel {
    padding: 24px 18px;
  }

  .tp-actions,
  .deck-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

@media print {
  nav,
  .scroll-hint,
  #toolIndex,
  .tp-actions,
  .deck-actions,
  .howto-wrap,
  .closing-wrap,
  footer,
  .printhide {
    display: none !important;
  }

  body,
  main,
  .toolpanel {
    background: var(--press-white) !important;
    color: #111 !important;
  }

  header,
  .letter,
  .article:not(.keepprint) {
    display: none !important;
  }

  main {
    max-width: 100%;
    padding: 0;
  }

  .toolpanel {
    border: 1px solid #aaa;
    box-shadow: none;
  }
}
