/* Colors from the Worn iOS app (Theme.swift). */
:root {
  --worn-text-green: #0f421c;   /* WornTextGreen: rgb(15, 66, 28) */
  --worn-light-green: #04bd04;  /* WornLightGreen: rgb(4, 189, 4) */
  --panel: rgba(14, 14, 16, 0.9);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f2f2f4;
  --muted: #c4c4cc;
  --link: var(--worn-light-green);
  --focus: #ffd166;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: #e8e6e3;
}

/* Same as the app's wornBackground(): the landing photo with a 65% white layer on top.
   A fixed layer is used instead of background-attachment: fixed, which iOS Safari ignores. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: #e8e6e3;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.65)),
    url("/images/background-1080.jpg");
  background-size: cover;
  background-position: center;
}

@media (min-width: 64rem) {
  body::before {
    background-image:
      linear-gradient(rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.65)),
      url("/images/background-1864.jpg");
  }
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Chalkboard SE", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  padding: 0.5rem 0.875rem;
  background: #0e0e10;
  color: var(--text);
  border-radius: 0.5rem;
  z-index: 10;
}

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

.site-header,
main,
.site-footer {
  max-width: calc(70ch + 2.5rem);
  margin-left: auto;
  margin-right: auto;
}

.site-header,
main {
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
}

.site-header {
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: 0.5rem;
  text-align: center;
}

.logo-link {
  display: inline-block;
  border-radius: 0.5rem;
}

.logo {
  display: block;
  width: 220px;
  max-width: 60vw;
  height: auto;
}

main {
  padding-bottom: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  padding: 1.25rem;
  margin: 0 0 1rem;
}

.site-footer.panel {
  margin: 0 auto max(1.5rem, env(safe-area-inset-bottom));
  width: calc(100% - 1.5rem);
  color: var(--muted);
  font-size: 0.9375rem;
}

.footer-links {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.site-footer li + li {
  margin-top: 0;
}

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

a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
}

/* Two-tone ring so focus is visible on both the light background and the dark panels. */
a:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--worn-text-green);
}

a:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--worn-text-green);
}

h1,
h2,
h3 {
  line-height: 1.25;
  scroll-margin-top: 1rem;
}

h1 {
  font-size: 1.75rem;
  margin: 0.25rem 0 0.75rem;
}

h2 {
  font-size: 1.3125rem;
  margin: 2.25rem 0 0.75rem;
}

h3 {
  font-size: 1.125rem;
  margin: 1.75rem 0 0.5rem;
}

.panel > h2:first-child {
  margin-top: 0;
}

p,
ul,
ol {
  margin: 0 0 1rem;
}

.panel > :last-child {
  margin-bottom: 0;
}

ul,
ol {
  padding-left: 1.375rem;
}

li + li {
  margin-top: 0.375rem;
}

hr {
  border: 0;
  border-top: 1px solid var(--panel-border);
  margin: 2rem 0;
}

strong {
  font-weight: 700;
}

.link-list {
  list-style: none;
  padding-left: 0;
}

.doc-meta {
  color: var(--muted);
  font-size: 0.9375rem;
}

.doc-meta p {
  margin: 0;
}

.doc-meta strong {
  color: var(--text);
}

.toc {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.toc h2 {
  font-size: 1.0625rem;
  margin: 0 0 0.5rem;
}

.toc ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.toc li + li {
  margin-top: 0.25rem;
}

/* Tabs: real links styled as the app's green buttons. */
.tabs ul {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.tabs li + li {
  margin-top: 0;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--worn-light-green);
  border-radius: 0.875rem;
  background: var(--panel);
  color: var(--text);
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.tab:hover {
  background-image: linear-gradient(rgba(4, 189, 4, 0.25), rgba(4, 189, 4, 0.25));
}

.tab[aria-current="page"] {
  background: var(--worn-light-green);
  color: var(--worn-text-green);
}

.contact-links {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.contact-links li + li {
  margin-top: 0.75rem;
}

.contact-links a {
  display: inline-block;
  text-decoration: none;
}

.contact-label {
  display: block;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.contact-address {
  display: block;
  color: var(--text);
}

@media (min-width: 40rem) {
  body {
    font-size: 1.125rem;
  }

  h1 {
    font-size: 2.125rem;
  }

  .panel {
    padding: 1.75rem 2rem;
  }

  .logo {
    width: 260px;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
