/* yawbam.com: a field logbook. System fonts only, no external requests. */

:root {
  --paper: #f3f0e8;
  --field: #fffdf8;
  --ink: #1c1e1a;
  --ink-2: #4a4d45;
  --rule: #d3cdbf;
  --accent: #1f5134;
  --accent-hover: #143823;
  --on-accent: #ffffff;
  --blaze: #a5480a;
  --error: #9e2318;
  --error-bg: #f6e2dc;
  --focus: #a5480a;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Charter, "Bitstream Charter", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --s1: 0.25rem; --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem;
  --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4rem;
  --measure: 40rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151714;
    --field: #1d201c;
    --ink: #ece9e1;
    --ink-2: #b9b6ac;
    --rule: #3a3d36;
    --accent: #9bd3ae;
    --accent-hover: #bde5ca;
    --on-accent: #0f1a13;
    --blaze: #f0a35e;
    --error: #ffa497;
    --error-bg: #3a1d19;
    --focus: #f0a35e;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.55;
}

main, .masthead, .sitefoot {
  max-width: calc(var(--measure) + 2rem);
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

main { padding-bottom: var(--s7); }

h1, h2 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
}
h1 { font-size: clamp(1.75rem, 6vw, 2.375rem); margin: var(--s5) 0 var(--s3); overflow-wrap: anywhere; hyphens: auto; }
h2 { font-size: 1.375rem; margin: var(--s7) 0 var(--s4); }
p { margin: 0 0 var(--s4); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
/* Hover only where a real pointer exists, so styles don't stick after a tap. */
@media (hover: hover) {
  a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
      }
.button:active { background: var(--accent-hover); }

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

.skip {
  position: absolute;
  left: var(--s4);
  top: -10rem;
  background: var(--ink);
  color: var(--paper);
  padding: var(--s2) var(--s4);
  z-index: 10;
}
.skip:focus { top: var(--s2); }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.button[disabled] { opacity: 1; background: var(--ink-2); cursor: progress; }

/* Masthead: the wordmark carries a small painted trail blaze. */
.masthead { padding-top: var(--s5); padding-bottom: var(--s3); border-bottom: 1px solid var(--rule); }
.wordmark {
  min-height: 2.75rem;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.0625rem;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.wordmark::before {
  content: "";
  width: 0.5rem;
  height: 1rem;
  background: var(--blaze);
}
.wordmark:hover { color: var(--ink); text-decoration: underline; }

/* Home */
.lede-title { font-size: clamp(1.875rem, 7vw, 2.75rem); margin-top: var(--s7); max-width: 18ch; }
.lede { font-size: 1.1875rem; color: var(--ink); max-width: 34rem; }
.steps { padding-left: 1.5rem; }
.steps li { margin-bottom: var(--s3); padding-left: var(--s2); }
.steps li::marker { font-family: var(--mono); color: var(--ink-2); }

/* Cache page */
.cache-count { font-family: var(--mono); font-size: 0.875rem; color: var(--ink-2); margin-top: calc(-1 * var(--s2)); }
.cache-desc { max-width: 36rem; }

.log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.entry { padding: var(--s4) 0; border-bottom: 1px solid var(--rule); }
.entry-meta { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: baseline; margin-bottom: var(--s2); }
.entry-meta time { font-family: var(--mono); font-size: 0.875rem; color: var(--ink-2); }
.entry-who { font-weight: 600; overflow-wrap: anywhere; }
.entry-note { overflow-wrap: anywhere; white-space: normal; }
.entry-photo { display: block; max-width: 100%; height: auto; margin-top: var(--s2); border: 1px solid var(--rule); }
.empty { color: var(--ink-2); }
.pager { display: flex; justify-content: space-between; gap: var(--s4); margin-top: var(--s5); }
.pager a { display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 var(--s2); margin: 0 calc(-1 * var(--s2)); }

/* Forms */
.form { max-width: 34rem; }
.field { margin: 0 0 var(--s5); padding: 0; border: 0; min-width: 0; }
label, legend { display: block; font-weight: 600; margin-bottom: var(--s1); }
legend { padding: 0; font-family: var(--serif); font-size: 1.125rem; margin-bottom: var(--s3); }
.opt { font-weight: 400; color: var(--ink-2); font-size: 0.9375rem; }
.hint { color: var(--ink-2); font-size: 0.9375rem; margin-bottom: var(--s2); }
.counter { color: var(--ink-2); font-size: 0.875rem; margin: var(--s1) 0 0; font-family: var(--mono); }
.counter.over { color: var(--error); font-weight: 600; }

input[type="text"], input[type="date"], textarea {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--ink-2);
  border-radius: 3px;
  padding: 0.625rem 0.75rem;
  min-height: 2.75rem;
}
/* iOS renders date inputs centred and collapsed unless their native look is reset. */
input[type="date"] { max-width: 14rem; -webkit-appearance: none; appearance: none; text-align: left; }
input[type="date"]::-webkit-date-and-time-value { text-align: left; min-height: 1.5em; }
textarea { resize: vertical; min-height: 8rem; line-height: 1.5; }
input[type="file"] { font: inherit; font-size: 0.9375rem; max-width: 100%; width: 100%; min-height: 2.75rem; }
input[type="file"]::file-selector-button {
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--field);
  border: 1.5px solid var(--ink-2);
  border-radius: 3px;
  padding: 0.625rem 1rem;
  min-height: 2.75rem;
  margin-right: var(--s3);
  cursor: pointer;
}
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
.input-code { font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; max-width: 16rem; }

.check { display: flex; gap: var(--s3); align-items: flex-start; margin-bottom: var(--s2); }
.check input { width: 1.5rem; height: 1.5rem; margin: 0.6rem 0 0; flex: none; accent-color: var(--accent); }
/* The whole label is the tap target, padded to at least 44px tall. */
.check label { font-weight: 400; margin: 0; padding: 0.5rem 0; flex: 1; min-height: 2.75rem; }

.photo-preview { display: block; max-width: 12rem; max-height: 12rem; margin-top: var(--s3); border: 1px solid var(--rule); }

.button {
  touch-action: manipulation;
  font: inherit;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 0;
  border-radius: 3px;
  padding: 0.75rem 1.375rem;
  min-height: 2.75rem;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); }

.field-error { color: var(--error); font-weight: 600; margin-bottom: var(--s2); }

.notice { background: var(--field); padding: var(--s4); margin: 0 0 var(--s5); }
.notice p:last-child, .notice ul:last-child { margin-bottom: 0; }
.notice-error { background: var(--error-bg); }
.notice-error h2 { font-size: 1.125rem; margin: 0 0 var(--s2); color: var(--error); font-family: var(--sans); }
.notice-error a { color: var(--ink); }

/* The deletion code, styled like a tear-off stub. */
.code-box { border: 1.5px dashed var(--ink-2); padding: var(--s4); margin: var(--s5) 0; max-width: 30rem; }
.code { font-family: var(--mono); font-size: clamp(1.25rem, 6vw, 1.75rem); font-weight: 600; letter-spacing: 0.08em; margin: 0; }
.code-inline { font-family: var(--mono); white-space: nowrap; }

/* Bot trap: hidden from people and assistive technology. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Policy pages */
.prose { max-width: 36rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: var(--s2); }
.updated { font-family: var(--mono); font-size: 0.875rem; color: var(--ink-2); }

/* Footer */
.sitefoot { border-top: 1px solid var(--rule); padding-top: var(--s5); padding-bottom: var(--s6); color: var(--ink-2); font-size: 0.9375rem; }
.sitefoot ul { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0 var(--s4); }
.sitefoot a { color: var(--ink-2); display: flex; align-items: center; min-height: 2.75rem; }
.sitefoot a:hover { color: var(--ink); }

/* Phones: full-width primary buttons, easy to hit with a thumb. */
@media (max-width: 30rem) {
  .form .button { width: 100%; }
  .code-box { padding: var(--s3); }
}

@media (min-width: 40rem) {
  body { font-size: 1.125rem; }
  .entry-meta time { min-width: 7rem; }
}
