/* The McKelmann Photoblog.
   Sizes and colours come from Nick's original WordPress theme (TestTemplate
   style.css, v1.0.3.1): the 130px Times title with its hard black shadow,
   the Arial oblique date, 650px photos in an 800px column, the grey calendar.
   New here: it fits phones and tablets, videos, a dark version of the same
   greys, and "Share this day". */

:root {
  color-scheme: light;
  --bg: #fff;
  --ink: #000;
  --soft: #666;
  --muted: #aaa;
  --cell: #f5f5f5;
  --cell-hover: #999;
  --foot: #ccc;
  --photo-bg: #eee;
  --link: #0000ee;
  --moon: block;
  --sun: none;
  --photo: 650px;
  --serif: "Times New Roman", Times, serif;
  --sans: Arial, Helvetica, sans-serif;
}
/* Dark: the same layout and greys, turned down. Follows the device unless the
   visitor picked one with the switch (data-theme on <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141414; --ink: #ececec; --soft: #9a9a9a; --muted: #6c6c6c; --cell: #222;
    --cell-hover: #555; --foot: #262626; --photo-bg: #1e1e1e; --link: #8ab4f8;
    --moon: none; --sun: block;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141414; --ink: #ececec; --soft: #9a9a9a; --muted: #6c6c6c; --cell: #222;
  --cell-hover: #555; --foot: #262626; --photo-bg: #1e1e1e; --link: #8ab4f8;
  --moon: none; --sun: block;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 8px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
}
a { color: var(--link); }

/* ---- title ---- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 1px 0;
  background: #777;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
.hero h1 {
  position: relative;
  margin: 0.67em 0.2em;
  font-size: clamp(46px, 9.3vw, 130px);
  line-height: 1.12;
  text-align: center;
  color: #fff;
  text-shadow: 3px 2px #000;
}
.hero h1 a { color: inherit; text-decoration: none; }

/* light / dark switch, top corner of the title picture */
.theme-toggle {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}
.theme-toggle:hover { background: rgba(0, 0, 0, 0.7); }
.theme-toggle:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.theme-toggle svg { width: 22px; height: 22px; }
.theme-toggle .moon { display: var(--moon); fill: #fff; }
.theme-toggle .sun { display: var(--sun); fill: #fff; stroke: #fff; stroke-width: 2; stroke-linecap: round; }

/* ---- the two columns ---- */
.page {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
}
main {
  width: 1000px;            /* the old theme's 800px column plus its 100px sides */
  max-width: 100%;
  min-width: 0;
  padding: 0 100px;
}
aside {
  width: 300px;
  padding-top: 50px;
}

.date { margin: 0.6em 0 0.5em; }
.date a {
  color: var(--ink);
  font-family: var(--sans);
  font-style: oblique;
  font-size: 40px;
  text-decoration: none;
}

/* ---- photos: one width for all, tall ones included ---- */
.shot {
  margin: 0 auto 16px;
  max-width: 100%;
  text-align: center;
}
.shot img,
.shot video {
  display: block;
  width: var(--photo);
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  background: var(--photo-bg);
}
.shot figcaption {
  max-width: calc(var(--photo) + 30px);
  margin: 6px auto 0;
  font-size: 15px;
  line-height: 1.3;
}
.empty { font-size: 18px; color: var(--soft); }

/* ---- videos: same width as the photos, a play button on the first frame ---- */
.play {
  position: relative;
  display: block;
  width: var(--photo);
  max-width: 100%;
  margin: 0 auto;
}
.play-button {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 86px;
  margin: -43px 0 0 -43px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, background 0.15s ease;
}
.play-button::after {
  content: "";
  position: absolute;
  left: 32px;
  top: 22px;
  border-style: solid;
  border-width: 17px 0 17px 28px;
  border-color: transparent transparent transparent #fff;
}
.play:hover .play-button,
.play:focus-visible .play-button { transform: scale(1.08); background: rgba(0, 0, 0, 0.7); }
.duration {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font: bold 14px var(--sans);
}

/* a video Immich is still preparing: its first frame (if made yet), dimmed, with a note */
.waiting-box {
  position: relative;
  width: var(--photo);
  max-width: 100%;
  min-height: 200px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  background: var(--photo-bg);
}
.waiting-box img { grid-area: 1 / 1; opacity: 0.45; }
.waiting-note {
  grid-area: 1 / 1;
  position: relative;
  max-width: 80%;
  padding: 8px 14px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font: italic bold 16px var(--sans);
}

/* ---- previous / next day ---- */
.days {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: var(--photo);
  margin: 28px auto 8px;
  font-family: var(--sans);
  font-style: oblique;
  font-size: 18px;
}
.days a { color: var(--ink); text-decoration: none; }
.days a:hover { text-decoration: underline; }
.days span:last-child { text-align: right; }

/* ---- calendar: grey squares; only days with photos are links ---- */
.calendar {
  width: 300px;
  border-collapse: separate;
  border-spacing: 0;
}
.calendar caption {
  text-align: left;
  font-size: 20px;
  font-weight: bold;
  margin: 10px 0 15px;
}
.calendar thead { font-size: 10px; }
.calendar th { padding-bottom: 5px; }
.calendar td {
  background: var(--cell);
  border: 1px solid var(--bg);
  text-align: center;
  padding: 8px;
  color: var(--muted);
}
.calendar td.pad { background: none; }
.calendar td a {
  display: block;
  margin: -8px;
  padding: 8px;
  color: var(--ink);
  font-weight: bold;
  text-decoration: none;
}
.calendar td a:hover,
.calendar td a:focus-visible { background: var(--cell-hover); color: #fff; }
.calendar td.current a { background: var(--ink); color: var(--bg); }
.calendar td.today { box-shadow: inset 0 0 0 2px var(--cell-hover); }
.months {
  display: flex;
  justify-content: space-between;
  width: 300px;
  margin-top: 6px;
}

/* ---- share this day: a wide grey square, like the calendar's ---- */
.share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 300px;
  margin-top: 22px;
  padding: 12px 8px;
  border: 0;
  background: var(--cell);
  color: var(--ink);
  font: italic bold 17px var(--sans);
  cursor: pointer;
}
.share:hover { background: var(--cell-hover); color: #fff; }
.share:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.share svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- footer ---- */
footer {
  margin-top: 40px;
  background: var(--foot);
  min-height: 150px;
}
footer p {
  margin: 0;
  padding: 20px 0;
  text-indent: 60px;
  font-size: 15px;
  font-weight: bold;
}

/* ---- the "no photos for that day" page ---- */
.lost { max-width: 650px; margin: 80px auto; padding: 0 16px; font: 20px var(--serif); text-align: center; }

/* ---- smaller screens: calendar moves under the photos ---- */
@media (max-width: 1150px) {
  main { width: 100%; padding: 0 16px; }
  aside { width: 100%; padding: 30px 16px 0; display: flex; flex-direction: column; align-items: center; }
}
@media (max-width: 700px) {
  body { margin: 0; }
  .hero { min-height: 200px; }
  .theme-toggle { top: 10px; right: 10px; width: 40px; height: 40px; }
  .date { margin: 0.5em 0 0.4em; }
  .date a { font-size: 26px; }
  main { padding: 0 8px; }
  .shot { margin-bottom: 14px; }
  .shot figcaption { padding: 0 4px; }
  .days { font-size: 16px; }
  .play-button { width: 68px; height: 68px; margin: -34px 0 0 -34px; }
  .play-button::after { left: 25px; top: 17px; border-width: 13px 0 13px 22px; }
  footer p { text-indent: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-toggle, .play-button { transition: none; }
}
