/* peyto.org — see docs/design.md */

:root {
  --text: #1a1a1a;
  --text-muted: #6e6e6e;
  --accent: #14707a;
  --hover-bg: #ffffff;
  --hairline: #e3e9ea;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
  /* On html so the gradient covers the viewport even when body is short,
     and does not band or repeat on a long page. */
  min-height: 100%;
  background: linear-gradient(168deg, #ffffff 0%, #f7fafb 42%, #eaf3f4 100%)
    no-repeat fixed;
}

body {
  margin: 0;
  min-height: 100vh; /* fallback for browsers without dvh */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 5vh, 3rem);

  padding: clamp(2rem, 7vw, 5rem) clamp(1.25rem, 5vw, 3rem);
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  padding-bottom: max(2rem, env(safe-area-inset-bottom));

  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* Suppress the grey flash on tap; :active below is the real feedback. */
  -webkit-tap-highlight-color: transparent;
}

/* Header pinned top, footer pinned bottom, content between.
   `margin-block: auto` centres the content when there is room and lets it
   sit naturally from the top when there is not — unlike justify-content:
   center, which clips the top of tall content. One rule serves both the
   launcher and a long page. */
main {
  margin-block: auto;
  width: 100%;
  max-width: 44rem;
}

/* ---------- header ---------- */

.masthead {
  text-align: center;
}

.wordmark {
  display: inline-block;
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: inherit;
  text-decoration: none;
}

.tld {
  color: var(--text-muted);
  font-weight: 400;
}

a.wordmark:hover .tld {
  color: var(--accent);
}

a.wordmark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 3px;
}

.bio {
  margin: 0.6rem auto 0;
  max-width: 32rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  text-wrap: balance;
}

/* ---------- apps ---------- */

.apps {
  list-style: none;
  margin: 0;
  padding: 0;

  display: grid;
  /* Two columns on a phone, then as many as fit. */
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.5rem, 2vw, 1rem);
}

@media (min-width: 34rem) {
  .apps {
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;

  height: 100%;
  min-height: 8.5rem; /* comfortable thumb target */
  padding: 1.5rem 1rem;
  border-radius: 12px;

  color: inherit;
  text-decoration: none;
  text-align: center;

  transition:
    background-color 140ms ease,
    transform 100ms ease;
}

/* Logos vary in aspect ratio; box them so every tile aligns. */
.app-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.app-name {
  font-size: 0.95rem;
}

/* Hover only where a real pointer exists — on touch it sticks after tap. */
@media (hover: hover) {
  .app:hover {
    background: var(--hover-bg);
  }
}

/* The actual touch feedback. */
.app:active {
  background: var(--hover-bg);
  transform: scale(0.97);
}

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

/* ---------- page content ---------- */

.page-title {
  margin: 0 0 1.25rem;
  font-size: clamp(1.25rem, 3.5vw, 1.6rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.prose {
  max-width: 34rem;
  line-height: 1.65;
}

.prose p {
  margin: 0 0 1rem;
}

.prose a {
  color: var(--accent);
  text-underline-offset: 2px;
}

/* Wide content scrolls here, never the page body.
   tabindex="0" on the wrapper so it is reachable by keyboard. */
.scroll {
  overflow-x: auto;
  max-width: 100%;
}

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

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

caption {
  padding-bottom: 0.75rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: left;
}

th,
td {
  padding: 0.55rem 0.9rem 0.55rem 0;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
  white-space: nowrap;
}

thead th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

td.num,
th.num {
  text-align: right;
  padding-right: 0;
  padding-left: 0.9rem;
}

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

.site-footer {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 1px;
}

.site-footer a:hover {
  color: var(--accent);
  border-color: currentColor;
}

.site-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .app:active {
    transform: none;
  }
}
