/* Dr J L Richenberg Ltd :: quiet practice
   A narrow reading column, side notes in the margin, a dot index on the left. */

:root {
  --paper: #FCFCFA;
  --teal: #2C5F6B;
  --lilac: #E8E6F2;
  --plum: #4B2E4F;
  --ink: #2A2230;
  --thread: #D6D2E4;
  --column: 34rem;
  --margin-note: 14rem;
  --margin-gap: 3rem;
  --serif: "Spectral", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --sans: "Catamaran", "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.1875rem;
  line-height: 1.7;
}

a { color: var(--teal); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--plum); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--plum); outline-offset: 4px; border-radius: 2px; }

.skip { position: absolute; left: 1rem; top: -4rem; padding: 0.5rem 0.9rem; background: var(--plum); color: #fff; z-index: 40; }
.skip:focus { top: 1rem; }

/* ---- the shared reading measure ---- */

.measure {
  max-width: calc(var(--column) + 2.5rem);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ---- letterhead ---- */

.letterhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--thread);
}
.letterhead__name {
  min-width: 0;
  color: var(--plum);
  font-family: var(--serif);
  font-size: 1.1875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.25;
  text-decoration: none;
}
.letterhead__name:hover { color: var(--teal); }
.letterhead__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  flex: none;
  min-height: 2.875rem;
  padding: 0.4rem 0.95rem;
  border: 1px solid var(--teal);
  border-radius: 2rem;
  background: transparent;
  color: var(--teal);
  font: 600 1rem/1 var(--sans);
  cursor: pointer;
}
.letterhead__toggle:hover { background: var(--lilac); }
.letterhead__toggle i { display: grid; gap: 4px; }
.letterhead__toggle i::before,
.letterhead__toggle i::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.letterhead__toggle[aria-expanded="true"] { background: var(--teal); color: #fff; }
.letterhead__toggle[aria-expanded="true"] i::before,
.letterhead__toggle[aria-expanded="true"] i::after { background: #fff; }
html:not(.js) .letterhead__toggle { display: none; }

/* ---- margin dot index ---- */

.dot-index { max-width: calc(var(--column) + 2.5rem); margin-inline: auto; padding: 0.5rem 1.25rem 1rem; border-bottom: 1px solid var(--thread); }
html.js .dot-index:not([data-open]) { display: none; }
.dot-index ol { margin: 0; padding: 0; list-style: none; }
.dot-index a {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 2.875rem;
  color: var(--ink);
  font-size: 1.0625rem;
  line-height: 1.2;
  text-decoration: none;
}
.dot-index a::before {
  content: "";
  flex: none;
  width: 0.7rem;
  height: 0.7rem;
  border: 1.5px solid var(--teal);
  border-radius: 50%;
  background: var(--paper);
  transition: background-color 0.2s ease, transform 0.2s ease;
}
.dot-index a:hover { color: var(--teal); }
.dot-index a:hover::before { background: var(--lilac); transform: scale(1.25); }
.dot-index a[aria-current="page"] { color: var(--plum); font-weight: 700; }
.dot-index a[aria-current="page"]::before { background: var(--plum); border-color: var(--plum); }

/* ---- title block ---- */

.opening { padding-block: clamp(2.75rem, 9vw, 6rem) clamp(1.5rem, 5vw, 3rem); }
.opening__folio {
  margin: 0 0 1.25rem;
  color: var(--teal);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(2.3rem, 7.5vw, 3.6rem);
  font-weight: 300;
  line-height: 1.1;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
h1 em { font-style: italic; color: var(--teal); }
.opening__lead {
  margin: 1.5rem 0 0;
  font-family: var(--serif);
  font-size: clamp(1.25rem, 3.4vw, 1.45rem);
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
}

/* ---- passages ---- */

.passage { padding-block: clamp(1.75rem, 5vw, 2.75rem); border-top: 1px solid var(--thread); }
.passage > h2 {
  position: relative;
  margin: 0 0 1rem;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.4vw, 1.85rem);
  font-weight: 400;
  line-height: 1.2;
}
.numeral {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  margin-right: 0.6rem;
  border: 1px solid var(--teal);
  border-radius: 50%;
  color: var(--teal);
  font: 600 0.875rem/1 var(--sans);
  vertical-align: 0.2em;
}
.passage p { margin: 0 0 1.15rem; }
.passage p:last-child { margin-bottom: 0; }

/* footnote-style side notes */
.ref {
  margin-left: 0.1em;
  color: var(--teal);
  font-size: 0.75em;
  font-weight: 700;
  vertical-align: super;
  line-height: 0;
}
.noted { position: relative; margin: 0 0 1.15rem; }
.noted:last-child { margin-bottom: 0; }
.passage .noted > p { margin: 0; }
.sidenote {
  display: block;
  margin: 0.9rem 0 0.2rem;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 2px solid var(--lilac);
  color: #4A4254;
  font-family: var(--sans);
  font-size: 1rem;
  font-style: normal;
  line-height: 1.55;
}
.sidenote b { margin-right: 0.35rem; color: var(--teal); font-weight: 700; }

/* plain lists with small numbered markers */
.counted { margin: 0; padding: 0; list-style: none; counter-reset: c; }
.counted li { position: relative; counter-increment: c; padding: 0.7rem 0 0.7rem 2.5rem; border-bottom: 1px solid var(--lilac); }
.counted li:first-child { border-top: 1px solid var(--lilac); }
.counted li::before {
  content: counter(c);
  position: absolute;
  left: 0;
  top: 0.95rem;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: var(--lilac);
  color: var(--plum);
  font: 700 0.8125rem/1 var(--sans);
}

/* home: page list */
.ways { margin: 0; padding: 0; list-style: none; }
.ways li { border-bottom: 1px solid var(--thread); }
.ways li:first-child { border-top: 1px solid var(--thread); }
.ways a { display: block; padding: 1.1rem 2.2rem 1.1rem 0; position: relative; color: var(--ink); text-decoration: none; }
.ways a::after { content: ""; position: absolute; right: 0.35rem; top: 1.75rem; width: 0.6rem; height: 0.6rem; border-top: 1.5px solid var(--teal); border-right: 1.5px solid var(--teal); transform: rotate(45deg); transition: right 0.2s ease; }
.ways a:hover::after { right: 0; }
.ways strong { display: block; color: var(--plum); font-family: var(--serif); font-size: 1.4rem; font-weight: 500; line-height: 1.25; }
.ways a:hover strong { color: var(--teal); }
.ways span { display: block; margin-top: 0.15rem; font-size: 1.0625rem; line-height: 1.5; }

/* services: the statement */
.statement {
  margin: 0;
  padding: clamp(1.4rem, 5vw, 2.25rem);
  background: var(--lilac);
  border-radius: 4px;
  color: var(--plum);
  font-family: var(--serif);
  font-size: clamp(1.3rem, 4vw, 1.6rem);
  font-style: italic;
  line-height: 1.45;
}

/* appointments: three steps on a thread */
.thread { margin: 0; padding: 0; list-style: none; counter-reset: t; }
.thread li { position: relative; counter-increment: t; padding: 0 0 1.9rem 3.1rem; }
.thread li:last-child { padding-bottom: 0; }
.thread li::before {
  content: counter(t);
  position: absolute;
  left: 0;
  top: 0.05rem;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font: 700 0.9375rem/1 var(--sans);
}
.thread li::after { content: ""; position: absolute; left: calc(1rem - 0.5px); top: 2rem; bottom: 0; width: 1px; background: var(--teal); opacity: 0.45; }
.thread li:last-child::after { display: none; }
.thread h3 { margin: 0 0 0.35rem; color: var(--plum); font-family: var(--serif); font-size: 1.3rem; font-weight: 500; line-height: 1.3; }
.thread p { margin: 0; }

/* practice information: the record */
.record { margin: 0; }
.record > div { padding: 0.95rem 0; border-bottom: 1px solid var(--thread); }
.record > div:first-child { border-top: 1px solid var(--thread); }
.record dt { color: var(--teal); font-size: 0.9375rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; }
.record dd { margin: 0.15rem 0 0; color: var(--plum); font-family: var(--serif); font-size: 1.25rem; line-height: 1.4; overflow-wrap: anywhere; }

/* ---- appointment request helper ---- */

.passage .helper,
.passage .note-form { margin-top: 1.6rem; }

.helper { padding: clamp(1.15rem, 4vw, 1.75rem); background: var(--lilac); border-radius: 6px; }
.helper fieldset { min-width: 0; margin: 0 0 1.4rem; padding: 0; border: 0; }
.helper legend { padding: 0; margin-bottom: 0.6rem; color: var(--plum); font-weight: 700; font-size: 1.0625rem; }
.helper__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip span {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.3rem 1rem;
  border: 1px solid var(--teal);
  border-radius: 2rem;
  background: var(--paper);
  color: var(--teal);
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.1;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.chip input:hover + span { background: #fff; box-shadow: 0 0 0 2px var(--paper); }
.chip input:checked + span { background: var(--teal); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid var(--plum); outline-offset: 3px; }
.helper p.helper__label { margin: 0 0 0.5rem; color: var(--plum); font-weight: 700; font-size: 1.0625rem; }
.helper p.helper__draft {
  margin: 0 0 1.1rem;
  padding: 1rem 1.15rem;
  background: var(--paper);
  border-radius: 4px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.helper__row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.helper__reset { padding: 0.5rem 0; border: 0; background: none; color: var(--teal); font: 600 1rem/1.2 var(--sans); text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }
.helper__reset:hover { color: var(--plum); }
.helper p.helper__caveat { margin: 1.1rem 0 0; font-size: 1rem; line-height: 1.55; color: #3F3848; }

.quiet-button {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  padding: 0.6rem 1.5rem;
  border: 1px solid var(--plum);
  border-radius: 2rem;
  background: var(--plum);
  color: #fff;
  font: 600 1.0625rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.quiet-button:hover { background: var(--paper); color: var(--plum); }

/* ---- contact form ---- */

.note-form { display: grid; gap: 1.5rem; }
.note-form__field { display: grid; gap: 0.3rem; min-width: 0; }
.note-form label { color: var(--plum); font-weight: 700; font-size: 1.0625rem; }
.note-form input,
.note-form textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid #8C8499;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 400 1.125rem/1.5 var(--sans);
}
.note-form textarea { min-height: 13rem; resize: vertical; }
.note-form input:hover,
.note-form textarea:hover { border-color: var(--teal); }
.note-form input:focus,
.note-form textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; border-color: var(--teal); }
.note-form [aria-invalid="true"] { border-color: #8A2C3A; box-shadow: inset 3px 0 0 #8A2C3A; }
.note-form__error { color: #8A2C3A; font-size: 1rem; font-weight: 600; }
.note-form__carried { margin: 0; padding: 0.75rem 1rem; background: var(--lilac); border-radius: 4px; font-size: 1.0625rem; line-height: 1.5; }
.note-form__send { display: grid; gap: 0.9rem; justify-items: start; }
.note-form__send p { margin: 0; font-size: 1.0625rem; line-height: 1.55; }
.note-form__status { padding: 0.75rem 1rem; border: 1px solid var(--teal); border-radius: 4px; color: var(--teal); font-weight: 600; }

/* ---- colophon ---- */

.colophon { margin-top: clamp(2rem, 6vw, 4rem); padding-block: 2rem 3rem; border-top: 3px double var(--thread); font-size: 1.0625rem; line-height: 1.6; }
.colophon__name { margin: 0 0 1rem; color: var(--plum); font-family: var(--serif); font-size: 1.25rem; }
.colophon dl { margin: 0 0 1.5rem; }
.colophon dl > div { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0 1rem; padding: 0.2rem 0; }
.colophon dt { color: var(--teal); font-weight: 700; }
.colophon dd { margin: 0; overflow-wrap: anywhere; }
.colophon ul { display: flex; flex-wrap: wrap; gap: 0 1.4rem; margin: 0; padding: 0; list-style: none; }
.colophon li a { display: inline-block; padding: 0.45rem 0; }

@media (max-width: 26rem) {
  .colophon dl > div { grid-template-columns: minmax(0, 1fr); padding: 0.35rem 0; }
}

/* ---- desktop: index in the left margin, notes in the right ---- */

@media (min-width: 70rem) {
  .measure {
    max-width: none;
    margin-inline: 0;
    padding-inline: 0;
    margin-left: max(17rem, calc(50% - 20rem));
    width: var(--column);
  }

  .letterhead { padding-block: 2.25rem 1.1rem; }
  .letterhead__toggle { display: none; }

  .dot-index,
  html.js .dot-index:not([data-open]) {
    display: block;
    position: fixed;
    top: 50%;
    left: max(1.75rem, calc(50% - 36rem));
    width: 12.5rem;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    transform: translateY(-50%);
  }
  .dot-index ol { position: relative; }
  .dot-index ol::before { content: ""; position: absolute; left: calc(0.35rem - 0.5px); top: 1.4rem; bottom: 1.4rem; width: 1px; background: var(--thread); }
  .dot-index a { position: relative; min-height: 2.75rem; font-size: 1rem; }

  .passage > h2 .numeral { position: absolute; left: -2.6rem; top: 0.25rem; margin: 0; }

  .sidenote {
    position: absolute;
    top: 0.45rem;
    left: calc(100% + var(--margin-gap));
    width: var(--margin-note);
    margin: 0;
    padding: 0.6rem 0 0;
    border-left: 0;
    border-top: 1px solid var(--teal);
    line-height: 1.5;
  }
}

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