/* benjaminsanborn.com — quiet, precise, a craftsman's workbench.
   The apps' icons and screenshots supply the colour. */
:root {
  --bg: #FAFAF7; --card: #FFFFFF; --line: #E7E5E0; --fg: #1C1C1E; --muted: #6B6B70;
  --accent: #2D5BD7; --accent-fg: #FFFFFF; --error: #C2362B; --success: #2E7D4F;
  --pill-bg: #000000; --pill-fg: #FFFFFF; --field-bg: #FFFFFF;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 14px; --gap: 48px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121214; --card: #1C1C1F; --line: #2C2C30; --fg: #EDEDED; --muted: #9A9AA0;
    --accent: #7FA6FF; --accent-fg: #121214; --error: #FF7A6E; --success: #5CC48A;
    --pill-bg: #FFFFFF; --pill-fg: #000000; --field-bg: #1C1C1F;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--sans); font-size: 17px; line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 34px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 8px; }
h2 { font-size: 22px; font-weight: 600; margin: 0 0 12px; }
code { font-family: var(--mono); font-size: 0.9em; background: var(--line); padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }

/* ---- Page frame ---- */
.page { max-width: 680px; margin: 0 auto; padding: 20px 20px 24px; }
.page-wide { max-width: 880px; }
.section { margin-top: var(--gap); }
.section p { margin: 0 0 1em; }

.back-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; margin: 0 0 24px -10px; }
.back {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  color: var(--accent); text-decoration: none; font-size: 15px; border-radius: 10px;
}
.back.muted { color: var(--muted); padding-left: 0; }
.back:hover { text-decoration: underline; }

.site-footer {
  max-width: 880px; margin: 24px auto 0; padding: 24px 20px 40px;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px;
  color: var(--muted); font-size: 14px;
}
.site-footer a { color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.site-footer a:hover { color: var(--fg); text-decoration: underline; }

.link-row {
  margin-top: var(--gap); padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; flex-wrap: wrap; gap: 4px 0; align-items: center;
}
.link-row a { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.link-row a:hover { text-decoration: underline; }
.link-row a + a::before { content: "·"; color: var(--muted); margin: 0 12px; display: inline-block; }

/* ---- Icons ---- */
.app-icon {
  --size: 64px; width: var(--size); height: var(--size); flex: none;
  border-radius: calc(var(--size) * 0.225); border: 1px solid var(--line);
  object-fit: cover; background: var(--card); display: inline-flex; align-items: center; justify-content: center;
}
.icon-fallback { font-weight: 600; font-size: calc(var(--size) * 0.45); color: var(--muted); }
.mono-tile { font-family: var(--mono); font-size: calc(var(--size) * 0.55); color: var(--fg); line-height: 1; }

/* ---- Home ---- */
.home-header { margin: 32px 0 0; }
.home-header p { margin: 0; font-size: 19px; }
.section-title { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.app-card {
  display: flex; align-items: center; gap: 16px; padding: 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  color: var(--fg); text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.app-card-text { display: flex; flex-direction: column; line-height: 1.4; min-width: 0; }
.app-card-text .muted { font-size: 15px; }
@media (hover: hover) {
  .app-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.07); border-color: color-mix(in srgb, var(--line), var(--muted) 30%); }
}

/* ---- App page ---- */
.app-header { display: flex; align-items: center; gap: 20px; }
.app-header h1 { margin: 0; }
.tagline { margin: 2px 0 0; font-size: 18px; }
.app-store-button {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 24px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  background: var(--pill-bg); color: var(--pill-fg); text-decoration: none; font-weight: 600; font-size: 16px;
}
.app-store-button:hover { opacity: .88; }
.app-store-button svg { margin-top: -3px; }

.screenshots {
  display: flex; flex-wrap: wrap; gap: 16px; margin-top: 32px;
}
.shot {
  padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 18px; flex: none;
}
.shot img {
  display: block; width: 200px; height: auto; border-radius: 18px;
  box-shadow: 0 6px 20px rgba(0,0,0,.12), 0 1px 3px rgba(0,0,0,.08);
}
.features { padding-left: 1.2em; margin: 0 0 1em; }
.features li { margin-bottom: 8px; }
.essay p { font-size: 18px; line-height: 1.75; }
.support { padding: 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.support h2 { margin-bottom: 6px; }
.support p { margin: 0; }

/* Screenshot viewer */
.viewer {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.9);
  display: flex; align-items: center; justify-content: center; padding: 56px 64px;
}
.viewer[hidden] { display: none; }
.viewer-image { max-width: 100%; max-height: 100%; border-radius: 18px; object-fit: contain; }
.viewer button {
  position: absolute; min-width: 48px; min-height: 48px; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.14); color: #fff; font-size: 30px; line-height: 1; cursor: pointer;
}
.viewer button:hover { background: rgba(255,255,255,.26); }
.viewer button[hidden] { display: none; }
.viewer-close { top: 12px; right: 12px; }
.viewer-prev { left: 10px; top: 50%; transform: translateY(-50%); }
.viewer-next { right: 10px; top: 50%; transform: translateY(-50%); }
body.viewer-open { overflow: hidden; }

/* ---- Privacy policy ---- */
.policy-label { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; color: var(--muted); font-size: 15px; font-weight: 500; }
.policy h1 { margin-bottom: 4px; }
.policy .updated { color: var(--muted); font-size: 15px; margin: 0 0 8px; }
.policy h2 { font-size: 19px; margin: 32px 0 8px; }
.policy p { margin: 0 0 1em; }
.policy ul { padding-left: 1.2em; margin: 0 0 1em; }
.policy li { margin-bottom: 4px; }

/* ---- Not found ---- */
.compact-apps { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 16px; }
.compact-apps a { display: flex; align-items: center; gap: 10px; min-height: 44px; color: var(--fg); text-decoration: none; }
.compact-apps a:hover span:last-child { text-decoration: underline; }

/* ---- Monospace placeholder ---- */
.placeholder { text-align: center; padding: 40px 0; }
.placeholder h1 { margin-top: 16px; }

/* ---- Forms ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.contact-form { margin-top: 24px; }
.field { margin-bottom: 18px; }
label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
input[type=text], input[type=email], textarea, select {
  width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; font-size: 17px;
  color: var(--fg); background: var(--field-bg);
  border: 1px solid var(--line); border-radius: 10px;
}
textarea { resize: vertical; min-height: 160px; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
.has-error input, .has-error textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: 15px; margin: 6px 0 0; }
.char-count { font-size: 14px; margin: 6px 0 0; text-align: right; }
.form-problem { color: var(--error); border: 1px solid var(--error); border-radius: 10px; padding: 10px 14px; margin: 24px 0 0; }
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.button, input[type=submit] {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  background: var(--accent); color: var(--accent-fg); border: 0; border-radius: 10px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.button:hover, input[type=submit]:hover { filter: brightness(1.08); }
input[type=submit]:disabled { opacity: .65; cursor: progress; }
.thanks { margin-top: 24px; border-color: var(--success); }
.thanks p:first-child { color: var(--success); font-weight: 500; }
.thanks p { margin: 0 0 8px; }
.thanks p:last-child { margin: 0; }
.prefer-email { margin-top: 24px; font-size: 15px; }

/* ---- Phone ---- */
@media (max-width: 640px) {
  :root { --gap: 40px; }
  h1 { font-size: 30px; }
  .card-grid, .compact-apps { grid-template-columns: 1fr; }
  .app-header { gap: 16px; }
  .app-header .app-icon { --size: 72px !important; }
  .screenshots {
    flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-left: -20px; margin-right: -20px; padding: 4px 20px 20px; scroll-padding: 0 20px;
    -webkit-overflow-scrolling: touch;
  }
  .shot { scroll-snap-align: start; }
  .shot img { width: 68vw; max-width: 260px; }
  .viewer { padding: 56px 12px; }
  .viewer-prev, .viewer-next { top: auto !important; bottom: 12px; transform: none !important; }
}
