/* =============================================================================
   apps.kolbyallen.com: one stylesheet for every page.

   The look is "field map": pale sage paper, pine-green ink, topographic
   contour lines, and one map-legend color per app. Colors follow the
   device's light or dark setting automatically.

   Sections:  1 tokens   2 base   3 layout   4 home page   5 prose pages
              6 forms and buttons   7 feature board
   ============================================================================= */


/* ---- 1. Tokens -------------------------------------------------------------- */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

/* Colors are written as light-dark(light value, dark value). Which one is used
   follows color-scheme: the visitor's device setting by default, or the choice
   they make with the theme switch in the header (see assets/theme.js). */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

:root {
  --paper:        light-dark(#E8EEE9, #131E1B);   /* page background, cool sage */
  --paper-raised: light-dark(#F4F7F4, #1B2925);   /* panels and form fields */
  --ink:          light-dark(#1F3A33, #E2EBE5);   /* text, pine green */
  --ink-soft:     light-dark(#4A6658, #9DB4A8);   /* supporting text */
  --contour:      light-dark(#BACABF, #2F443C);   /* contour lines and hairlines */
  --danger:       light-dark(#9A2F24, #F08C7E);

  /* One accent per app, taken from its icon (used for votes, notes, focus) */
  --woodshed: light-dark(#1A66C2, #6EB1F7);       /* metronome blue */
  --budget:   light-dark(#0E7A57, #4FCB9D);       /* paid-check green */
  --cattle:   light-dark(#8F6400, #FFCB6B);       /* tag yellow, darkened to read on sage */
  --miledial: light-dark(#B8461F, #FF9A5C);       /* route orange */

  --serif: "Fraunces", Georgia, serif;
  --sans:  "Public Sans", system-ui, sans-serif;

  /* Type scale, roughly a perfect fourth */
  --step--1: 0.875rem;
  --step-0:  1.0625rem;
  --step-1:  1.375rem;
  --step-2:  1.8rem;
  --step-3:  2.4rem;
  --step-4:  3.2rem;

  --measure: 68ch;
  --gutter:  clamp(1rem, 4vw, 2.5rem);
  --radius:  6px;
}

/* Things that exist in a light and a dark version, like screenshots.
   theme.js always sets data-theme; the media query covers visitors without JavaScript. */
.only-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .only-dark  { display: block !important; }
  :root:not([data-theme]) .only-light { display: none !important; }
}
:root[data-theme="dark"] .only-dark  { display: block !important; }
:root[data-theme="dark"] .only-light { display: none !important; }


/* ---- 2. Base ------------------------------------------------------------------ */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0)/1.6 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  font-variation-settings: "opsz" 96;
  text-wrap: balance;
  margin: 0 0 0.5em;
}
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); font-variation-settings: "opsz" 36; }

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

a { color: inherit; text-decoration-color: var(--contour); text-underline-offset: 0.2em; text-decoration-thickness: 2px; }
a:hover { text-decoration-color: currentColor; }

input[type="checkbox"] { accent-color: var(--ink); width: 1rem; height: 1rem; }

:focus-visible { outline: 3px solid var(--woodshed); outline-offset: 2px; border-radius: 2px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ---- 3. Layout: header, main, footer -------------------------------------------- */

.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding: 0 var(--gutter); }

.site-header .wrap {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; padding-block: 1.25rem;
}
.site-name { font-family: var(--serif); font-weight: 600; font-size: var(--step-1); text-decoration: none; }
.site-nav { display: flex; gap: 1.5rem; font-size: var(--step--1); }
.site-nav a { text-decoration: none; color: var(--ink-soft); }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--contour); }

.header-end { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }

/* The Light / Dark / Match device switch, added to every header by theme.js. */
.theme-switch { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--contour); border-radius: 999px; }
.theme-switch button {
  display: grid; place-items: center; width: 1.9rem; height: 1.9rem;
  border: 0; border-radius: 999px; background: transparent; color: var(--ink-soft); cursor: pointer;
}
.theme-switch button:hover { color: var(--ink); }
.theme-switch button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.theme-switch svg { width: 1rem; height: 1rem; }

main { flex: 1; }

.site-footer { margin-top: 4rem; border-top: 1px solid var(--contour); }
.site-footer .wrap {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding-block: 1.5rem; font-size: var(--step--1); color: var(--ink-soft);
}


/* ---- 4. Home page ----------------------------------------------------------------- */

/* The hero: a headline set against topographic contour lines. */
.hero { position: relative; overflow: hidden; padding-block: clamp(3rem, 10vw, 7rem) clamp(2rem, 6vw, 4rem); }
/* The contour drawing is used as a mask, so its lines take on --contour
   and switch color with dark mode. Regenerate it with tools/make-contours.py. */
.hero::before {
  content: "";
  position: absolute; inset: 0 0 0 28%;
  background: var(--contour);
  -webkit-mask: url("contours.svg") center / cover no-repeat;
          mask: url("contours.svg") center / cover no-repeat;
  pointer-events: none;
}
@media (max-width: 40rem) { .hero::before { inset: 0; opacity: 0.6; } }
.hero .wrap { position: relative; }
.hero h1 {
  font-size: clamp(2.4rem, 6.5vw, var(--step-4) * 1.25);
  font-variation-settings: "opsz" 144;
  max-width: 14ch;
  letter-spacing: -0.01em;
}
.hero p { max-width: 40ch; color: var(--ink-soft); font-size: var(--step-1); line-height: 1.45; }

/* App icons: the iPhone icon files, with corners rounded the way iOS does.
   Files live in assets/icons/<app id>.png (192px square). */
.app-icon {
  display: block; flex: none;
  width: var(--icon-size, 2rem); height: var(--icon-size, 2rem);
  border-radius: 22.5%;
  box-shadow: 0 0 0 1px var(--contour);
}

/* The app list reads like a map legend: an icon, a name, a line. */
.legend { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--contour); }
.legend li {
  --icon-size: 4rem;
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr) auto;
  gap: 0.25rem 1.25rem;
  align-items: start;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--contour);
}
.legend .app-icon { grid-row: 1 / span 3; }
.legend h3 { margin: 0; }
.legend h3 a { text-decoration: none; }
.legend h3 a:hover { text-decoration: underline; text-decoration-color: var(--contour); }
.legend .about { grid-column: 2; margin: 0; color: var(--ink-soft); max-width: 52ch; }
.legend .meta  { grid-column: 2; margin: 0.25rem 0 0; font-size: var(--step--1); color: var(--ink-soft); }
.legend .links { grid-column: 3; grid-row: 1 / span 3; display: flex; flex-direction: column; gap: 0.25rem; font-size: var(--step--1); text-align: right; }
.legend .soon { opacity: 0.75; }

@media (max-width: 40rem) {
  .legend li { --icon-size: 3rem; grid-template-columns: 3rem minmax(0, 1fr); gap: 0.25rem 1rem; }
  .legend .links { grid-column: 2; grid-row: auto; flex-direction: row; gap: 1.25rem; text-align: left; margin-top: 0.5rem; }
}

[data-app="woodshed-log"]        { --app-color: var(--woodshed); }
[data-app="allen-budget"]        { --app-color: var(--budget); }
[data-app="allen-cattle-ledger"] { --app-color: var(--cattle); }
[data-app="miledial"]            { --app-color: var(--miledial); }

.promise { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 2rem 4rem; padding-block: 4rem 0; }
.promise p { max-width: var(--measure); }
@media (max-width: 48rem) { .promise { grid-template-columns: minmax(0, 1fr); } }


/* ---- 5. Prose pages (privacy, docs) -------------------------------------------------- */

.prose { max-width: var(--measure); padding-block: 2.5rem 0; }
.prose h1 { margin-bottom: 0.25em; }
.prose h2 { font-size: var(--step-1); font-variation-settings: "opsz" 36; margin-top: 2.25em; }
.prose .dateline { color: var(--ink-soft); font-size: var(--step--1); margin-bottom: 2rem; }
.prose .lede { font-size: var(--step-1); line-height: 1.45; }
.prose li { margin-bottom: 0.4em; }
.prose .note {
  border-left: 4px solid var(--app-color, var(--contour));
  padding: 0.75rem 1rem; background: var(--paper-raised);
}

.app-heading { display: flex; align-items: center; gap: 0.75rem; }
h1.app-heading { --icon-size: 2.75rem; gap: 1rem; }

.index-list { list-style: none; padding: 0; border-top: 1px solid var(--contour); }
.index-list li { border-bottom: 1px solid var(--contour); padding-block: 0.75rem; margin: 0; display: flex; gap: 0.75rem; align-items: center; }


/* ---- 6. Forms and buttons ----------------------------------------------------------- */

label { display: block; font-weight: 600; font-size: var(--step--1); margin-bottom: 0.35rem; }
.hint { font-weight: 400; color: var(--ink-soft); }

input[type="email"], input[type="text"], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--contour);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
}
textarea { min-height: 7rem; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ink-soft); box-shadow: 0 0 0 3px var(--contour); }

.field { margin-bottom: 1.25rem; }

.button {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font: 600 var(--step--1)/1 var(--sans);
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  border: 1px solid var(--ink);
  background: var(--ink); color: var(--paper);
  cursor: pointer; text-decoration: none;
}
.button:hover { background: var(--ink-soft); border-color: var(--ink-soft); }
.button.quiet { background: transparent; color: var(--ink); border-color: var(--contour); }
.button.quiet:hover { border-color: var(--ink-soft); }
.button[aria-busy="true"] { opacity: 0.6; cursor: progress; }

.link-button { font: inherit; background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; text-decoration-color: var(--contour); text-underline-offset: 0.2em; cursor: pointer; }

.message { padding: 0.75rem 1rem; border-radius: var(--radius); background: var(--paper-raised); border: 1px solid var(--contour); }
.message.error { border-color: var(--danger); color: var(--danger); }


/* ---- 7. Feature board ------------------------------------------------------------------ */

.board { padding-block: 2rem 0; }
.board-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.board-head h1 { margin: 0; }
.signed-in { font-size: var(--step--1); color: var(--ink-soft); display: flex; gap: 1rem; flex-wrap: wrap; align-items: baseline; }

.board-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 2.5rem; align-items: start; }
@media (max-width: 56rem) { .board-grid { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--paper-raised); border: 1px solid var(--contour); border-radius: var(--radius); padding: 1.25rem; }
.panel h2 { font-size: var(--step-1); font-variation-settings: "opsz" 36; }

.filters { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters button {
  font: 500 var(--step--1)/1 var(--sans); padding: 0.45rem 0.75rem;
  border-radius: 999px; border: 1px solid var(--contour); background: transparent; color: var(--ink-soft); cursor: pointer;
}
.filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.requests { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--contour); }
.request { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 1rem; padding-block: 1.1rem; border-bottom: 1px solid var(--contour); }

.vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.1rem;
  width: 3.5rem; height: 3.5rem; border-radius: var(--radius);
  border: 1px solid var(--contour); background: transparent; color: var(--ink);
  font: 700 var(--step-0)/1 var(--sans); cursor: pointer;
}
.vote small { font-size: 0.7rem; font-weight: 500; color: var(--ink-soft); }
.vote[aria-pressed="true"] { border-color: var(--app-color); box-shadow: inset 0 0 0 1px var(--app-color); color: var(--app-color); }

.request h3 { font-family: var(--sans); font-size: var(--step-0); font-weight: 650; margin: 0 0 0.2rem; }
.request h3 button { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.request h3 button:hover { text-decoration: underline; text-decoration-color: var(--contour); }
.request .byline { font-size: var(--step--1); color: var(--ink-soft); margin: 0; display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }

.status { font: 600 0.75rem/1 var(--sans); padding: 0.3rem 0.55rem; border-radius: 999px; border: 1px solid currentColor; }
.status[data-status="new"]         { color: var(--ink-soft); }
.status[data-status="planned"]     { color: var(--woodshed); }
.status[data-status="in_progress"] { color: var(--budget); }
.status[data-status="done"]        { color: var(--ink); background: var(--contour); border-color: var(--contour); }
.status[data-status="not_planned"] { color: var(--ink-soft); text-decoration: line-through; }

.detail { grid-column: 2; margin-top: 0.75rem; }
.detail .body { white-space: pre-wrap; max-width: var(--measure); }
.shots { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.75rem 0; }
.shots img { width: 9rem; height: 6rem; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--contour); }
.comments { list-style: none; padding: 0; margin: 1rem 0; }
.comments li { padding: 0.6rem 0; border-top: 1px dashed var(--contour); }
.comments .who { font-size: var(--step--1); color: var(--ink-soft); }
.detail-actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; font-size: var(--step--1); margin-top: 0.75rem; }

.empty { padding: 2rem 0; color: var(--ink-soft); }

.people { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.people th, .people td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--contour); vertical-align: top; }
.people th { font-weight: 600; color: var(--ink-soft); }
.checks { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; }
.checks label { display: flex; gap: 0.4rem; align-items: center; font-weight: 400; margin: 0; }
.table-scroll { overflow-x: auto; }


/* ---- 8. App pages (site/apps/<app>/) ------------------------------------------------------- */

.app-hero { --icon-size: 6rem; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.5rem 1.75rem; align-items: center; padding-block: 3rem 2rem; }
.app-hero .app-icon { grid-row: span 3; }
.app-hero h1 { margin: 0; font-size: var(--step-4); font-variation-settings: "opsz" 144; }
.app-hero .tagline { margin: 0; font-size: var(--step-1); line-height: 1.4; color: var(--ink-soft); max-width: 44ch; }
.app-hero .meta { margin: 0; font-size: var(--step--1); color: var(--ink-soft); }
.app-hero .actions { grid-column: 2; display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; }
@media (max-width: 40rem) {
  .app-hero { --icon-size: 4.5rem; grid-template-columns: minmax(0, 1fr); }
  .app-hero .app-icon { grid-row: auto; }
  .app-hero .actions { grid-column: 1; }
}

.lede-wide { font-size: var(--step-1); line-height: 1.5; max-width: 60ch; margin-bottom: 2.5rem; }

/* Screenshots: four phones in a row; scroll sideways on small screens. */
.screens {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(13rem, 1fr);
  gap: 1.5rem; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 0.25rem 0 1rem; margin: 0;
}
.screens figure { margin: 0; scroll-snap-align: start; }
.screens img, .screen-wide img {
  display: block; width: 100%; height: auto;
  border-radius: 13% / 6%;
  box-shadow: 0 0 0 1px var(--contour), 0 18px 40px -24px rgba(31, 58, 51, 0.45);
}
.screens figcaption, .screen-wide figcaption { margin-top: 0.75rem; font-size: var(--step--1); color: var(--ink-soft); line-height: 1.45; }
.screen-wide { margin: 1.5rem 0 0; }
.screen-wide img { border-radius: 10px; }
.screens-note { font-size: var(--step--1); color: var(--ink-soft); margin: 0.5rem 0 0; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 2rem 3rem; margin-top: 1rem; }
.features h3 { font-size: var(--step-1); font-variation-settings: "opsz" 36; margin-bottom: 0.6rem; }
.features ul { padding-left: 1.1rem; margin: 0; }
.features li { margin-bottom: 0.45em; }
.features li::marker { color: var(--app-color); }

.app-section { padding-top: 3.5rem; }
.app-section > h2 { margin-bottom: 0.75rem; }
.facts { display: grid; grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr); gap: 0.6rem 2rem; margin: 0; max-width: var(--measure); }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; color: var(--ink-soft); }
@media (max-width: 40rem) { .facts { grid-template-columns: minmax(0, 1fr); gap: 0.1rem; } .facts dd { margin-bottom: 0.75rem; } }
