/* Field notebook: warm paper, Grönvold's plates, ink and sage, rufous handwritten notes */
:root {
  --paper: #F3EFDF;
  --sheet: #FBF9F1;
  --ink: #3B2F24;
  --ink-2: #5A4A3B;
  --ink-3: #6B5B4B;
  --faint: #8A7A69;
  --rule: #DDD0BA;
  --rule-2: #CDBEA3;
  --dash: #D6C8AF;
  --field: #BFAF95;
  --sage: #5F7350;
  --sage-dark: #3F5134;
  --sage-wash: #EEF0E6;
  --sage-rule: #C6CDB5;
  --rufous: #A04E23;
  --serif: 'Alegreya', Georgia, serif;
  --sans: 'Alegreya Sans', system-ui, sans-serif;
  --hand: 'Caveat', 'Segoe Print', cursive;
  --perch: 150px;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--sans);
}

a { color: var(--sage); }
a:hover { color: var(--sage-dark); }
:focus-visible { outline: 2px solid var(--rufous); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); }
p { margin: 0; }

.hand { font-family: var(--hand); font-weight: 600; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Plates are scanned on white paper: multiply drops the white into the page */
.bird { display: block; height: auto; mix-blend-mode: multiply; }
.plate { margin: 0; position: relative; }

.btn {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-radius: 8px;
  background: var(--sage);
  color: #FFFFFF;
  font-weight: 700;
  text-decoration: none;
}
.btn:hover { background: var(--sage-dark); color: #FFFFFF; }

/* Header */
.top { display: flex; gap: 24px; align-items: center; justify-content: space-between; padding-top: 48px; }
.intro { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
h1 { margin: 0; font-size: clamp(2.6rem, 8vw, 4.75rem); line-height: 1; font-weight: 700; letter-spacing: -0.01em; }
.lede { max-width: 34ch; font-family: var(--serif); font-style: italic; font-size: clamp(1.2rem, 3vw, 1.65rem); line-height: 1.3; color: var(--ink-2); }
.cta { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; }
.cta .hand { font-size: 1.35rem; color: var(--ink-3); }
.hero { flex: 0 0 280px; }
.hero img { width: 280px; }
.hero figcaption { position: absolute; left: -40px; bottom: 30px; font-size: 1.3rem; line-height: 1.1; color: var(--ink-3); transform: rotate(-4deg); }

/* Filters */
main { padding-top: 24px; padding-bottom: 40px; }
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--sheet);
}
.field { flex: 1 1 180px; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; font-weight: 500; color: var(--ink-2); }
.field.grow { flex: 2 1 280px; }
.field[hidden] { display: none; }
input[type="search"], select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: var(--sheet);
  font: 1rem var(--sans);
  color: var(--ink);
}
.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--ink-3);
  font: 500 1.05rem var(--sans);
  cursor: pointer;
}
.tab[aria-pressed="true"] { border-bottom-color: var(--sage); color: var(--ink); font-weight: 700; }

.status { display: flex; align-items: center; min-height: 40px; margin-top: 14px; font-size: 0.95rem; color: var(--ink-3); }
.link { padding: 0; border: 0; background: none; font: inherit; color: var(--sage); text-decoration: underline; cursor: pointer; }

/* Pages and sidebar; birds perch above the panels on wide screens */
.layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.pages { flex: 999 1 620px; min-width: 0; position: relative; display: flex; flex-direction: column; gap: 28px; }
.side { flex: 1 1 290px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.perched { position: relative; margin-top: var(--perch); }
.perch { position: absolute; top: calc(-1 * var(--perch)); right: 20px; width: 140px; }
.perch.left { right: auto; left: 8px; }

.page { background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 10px; box-shadow: 0 1px 0 #E8DDC9; }
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; padding: 18px 22px 14px; border-bottom: 1px solid var(--rule); }
.page-head h2 { margin: 0; font-style: italic; font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 500; }
.page-head .rel { font-size: 1.5rem; line-height: 1; color: var(--rufous); transform: rotate(-3deg); }
.page-head .n { margin-left: auto; color: var(--ink-3); }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr) auto;
  grid-template-areas: "when info flyer";
  gap: 14px 22px;
  align-items: start;
  padding: 20px 22px;
  border-bottom: 1px dashed var(--dash);
}
.row:last-child { border-bottom: 0; }

.when { grid-area: when; display: flex; flex-direction: column; gap: 6px; }
.time { font-family: var(--serif); font-size: 1.75rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.time.unknown { font-family: var(--hand); font-size: 1.3rem; font-weight: 600; color: var(--faint); }

.info { grid-area: info; min-width: 0; display: flex; flex-direction: column; gap: 5px; overflow-wrap: anywhere; }
.title { margin: 0; font-size: 1.4rem; line-height: 1.2; font-weight: 700; }
.where { color: var(--ink-2); }
.note { margin-top: 2px; padding-left: 12px; border-left: 2px solid var(--rule-2); font-size: 0.95rem; color: var(--ink-3); }
.also { font-size: 0.95rem; color: var(--ink-3); }
.links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; }
.links a { min-height: 32px; display: inline-flex; align-items: center; }
.account { font-weight: 700; }
.caption { margin-top: 6px; font-size: 0.95rem; color: var(--ink-3); }
.caption summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--field);
  border-radius: 6px;
  background: #FFFFFF;
  color: var(--ink-2);
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}
.caption summary::-webkit-details-marker { display: none; }
.caption summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); transition: transform 0.15s ease; }
.caption[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.caption summary:hover { border-color: var(--ink-3); color: var(--ink); }
.caption p { white-space: pre-line; margin-top: 10px; padding: 12px 14px; border-radius: 6px; background: var(--paper); }

.flyer {
  grid-area: flyer;
  display: block;
  padding: 6px;
  border: 1px solid var(--dash);
  background: #FFFFFF;
  box-shadow: 0 2px 6px rgba(59, 47, 36, 0.12);
  transform: rotate(var(--tilt, 0deg));
  cursor: zoom-in;
  transition: transform 0.15s ease;
}
.flyer:hover { transform: rotate(0deg) scale(1.03); }
.flyer img { display: block; width: 104px; height: 130px; object-fit: contain; background: #F3EDE2; }

.empty { padding: 32px 22px; font-size: 1.6rem; color: var(--ink-3); }

/* Sidebar panels */
.panel { background: var(--sheet); border: 1px solid var(--rule-2); border-radius: 10px; padding: 18px; }
.panel h2 { margin: 0; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal-head h2 { font-style: italic; font-size: 1.5rem; font-weight: 500; }
.cal-nav { width: 40px; height: 40px; border: 1px solid var(--rule); border-radius: 50%; background: #FFFFFF; color: var(--ink-2); font: 1.3rem/1 var(--serif); cursor: pointer; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.cal-names { font-size: 0.8rem; font-weight: 700; color: var(--ink-3); }
#cal-days { margin-top: 6px; }
#cal-days > * { display: flex; align-items: center; justify-content: center; height: 36px; border-radius: 50%; font-size: 0.9rem; }
#cal-days .past { color: var(--faint); }
#cal-days .today { border: 1.5px dashed var(--rufous); }
#cal-days .outing { border: 0; background: var(--sage); color: #FFFFFF; font: 700 0.9rem var(--sans); cursor: pointer; }
#cal-days .outing.today { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 3.5px var(--rufous); }
#cal-days .outing[aria-pressed="true"] { background: var(--rufous); }
.legend { margin-top: 12px; font-size: 1.3rem; line-height: 1.1; color: var(--ink-3); }

.invite { background: var(--sage-wash); border-color: var(--sage-rule); padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.invite h2 { font-size: 1.4rem; font-weight: 700; }
.invite p { color: #4A4034; }
.invite .btn { align-self: flex-start; }

.contact { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.contact h2 { font-size: 1.4rem; font-weight: 700; }
.contact p { color: var(--ink-2); }
.contact a { font-weight: 700; overflow-wrap: anywhere; }

.byline { font-size: 0.9rem; color: var(--ink-3); }

/* Footer */
.foot { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-end; justify-content: space-between; padding-bottom: 40px; }
.foot > div { display: flex; flex-direction: column; gap: 8px; max-width: 64ch; font-size: 0.9rem; color: var(--ink-2); }
.foot .credit, #updated { color: var(--ink-3); font-size: 0.85rem; }
.foot .plate { display: flex; align-items: flex-end; gap: 4px; }
.foot .plate img { width: 260px; }
.foot figcaption { font-size: 1.25rem; color: var(--ink-3); padding-bottom: 28px; }

/* Flyer viewer */
#viewer { max-width: min(92vw, 720px); padding: 12px; border: 1px solid var(--rule-2); border-radius: 10px; background: var(--sheet); color: var(--ink); }
#viewer::backdrop { background: rgba(59, 47, 36, 0.55); }
#viewer img { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; }
.viewer-links { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 10px; }
.close { min-height: 40px; padding: 0 14px; border: 1px solid var(--field); border-radius: 6px; background: #FFFFFF; font: 500 1rem var(--sans); color: var(--ink); cursor: pointer; }

/* Narrow screens: no perched birds, rows stack */
@media (max-width: 899px) {
  :root { --perch: 0px; }
  .perch { display: none; }
  .layout { gap: 24px; }
}

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .top { padding-top: 28px; gap: 12px; align-items: flex-start; }
  .hero { flex: 0 0 96px; }
  .hero img { width: 96px; }
  .hero figcaption { display: none; }
  .toolbar { padding: 12px; }
  .tabs { margin-left: 0; width: 100%; }
  .tab { flex: 1; }
  .page-head { padding: 14px 16px 10px; }
  .row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "when when" "info flyer";
    gap: 8px 14px;
    padding: 16px;
  }
  .when { flex-direction: row; align-items: center; gap: 18px; }
  .title { font-size: 1.2rem; }
  .flyer { padding: 4px; }
  .flyer img { width: 76px; height: 95px; }
  .foot .plate img { width: 180px; }
  .foot figcaption { padding-bottom: 16px; }
}

/* About page */
.back { font-size: 0.95rem; }
.about { max-width: 72ch; padding: 8px 28px 28px; }
.about section { display: flex; flex-direction: column; gap: 10px; padding-top: 20px; }
.about h2 { margin: 0; font-size: 1.4rem; font-weight: 700; }
.about p { color: var(--ink-2); }
@media (max-width: 640px) {
  .about { padding: 4px 18px 22px; }
}
