/* cmoel.com
 *
 * One red palette, light and dark. Type is the system's default
 * sans serif, so the page looks native wherever it lands, with
 * nothing to download.
 */

:root {
  color-scheme: light dark;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text",
               "Segoe UI", Roboto, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

body {
  --paper:     light-dark(#fee2e2, #7f1d1d);
  --ink:       light-dark(#991b1b, #fee2e2);
  --accent:    light-dark(#7f1d1d, #fef2f2);
  --button-bg: light-dark(#7f1d1d, #fee2e2);
  --button-fg: light-dark(#fef2f2, #7f1d1d);

  --rule:    color-mix(in oklab, var(--ink) 30%, transparent);
  --surface: color-mix(in oklab, var(--ink) 8%, var(--paper));
  --soft:    color-mix(in oklab, var(--ink) 80%, var(--paper));
}

/* ---- Foundations ----------------------------------------------------- */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

p {
  margin-block: 0 1rem;
  max-width: 60ch;
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;

  &:hover { text-decoration-thickness: 2px; }
}

strong { font-weight: 700; }

:where(h1, h2, h3) {
  margin-block: 0 1rem;
  line-height: 1.15;
  text-wrap: balance;
  color: inherit;
}

h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
}

h2 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  font-weight: 700;
}

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

/* ---- Home page --------------------------------------------------------- */

.almanac {
  max-width: 38rem;
  padding: 1rem 1rem 3rem;
}

.masthead {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-block-end: 2rem;
}

.masthead h1 { margin-block: 0; }

.headshot {
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 9999px;
  object-fit: cover;
}

.bio p { margin-block-end: 0; }

/* ---- Send me a note ---------------------------------------------------- */

.write h2 { margin-block-end: 1.5rem; }

.thanks { margin-block-end: 0; }

.form-error { margin-block-end: 1.5rem; }

.quiet-button {
  display: inline-block;
  font: inherit;
  font-size: 0.9375rem;
  color: inherit;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.4em 1.1em;
  text-decoration: none;
  cursor: pointer;

  &:hover { border-color: var(--accent); }

  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }

  &:disabled {
    opacity: 0.45;
    cursor: not-allowed;
  }

  &:disabled:hover { border-color: var(--rule); }
}

.field {
  margin-block-end: 1.25rem;

  & label {
    display: block;
    font-size: 0.875rem;
    color: var(--soft);
    margin-block-end: 0.25rem;
  }

  & input,
  & textarea {
    width: 100%;
    font: inherit;
    color: inherit;
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 0.4em 0.6em;
  }

  & textarea { resize: vertical; }

  & input:focus-visible,
  & textarea:focus-visible {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
  }

  & [aria-invalid="true"] {
    border-color: var(--ink);
    box-shadow: 0 0 0 1px var(--ink);
  }
}

.field-error {
  display: block;
  margin-block-start: 0.35rem;
  font-size: 0.8125rem;
  font-style: italic;
}

.muted {
  opacity: 0.65;
  font-size: 0.8125rem;
}

/* ---- Arrival ----------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .almanac > * {
    opacity: 0;
    animation: settle 0.8s cubic-bezier(0.22, 0.61, 0.36, 1) forwards;
  }

  .almanac > *:nth-child(2) { animation-delay: 0.08s; }
  .almanac > *:nth-child(3) { animation-delay: 0.16s; }
  .almanac > *:nth-child(4) { animation-delay: 0.24s; }
  .almanac > *:nth-child(5) { animation-delay: 0.32s; }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---- Device pages (/apps and the UDID flow) ----------------------------- */

.page-narrow {
  max-width: 28rem;
  margin-inline: auto;
  padding-block: 3rem;
  padding-inline: 1.5rem;
  text-align: center;
}

.page-narrow p { margin-inline: auto; }

.button {
  display: inline-block;
  background: var(--button-bg);
  color: var(--button-fg);
  font: 700 1.125rem/1 var(--font-sans);
  padding: 1rem 2rem;
  border-radius: 9999px;
  text-decoration: none;
  margin-block: 1rem;

  &:hover { opacity: 0.92; }
}

.steps {
  text-align: left;
  margin-block: 2.5rem 0;
  padding-inline-start: 1.5rem;
  font-size: 0.9375rem;
  opacity: 0.85;

  & > li + li { margin-top: 0.5rem; }
}

.udid {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-block: 1.5rem 2rem;
  word-break: break-all;
  font: 0.875rem/1.4 var(--font-mono);
  user-select: all;
}
