/* davidsing.com — practice site.
   Plain CSS. No framework, no build step. Mobile first: every rule below is written
   for a 360px phone, and the media queries only ADD room. The reader we are designing
   for is often 55+, on a mid-range Android, holding the phone at arm's length. So:
   big type, high contrast, large tap targets, nothing clever. */

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

html {
  /* Slightly larger base than the 17px design system default. This page is one
     letter, read by older eyes, and it can afford the size. */
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A soft warm wash at the top so the paper does not read as flat white-ish grey. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 60vh;
  background: var(--hero-glow);
  pointer-events: none;
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 46rem;          /* the sheet */
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-6);
}

@media (min-width: 40em) {
  .page { padding: var(--space-6) var(--space-4) var(--space-7); }
}

/* Skip link — first focusable thing on the page. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  font-weight: 600;
}
.skip:focus { left: var(--space-3); top: var(--space-3); z-index: 10; }


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

.letterhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

@media (min-width: 34em) {
  .letterhead {
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: var(--space-4);
  }
}

.letterhead__eyebrow {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin: 0 0 var(--space-1);
}

.letterhead__name {
  font-family: var(--font-serif);
  font-size: var(--fs-xl);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -.01em;
  margin: 0;
  color: var(--text);
}

@media (min-width: 34em) {
  .letterhead__name { font-size: var(--fs-2xl); }
}

.letterhead__role {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-base);
  color: var(--text-dim);
  line-height: 1.45;
}


/* -------------------------------------------------------------- portrait slot
   PLACEHOLDER STATE. Drop a real photo in and delete the .portrait__placeholder
   block from the HTML; the <img> is already sized and styled below. */

.portrait {
  flex: 0 0 auto;
  width: 132px;
  height: 158px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
  position: relative;
}

@media (min-width: 34em) {
  .portrait { width: 150px; height: 180px; }
}

.portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;   /* bias toward the eyes, not the chin */
}

/* The visible "no photo yet" state. Deliberately obvious, not a broken image. */
.portrait--empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3);
  text-align: center;
  background: var(--accent-soft);
  border: 2px dashed var(--accent-line);
  box-shadow: none;
}

.portrait--empty svg { width: 44px; height: 44px; color: var(--accent); opacity: .55; }

.portrait__note {
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-2);
}


/* ------------------------------------------------------------------ the letter
   Serif, generous measure, unhurried. This is the whole point of the page. */

.letter {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.72;
  color: var(--text);
  max-width: 36em;            /* ~62-66 characters at this size */
  margin: 0 auto;
}

@media (min-width: 40em) {
  .letter { font-size: 1.3rem; line-height: 1.75; }
}

.letter p { margin: 0 0 var(--space-4); }

/* The opening line carries the news. Give it a little more presence. */
.letter p:first-of-type { font-size: 1.08em; }

/* Signature block. The en dash here is intentional and correct. */
.signature {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.signature__name {
  font-family: var(--font-serif);
  font-size: 1.1em;
  font-weight: 600;
  margin: 0;
}

.signature__cred {
  margin: var(--space-1) 0 0;
  font-family: var(--font);
  font-size: var(--fs-sm);
  color: var(--text-faint);
  letter-spacing: .01em;
}


/* -------------------------------------------------------------------- the form */

.signup {
  margin-top: var(--space-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-4) var(--space-3);
}

@media (min-width: 40em) {
  .signup { padding: var(--space-5); }
}

.signup__title {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 var(--space-2);
}

.signup__lede {
  margin: 0 0 var(--space-4);
  color: var(--text-dim);
  font-size: var(--fs-md);
  line-height: 1.55;
}

.field { margin-bottom: var(--space-4); }

.field > label {
  display: block;
  font-weight: 600;
  font-size: var(--fs-md);
  margin-bottom: var(--space-2);
  color: var(--text);
}

.field__opt {
  font-weight: 400;
  color: var(--text-faint);
  font-size: var(--fs-sm);
}

.field__help {
  margin: var(--space-2) 0 0;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  line-height: 1.5;
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  font-family: var(--font);
  font-size: 1.05rem;          /* >=16px in CSS px so iOS never zooms on focus */
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px var(--space-3);
  min-height: 54px;            /* large tap target */
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.field textarea {
  min-height: 130px;
  resize: vertical;
}

.field input:hover,
.field textarea:hover { border-color: var(--accent-line); }

.field input:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}

/* Per-field validation message, filled in by JS. */
.field__error {
  display: none;
  margin: var(--space-2) 0 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--danger);
}
.field[data-invalid] .field__error { display: block; }
.field[data-invalid] input,
.field[data-invalid] textarea { border-color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 58px;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 999px;
  box-shadow: var(--glow);
  cursor: pointer;
  transition: background-color .15s ease, transform .08s ease;
}

.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn[disabled] { opacity: .6; cursor: progress; }

.privacy {
  margin: var(--space-3) 0 0;
  font-size: var(--fs-sm);
  line-height: 1.55;
  color: var(--text-dim);
  text-align: center;
}

/* Status region. Empty by default; JS fills it and it is aria-live. */
.status:not(:empty) {
  margin-top: var(--space-4);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.5;
  border: 1px solid transparent;
}
.status[data-state="error"] {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

/* The success state REPLACES the form. It is a reply from him, so it is serif. */
.thanks {
  text-align: center;
  padding: var(--space-5) var(--space-3);
}
/* JS moves focus here so a screen reader announces the confirmation. That focus is
   programmatic, never keyboard-driven, so the default focus ring is just a stray
   black box around the thank-you. Drop the ring, keep the announcement. */
.thanks:focus { outline: none; }
.thanks__mark {
  width: 56px; height: 56px;
  margin: 0 auto var(--space-3);
  border-radius: 999px;
  background: var(--tier-strong-bg);
  color: var(--tier-strong);
  display: flex; align-items: center; justify-content: center;
}
.thanks__mark svg { width: 30px; height: 30px; }
.thanks h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-lg);
  font-weight: 600;
  margin: 0 0 var(--space-2);
}
.thanks p {
  margin: 0;
  color: var(--text-dim);
  font-size: var(--fs-md);
  line-height: 1.55;
}

.hidden { display: none !important; }


/* ---------------------------------------------------------------------- footer */

.foot {
  margin-top: var(--space-6);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--text-faint);
  line-height: 1.6;
}
.foot p { margin: 0 0 var(--space-1); }


/* ----------------------------------------------------------------------- print
   A patient may well print this letter. Give them the letter, not the chrome. */

@media print {
  body::before, .skip, .signup, .foot { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .page { max-width: none; padding: 0; }
  .letter { font-size: 12pt; line-height: 1.55; max-width: none; }
  .portrait { box-shadow: none; border: 1px solid #999; }
  .portrait--empty { display: none; }
  .letterhead { border-bottom: 1px solid #999; }
}
