/*
  At Home with Jessi: styles (shared by index.html and es/index.html)

  Design rules (details in README.md):
  - Big type and high contrast. Readers are older adults and their families,
    so legibility comes first. Every text color passes WCAG AAA (7:1) in
    both themes.
  - The one bold element is the warm 1970s "retro sunset stripes" around the
    page and the headshot. Everything else stays quiet.
  - Body text is Atkinson Hyperlegible Next (Braille Institute, designed for
    low-vision readers). Headings use Fraunces, whose soft forms come from
    Windsor, Souvenir, and Cooper, the faces of 1970s signs and ads.
  - No images except his real photo. All graphics are CSS or hand-coded SVG.

  Themes:
  - Light is the default for everyone: dark text on a light background reads
    best for older eyes. The page ignores the device's dark setting on purpose.
  - Dark applies only when the visitor picks it with the toggle (theme.js puts
    data-theme="dark" on <html>). The dark block is screen-only, so printing
    always uses the light colors.
*/

/* ---------- Tokens: light theme ---------- */

:root {
  color-scheme: light;

  /* 70s stripes, inside to outside. Same in both themes. */
  --gold:   #F4B41A;
  --orange: #EE7B22;
  --rust:   #C8431E;
  --brown:  #6A3418;

  --paper:        #FFFFFF;
  --ink:          #2B1A10;   /* body text, 16.7:1 on paper */
  --muted:        #5A4636;   /* secondary text, 8.9:1 */
  --heading:      #6A3418;   /* name, headings, links, 9.9:1 */
  --button-bg:    #6A3418;
  --button-text:  #FFFFFF;   /* 9.9:1 on the button */
  --button-hover: #4F2610;
  --tint:         #FBEBD0;   /* hover fill for outlined buttons */
  --rule:         #EADBC8;
  --focus:        #C8431E;   /* focus ring, 4.9:1 against the page */
  --flag-edge:    transparent;

  --stripe: 10px;      /* width of each page-frame stripe */
  --ring:   6px;       /* width of each headshot stripe */
  --radius: 44px;      /* page-frame corner radius */

  --font-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", Verdana, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
}

/* ---------- Tokens: dark theme (only when the visitor chooses it) ---------- */

@media screen {
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper:        #1D130C;
    --ink:          #F7ECDF;   /* 15.7:1 on paper */
    --muted:        #DCCAB6;   /* 11.4:1 */
    --heading:      #F4B41A;   /* 9.9:1 */
    --button-bg:    #F4B41A;
    --button-text:  #1D130C;   /* 9.9:1 on the button */
    --button-hover: #FFC844;
    --tint:         #3B2817;
    --rule:         #4D3828;
    --focus:        #F7ECDF;
    --flag-edge:    rgba(247, 236, 223, 0.45);
  }
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  /* Sides and bottom leave room for the four frame stripes */
  padding: 1rem calc(var(--stripe) * 4 + 28px) calc(var(--stripe) * 4 + 28px);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(1.25rem, 1.15rem + 0.4vw, 1.375rem); /* 20px on phones, 22px on desktops */
  line-height: 1.6;
}

p {
  max-width: 60ch;
}

a {
  color: var(--heading);
  text-underline-offset: 0.15em;
}

/* One visible focus style for every link and button */
:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -10rem;
  left: 1rem;
  z-index: 10;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

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

/* ---------- Language and display controls ---------- */

.site-tools {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  /* Spans the frame plus its stripes, so the controls line up with the outer
     stripe: centered on wide screens, reaching into the body padding on narrow ones. */
  margin: 0 0 calc(var(--stripe) * 4 + 1rem);
  margin-inline: max(calc(var(--stripe) * -4), calc((100% - 60rem - var(--stripe) * 8) / 2));
}

.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;              /* 48px to tap */
  padding: 0.5rem 1rem;
  border: 2px solid var(--ink);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}

.tool:hover {
  background: var(--tint);
}

/* `hidden` must win over display: inline-flex */
.tool[hidden] {
  display: none;
}

.tool-icon {
  flex: none;
  width: 1.3em;
  height: 1.3em;
}

/* The toggle shows a moon while light (switches to dark) and a sun while dark */
.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

/* ---------- Page frame: the 70s stripes ---------- */

.frame {
  max-width: 60rem;
  margin: 0 auto;
  padding: 3rem 3.5rem 2.5rem;
  border-radius: var(--radius);
  background: var(--paper);
  /* Four concentric stripes. A box-shadow's spread follows the rounded
     corners, which gives the classic rounded 70s stripe without any images. */
  box-shadow:
    0 0 0 calc(var(--stripe) * 1) var(--gold),
    0 0 0 calc(var(--stripe) * 2) var(--orange),
    0 0 0 calc(var(--stripe) * 3) var(--rust),
    0 0 0 calc(var(--stripe) * 4) var(--brown);
}

/* ---------- Masthead ---------- */

.masthead {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "wordmark badge"
    "role     role";
  column-gap: 1.5rem;
  align-items: start;
}

.wordmark {
  grid-area: wordmark;
  margin: 0;
  color: var(--heading);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1.75rem + 3vw, 3.75rem);
  font-weight: 800;
  font-variation-settings: "SOFT" 100;
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.role {
  grid-area: role;
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 1.1em;
}

/* A label, not a button: no border, so nobody tries to tap it */
.welcome-badge {
  grid-area: badge;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.6rem 0 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.3;
}

/* Classic six-stripe rainbow flag, drawn in CSS */
.pride-flag {
  display: inline-block;
  flex: none;
  width: 2.1rem;
  height: 1.4rem;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--flag-edge);   /* defines the edge on the dark page */
  background: linear-gradient(
    to bottom,
    #E40303 0 16.67%,
    #FF8C00 16.67% 33.33%,
    #FFED00 33.33% 50%,
    #008026 50% 66.67%,
    #24408E 66.67% 83.33%,
    #732982 83.33% 100%
  );
}

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

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 2.75rem;
  align-items: center;
  margin-top: 2.5rem;
}

.headshot {
  display: block;
  width: 240px;
  height: 240px;
  /* Margin leaves room for the stripe rings */
  margin: calc(var(--ring) * 4);
  border-radius: 50%;
  object-fit: cover;
  box-shadow:
    0 0 0 calc(var(--ring) * 1) var(--gold),
    0 0 0 calc(var(--ring) * 2) var(--orange),
    0 0 0 calc(var(--ring) * 3) var(--rust),
    0 0 0 calc(var(--ring) * 4) var(--brown);
}

.slogan {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 1.6rem + 3.5vw, 4rem);
  font-weight: 700;
  font-variation-settings: "SOFT" 100;
  line-height: 1.05;
  text-wrap: balance;
}

.lede {
  margin: 1rem 0 0;
}

.other-language {
  margin: 1.25rem 0 0;
  font-weight: 700;
}

/* ---------- Buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.75rem;
}

.button {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 0.35em;
  min-height: 3.75rem;           /* at least 60px to tap */
  padding: 0.7rem 1.4rem;
  border: 3px solid var(--button-bg);
  border-radius: 14px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

/* Never split a phone number; the email may only break after the @ (<wbr>) */
.button-value.phone,
.nowrap {
  white-space: nowrap;
}

.button-primary {
  background: var(--button-bg);
  color: var(--button-text);
}

.button-primary:hover {
  border-color: var(--button-hover);
  background: var(--button-hover);
}

.button-secondary {
  border-color: var(--heading);
  background: var(--paper);
  color: var(--heading);
}

.button-secondary:hover {
  background: var(--tint);
}

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

main > section + section {
  margin-top: 4rem;
}

h2 {
  margin: 0 0 1.25rem;
  color: var(--heading);
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.5rem + 1.5vw, 2.5rem);
  font-weight: 700;
  font-variation-settings: "SOFT" 100;
  line-height: 1.15;
}

/* Services */
.services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.75rem 3rem;
  margin: 0;
}

.services > div {
  padding-top: 0.9rem;
  border-top: 3px solid var(--gold);
}

.services dt {
  font-weight: 700;
  font-size: 1.1em;
}

.services dd {
  margin: 0.2rem 0 0;
}

/* About */
.about p {
  margin: 0 0 1rem;
}

.facts {
  display: grid;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  font-weight: 700;
}

/* The dot is positioned, not a flex item, so lines with several tagged
   phrases (like the Spanish registration line) can still wrap normally. */
.facts li {
  position: relative;
  padding-left: 1.5rem;
}

.facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(0.8em - 0.35rem);   /* centered on the first line */
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--orange);
}

/* Contact */
.contact p {
  margin: 0;
}

.contact .area {
  margin-top: 1.5rem;
  font-weight: 700;
}

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

.footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 2px solid var(--rule);
  color: var(--muted);
  font-size: 1rem;
}

.footer p {
  margin: 0;
}

/* ---------- Tablets and phones ---------- */

@media (max-width: 48rem) {
  :root {
    --stripe: 6px;
    --ring: 4.5px;
    --radius: 30px;
  }

  body {
    padding: 0.75rem calc(var(--stripe) * 4 + 12px) calc(var(--stripe) * 4 + 12px);
  }

  /* Controls sit side by side as two equal buttons, and stack on very narrow screens */
  .site-tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr));
  }

  .tool {
    font-size: 1.0625rem;
    padding: 0.5rem 0.75rem;
  }

  .frame {
    padding: 1.75rem 1.4rem 1.5rem;
  }

  .masthead {
    grid-template-columns: 1fr;
    grid-template-areas:
      "badge"
      "wordmark"
      "role";
  }

  .welcome-badge {
    margin: 0 0 1rem;
  }

  .hero {
    grid-template-columns: 1fr;
    row-gap: 1rem;
    margin-top: 1.75rem;
  }

  .headshot {
    width: 180px;
    height: 180px;
  }

  .services {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .actions {
    flex-direction: column;
  }

  main > section + section {
    margin-top: 3rem;
  }

  /* On phones each button reads as two lines: what it does, then the number or address */
  .button {
    flex-direction: column;
    row-gap: 0.1rem;
    padding: 0.75rem 1rem;
  }

  .button-label {
    font-weight: 400;
  }

  .button-value.email {
    font-size: 0.85em;
  }
}

/* Small phones: thinner stripes so the content gets more width */
@media (max-width: 30rem) {
  :root {
    --stripe: 5px;
    --ring: 4px;
    --radius: 26px;
  }

  body {
    padding: 0.75rem calc(var(--stripe) * 4 + 8px) calc(var(--stripe) * 4 + 8px);
  }

  .frame {
    padding: 1.5rem 1.1rem 1.25rem;
  }
}

/* ---------- Windows High Contrast and other forced-color modes ---------- */

@media (forced-colors: active) {
  .frame {
    border: 4px solid CanvasText;
  }

  .pride-flag {
    forced-color-adjust: none;   /* keep the flag's colors */
  }
}

/* ---------- Print: always light, no controls ---------- */

@media print {
  body {
    padding: 0;
    font-size: 12pt;
  }

  .site-tools,
  .skip-link {
    display: none;
  }

  .frame {
    max-width: none;
    padding: 0;
    box-shadow: none;
  }

  .button {
    min-height: 0;
    border: 1pt solid #000000;
    background: none;
    color: #000000;
  }
}
