/* rabbitcam.xyz — one stylesheet for every page.
   Palette comes from the subject: pale leaf paper, deep green ink, clover links,
   rabbit-fur wood for the window frame, a dusk-blue pane. */
@font-face { font-family: "Fraunces"; src: url("fonts/Fraunces-Roman.woff2") format("woff2");
             font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fonts/Fraunces-Italic.woff2") format("woff2");
             font-weight: 300 900; font-style: italic; font-display: swap; }

:root {
  color-scheme: light dark;
  --paper: #F1F4EC; --ink: #182A1F; --dim: #4F5E54; --line: #CBD4C5;
  --clover: #2E6B41; --fur: #8E7357; --dusk: #3F4F7A; --dusk-2: #7A8AB8; --nose: #E29AA4;
  --pane-fill: #E4E9F2;
}
@media (prefers-color-scheme: dark) {
  :root { --paper: #0E1712; --ink: #E6ECE3; --dim: #A3AFA6; --line: #2A372F;
          --clover: #8ACB9D; --fur: #B89B7D; --dusk: #6C7EB5; --dusk-2: #2C3757; --nose: #E29AA4;
          --pane-fill: #1A2233; }
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0 auto; padding: 0 24px 72px; max-width: 760px; color: var(--ink);
       font: 17px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
       -webkit-font-smoothing: antialiased; }

h1, h2, h3, .serif { font-family: "Fraunces", Georgia, serif; font-optical-sizing: auto;
                     font-variation-settings: "SOFT" 40, "WONK" 1; }
h1 { font-size: 2.6rem; line-height: 1.08; font-weight: 500; letter-spacing: -0.015em; margin: 0 0 0.5em; }
main > h1 { margin-top: 2rem; }
h2 { font-size: 1.55rem; line-height: 1.2; font-weight: 600; margin: 2.2em 0 0.5em; }
h3 { font-size: 1.15rem; font-weight: 600; margin: 1.6em 0 0.3em; }
p, li { max-width: 66ch; }
p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--dim); max-width: 34em; }
.date { color: var(--dim); margin-top: -0.4em; }
strong { font-weight: 650; }
code { font: 0.92em/1.4 ui-monospace, "SF Mono", Menlo, monospace; background: color-mix(in srgb, var(--ink) 7%, transparent);
       padding: 0.1em 0.35em; border-radius: 4px; overflow-wrap: anywhere; }

a { color: var(--clover); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 2px solid var(--clover); outline-offset: 3px; border-radius: 2px; }

header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
         gap: 10px 20px; padding: 26px 0 18px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
         font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.2rem; }
.brand .mark { display: block; border-radius: 7px; }
nav { display: flex; flex-wrap: wrap; gap: 2px 18px; }
nav a { color: var(--dim); text-decoration: none; padding: 6px 0; }
nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 5px; }
nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* Home hero: headline on the left, the window on the right. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px 44px; align-items: center;
        margin: 2.6rem 0 2rem; }
/* Hero carousel: one painting per slide, each fit inside a fixed-height slide. */
.carousel { --h: 300px; width: 380px; justify-self: end; }
.track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
         overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; height: var(--h); display: grid; place-items: center; scroll-snap-align: center; }
.car-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.car-nav .arrow { position: relative; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%;
                  display: grid; place-items: center; background: rgba(24, 42, 31, 0.55); color: #fff; cursor: pointer; }
.car-nav .arrow::before { content: ""; position: absolute; inset: -10px; }
.car-nav .arrow:hover { background: rgba(24, 42, 31, 0.8); }
.car-nav .arrow svg { width: 8px; height: 13px; fill: currentColor; }
.car-nav .arrow.prev svg { margin-right: 2px; }
.car-nav .arrow.next svg { margin-left: 2px; }
.dots { display: flex; gap: 10px; }
.dots button { position: relative; width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%;
               background: var(--line); cursor: pointer; }
.dots button::before { content: ""; position: absolute; inset: -8px; }
.dots button[aria-current="true"] { background: var(--clover); }
.car-nav button:focus-visible { outline: 2px solid var(--clover); outline-offset: 3px; }
.window { position: relative; overflow: hidden; border-radius: 6px; }
.window > * { position: absolute; }
.window .glass {
                 background: #812527; }
/* The whole rabbit, head at the top of a 1:2 box; the pane hides whatever is below the sill. */
.window .bunny { aspect-ratio: 1 / 2; object-fit: cover; }

/* Scene: leaded window (crop 1003 x 833; glass x 161-862, y 89-648). The rabbit rises. */
.scene-leaded { aspect-ratio: 1003 / 833; width: min(100%, calc(var(--h) * 1003 / 833)); }
.scene-leaded .glass { left: 16.05%; top: 10.68%; width: 69.89%; height: 67.11%; }
.scene-leaded .bunny { left: 16.05%; top: 1.3%; width: 69.89%; }

/* Scene: Dali's open window (crop 584 x 924, scan border trimmed; opening x 126-449, y 106-627).
   The rabbit slides in from behind the shutter. */
.scene-open { aspect-ratio: 584 / 924; width: min(100%, calc(var(--h) * 584 / 924)); }
.scene-open .glass { left: 21.58%; top: 11.47%; width: 55.48%; height: 56.49%; }
.scene-open .bunny { left: 13.27%; top: 21.21%; width: 71.92%; }
.scene-open .bunny img { display: block; width: 100%; height: 100%; }

/* Scene: window seat (728 x 439; panes fill y 0-247). The rabbit drops in from the top, upside down. */
.scene-seat { aspect-ratio: 728 / 439; width: min(100%, calc(var(--h) * 728 / 439)); }
.scene-seat .glass { left: 0; top: 0; width: 100%; height: 56.26%; }
.scene-seat .bunny { left: 52%; top: 3%; width: 24%; --dx: 220%; }
.scene-seat .bunny img { display: block; width: 100%; height: 100%; }

.scene-sill .bunny img, .scene-glasses .bunny img, .scene-blinds .bunny img { display: block; width: 100%; height: 100%; }

/* Scene: man on a sill (crop 866 x 1050; glass x 0-660, y 0-895). The rabbit slides in from the left, where he's looking. */
.scene-sill { aspect-ratio: 866 / 1050; width: min(100%, calc(var(--h) * 866 / 1050)); }
.scene-sill .glass { left: 0; top: 0; width: 76.33%; height: 85.33%; }
.scene-sill .bunny { left: 3.46%; top: 14.29%; width: 45.03%; }

/* Scene: older man in glasses (612 x 408; panes x 0-117, y 0-221). The rabbit hangs down from the top, upside down. */
.scene-glasses { aspect-ratio: 612 / 408; width: min(100%, calc(var(--h) * 612 / 408)); }
.scene-glasses .glass { left: 0; top: 0; width: 19.28%; height: 54.41%; }
.scene-glasses .bunny { left: -6.54%; top: 0; width: 32.68%; --dy: 115%; }

/* Scene: peering through blinds (450 x 300; bottom caption strip cropped at the user's request, central Shutterstock wordmark kept). The rabbit rises from below. */
.scene-blinds { aspect-ratio: 450 / 300; width: min(100%, calc(var(--h) * 450 / 300)); }
.scene-blinds .glass { left: 0; top: 0; width: 100%; height: 100%; }
.scene-blinds .bunny { left: 55.56%; top: 0; width: 48.89%; --dy: 140%; }
.window .pane { inset: 0; width: 100%; height: 100%; }
.window .replay { right: 8px; bottom: 8px; width: 25px; height: 25px; padding: 0; border: 0; border-radius: 50%;
                  display: grid; place-items: center; background: rgba(24, 42, 31, 0.55); color: #fff; cursor: pointer;
                  transition: background-color 120ms ease-out; }
.window .replay::before { content: ""; position: absolute; inset: -10px; }   /* bigger target for thumbs */
.window .replay:hover { background: rgba(24, 42, 31, 0.8); }
.window .replay:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.window .replay svg { width: 13px; height: 13px; fill: currentColor; }
@media (prefers-reduced-motion: reduce) { .window .replay { display: none; } }
@media (max-width: 640px) {
  h1 { font-size: 2.1rem; }
  main > h1 { margin-top: 1.4rem; }
  nav { gap: 0 14px; font-size: 0.95em; }
  .hero { grid-template-columns: 1fr; margin-top: 1.6rem; }
  .carousel { --h: 360px; width: 100%; justify-self: stretch; order: -1; }
}
@media (prefers-reduced-motion: no-preference) {
  .bunny { animation: peek 1500ms cubic-bezier(.2,.75,.2,1) 400ms both; }
  /* Entrances: 1 leaded, 2 open, 5 glasses, 6 blinds rise from below (default);
     3 seat slides in from the right; 4 sill slides in from the left. */
  @keyframes peek { from { transform: translateY(var(--dy, 105%)); } to { transform: translateY(0); } }
  .scene-seat .bunny { animation-name: slide-in; }
  @keyframes slide-in { from { transform: translateX(var(--dx, 100%)); } to { transform: translateX(0); } }
  .scene-sill .bunny { animation-name: slide-from-left; }
  @keyframes slide-from-left { from { transform: translateX(-120%); } to { transform: translateX(0); } }
}

.visits { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
          gap: 18px 16px; margin: 1.2rem 0 0; }
.visits figure { margin: 0; }
.visits video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9;
                background: #000; border-radius: 8px; }
.visits figcaption { display: flex; align-items: baseline; gap: 8px; margin-top: 6px;
                     font-size: 0.9em; color: var(--dim); }
.visits figcaption b { color: var(--ink); font-weight: 650; min-width: 1.5em; }
.visits figcaption span { margin-left: auto; font-size: 1.25em; line-height: 1; }

.features { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px 28px; }
.features li { max-width: none; }
.features h3 { margin: 0 0 0.15em; }
.features p { margin: 0; color: var(--dim); font-size: 0.97em; }

/* The Tailscale page is a real sequence, so it gets numbers. */
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 1.5rem 0; }
ol.steps > li { counter-increment: step; position: relative; padding-left: 3.1rem; margin: 0 0 1.8rem; max-width: none; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: -0.15rem;
  font-family: "Fraunces", Georgia, serif; font-variation-settings: "SOFT" 100, "WONK" 1;
  font-size: 2rem; line-height: 1; font-weight: 500; color: var(--clover); }
ol.steps h3 { margin-top: 0; }
ol.steps p:last-child { margin-bottom: 0; }

table { border-collapse: collapse; margin: 1rem 0 1.5rem; width: 100%; font-size: 0.97em; }
th, td { text-align: left; vertical-align: top; padding: 10px 14px 10px 0; border-bottom: 1px solid var(--line); }
th { font-weight: 650; }
td:first-child { white-space: nowrap; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.92em; }

ol.quick { margin: 0.6rem 0 1rem; padding-left: 1.4em; }
ol.quick li { margin: 0 0 0.45em; padding-left: 0.2em; }
ol.quick li::marker { color: var(--clover); font-weight: 650; }

.creds { border-left: 3px solid var(--clover); padding: 2px 0 2px 18px; margin: 1.2rem 0; }
.creds div { margin: 0 0 12px; }
.creds div:last-child { margin: 0; }
.creds b { display: block; font-weight: 650; font-size: 0.9em; margin-bottom: 3px; }
.creds code { display: inline-block; max-width: 100%; }

.aside { border-left: 3px solid var(--fur); padding: 2px 0 2px 18px; margin: 1.5rem 0; color: var(--dim); }
.aside p:last-child { margin-bottom: 0; }

footer { margin-top: 72px; padding-top: 22px; border-top: 1px solid var(--line);
         color: var(--dim); font-size: 0.9em; display: flex; flex-wrap: wrap; gap: 6px 22px; }
footer a { color: var(--dim); }

/* Live gallery timeline. gallery.html itself is written by the Pi (pi/rabbitcam-publish.py);
   the time-of-day bands are the one loud move on the page. */
.updated { color: var(--dim); font-size: 0.92em; margin: -0.4em 0 0; }
.empty { color: var(--dim); }
.timeline { margin-top: 1.8rem; }
.day { position: relative; margin: 0 0 2.6rem; padding-left: 22px; border-left: 2px solid var(--line); }
.day > h2 { margin: 0 0 0.9rem; }
.day > h2 span { font: 500 0.55em/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
                 color: var(--dim); margin-left: 0.4em; letter-spacing: 0; }
.period { position: relative; border-radius: 18px; padding: 16px 18px 20px; margin: 0 0 14px; }
.period::before { content: ""; position: absolute; left: -29px; top: 22px; width: 12px; height: 12px;
                  border-radius: 50%; background: var(--dot); box-shadow: 0 0 0 3px var(--paper); }
.period > h3 { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; font-size: 1.2rem; }
.period > h3 span { font: 500 0.72em/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; opacity: 0.72; }
.period .visits { margin: 0; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.period .visits figcaption { color: inherit; opacity: 0.9; }
.period .visits figcaption time { font-weight: 650; font-variant-numeric: tabular-nums; }
.period .visits figcaption small { font-size: 0.85em; opacity: 0.8; }  /* camera name, once there is more than one */
.period .visits video { box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08); }

/* Setup page secrets (site/secrets.js): placeholders until "Reveal secrets". */
.reveal { margin: 1.6rem 0 0; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; }
.reveal h2 { margin: 0 0 0.3em; font-size: 1.2rem; }
.reveal p { margin: 0 0 0.8em; }
.reveal button { font: inherit; font-weight: 600; padding: 8px 16px; border: 0; border-radius: 999px;
                 background: var(--clover); color: var(--paper); cursor: pointer; }
.reveal button:focus-visible, .reveal input:focus-visible { outline: 2px solid var(--clover); outline-offset: 2px; }
.reveal [hidden] { display: none; }
.reveal-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.reveal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9em; color: var(--dim); }
.reveal-form input { font: inherit; color: var(--ink); background: var(--paper); padding: 7px 10px;
                     border: 1px solid var(--line); border-radius: 8px; min-width: 11em; }
.reveal-msg { margin: 0.8em 0 0; min-height: 1.6em; color: var(--dim); }
.secret { white-space: nowrap; }
a.secret { color: var(--dim); text-decoration-style: dashed; }
a.secret::after, code.secret::after { content: " \1F512"; font-size: 0.85em; }
code.secret { letter-spacing: 0.1em; color: var(--dim); }

/* Day pager (site/gallery.js): the day's own heading moves into the pager. */
.day-pager { display: flex; align-items: center; gap: 14px; margin: 1.8rem 0 1rem; }
.day-pager h2 { margin: 0; flex: 1; text-align: center; }
.day-pager h2 span { font: 500 0.55em/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
                     color: var(--dim); margin-left: 0.4em; letter-spacing: 0; }
.day-pager .arrow { position: relative; flex: none; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
                    display: grid; place-items: center; background: rgba(24, 42, 31, 0.55); color: #fff; cursor: pointer; }
.day-pager .arrow::before { content: ""; position: absolute; inset: -8px; }
.day-pager .arrow:hover:not(:disabled) { background: rgba(24, 42, 31, 0.8); }
.day-pager .arrow:disabled { opacity: 0.25; cursor: default; }
.day-pager .arrow:focus-visible { outline: 2px solid var(--clover); outline-offset: 3px; }
.day-pager .arrow svg { width: 10px; height: 16px; fill: currentColor; margin-right: 2px; }
.day-pager .next svg { transform: scaleX(-1); margin: 0 0 0 2px; }
.timeline.paged { margin-top: 0; }
.timeline.paged .day > h2 { display: none; }

/* Clip play button and lightbox (site/gallery.js). */
.visits .clip { position: relative; }
.visits .play { position: absolute; inset: 0; width: 100%; padding: 0; border: 0; border-radius: 8px;
                background: transparent; cursor: pointer; }
.visits .play::after { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(24, 42, 31, 0.6)
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M5 2.5l9 5.5-9 5.5z' fill='white'/%3E%3C/svg%3E")
  no-repeat 56% 50% / 18px; transition: transform 120ms; }
.visits .play:hover::after { transform: scale(1.08); }
.visits .play:focus-visible { outline: 2px solid var(--clover); outline-offset: 2px; }
.lightbox { width: min(600px, 92vw); max-width: none; padding: 0; border: 0; background: transparent; overflow: visible; }
.lightbox::backdrop { background: rgba(8, 12, 10, 0.8); }
.lightbox video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; }
.lightbox .close { position: absolute; right: 0; bottom: calc(100% + 8px); width: 32px; height: 32px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 22px; line-height: 1; cursor: pointer; }
.lightbox .close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.morning   { --dot: #E0A43F; color: #3A2C14; background: linear-gradient(165deg, #FCF3DF 0%, #F6E2C2 100%); }
.afternoon { --dot: #4E93BF; color: #16303F; background: linear-gradient(165deg, #EDF6FB 0%, #D5E8F3 100%); }
.evening   { --dot: #C4717E; color: #3A1D28; background: linear-gradient(165deg, #F8E1CF 0%, #EBC2BF 55%, #CFA6BC 100%); }
.night     { --dot: #3F4F7A; color: #E3E7F4; background: linear-gradient(165deg, #2A3662 0%, #151B35 100%); }
.night a { color: #BFD0FF; }
@media (max-width: 640px) {
  .day { padding-left: 16px; }
  .period { padding: 14px 12px 16px; border-radius: 14px; }
  .period::before { left: -23px; }
}
