:root {
  --bg: #ffffff;
  --fg: #403a60;
  /* --fg 20% lighter for the title and 10% darker for the menu. */
  --title-fg: #666180;
  --nav-fg: #3a3456;
  --muted: #6b7076;
  --line: #e2e2dd;
  --panel: #f0f0ed;
  --sans: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* The dark theme, for a device set to dark mode. Only with darkTheme: true
   in site.js, which gives the html element the dark-theme class
   (layouts/base.liquid); otherwise the page stays light. */
@media (prefers-color-scheme: dark) {
  :root.dark-theme {
    --bg: #16181a;
    --fg: #e8e8e4;
    --title-fg: var(--fg);
    --nav-fg: var(--fg);
    --muted: #9aa0a6;
    --line: #2c2f33;
    --panel: #222528;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.65 var(--sans);
}

/* Wide screens: a fixed 250px sidebar holds the title and nav, with the
   footer pinned to its bottom. Phones get a bar across the top instead
   (the media query after these rules). */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9;
  width: 250px;
  height: 100%;
  padding: 40px 30px 0;
  background: var(--bg);
}

.site-title {
  margin: 0;
  font: 700 25px/1.5 var(--sans);
  letter-spacing: 0.2em;
}

.site-title a {
  color: var(--title-fg);
  text-decoration: none;
}

.menu-toggle {
  display: none;
}

.primary-navigation {
  padding: 22px 0 40px;
  font: 16px/23px var(--sans);
  letter-spacing: 0.2em;
}

.nav {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 26px from one album to the next, like the reference, while a title that
   wraps keeps its own lines closer together. */
.nav li {
  padding: 3px 0;
}

.nav a {
  color: var(--nav-fg);
  text-decoration: none;
}

/* The current album isn't marked for now. To underline it, like the
   reference, add .nav a[aria-current="page"] to this rule. */
.nav a:hover {
  text-decoration: underline;
  /* Jost puts the line right under the letters; this drops it clear of g and
     y, and thins it to match the strokes of the letters. */
  text-underline-offset: 0.3em;
  text-decoration-thickness: 1px;
}

/* Icon links above the notice. The envelope only fills the middle of its
   45px box, so pull the box left until the envelope lines up with the rule
   and text below, and leave about 14px of air under the envelope. */
.social-links {
  margin: 0 0 -2px -12px;
  line-height: 0;
}

.social-links a {
  display: inline-block;
  width: 45px;
  height: 45px;
  margin-right: 5px;
  color: var(--fg);
  transition: color 0.17s ease-in-out;
}

.social-links a:hover {
  color: var(--muted);
}

.social-links svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

/* The content starts right at the sidebar's edge. */
.site {
  padding: 40px 20px 40px 250px;
}

main {
  max-width: 42rem;
}

/* Whatever comes first lines up with the site title, 40px from the top. */
main > :first-child {
  margin-top: 0;
}

/* Outside the header in the markup, so on phones it can fall to the end of the page. */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 10;
  width: 250px;
  padding: 0 30px 30px;
  font: 10px/19px var(--sans);
}

/* The short rule above the notice. */
.site-info::before {
  content: "";
  display: block;
  width: 25px;
  height: 1px;
  margin-bottom: 10px;
  background: var(--fg);
}

.site-info {
  margin: 0;
}

/* One blank line before the credit link. */
.copyright {
  margin: 0;
  padding-top: 19px;
}

.site-footer a {
  color: var(--fg);
}

/* Phones: every iPhone is under 600px wide held upright, and under 500px
   tall turned sideways, which is too short for the sidebar. iPads keep it. */
@media (max-width: 600px), (max-height: 500px) {
  .site-header {
    position: sticky;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: auto;
    height: auto;
    padding: 10px 20px;
  }

  .js .menu-toggle {
    position: relative;
    z-index: 2;
    display: block;
    width: 30px;
    height: 40px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--nav-fg);
    cursor: pointer;
  }

  /* The hamburger: the span is the middle bar, ::before and ::after the outer two. */
  .menu-icon,
  .menu-icon::before,
  .menu-icon::after {
    position: absolute;
    left: 0;
    width: 30px;
    height: 3px;
    background: currentColor;
    transition: transform 0.3s ease;
  }

  .menu-icon {
    top: calc(50% - 1.5px);
  }

  .menu-icon::before,
  .menu-icon::after {
    content: "";
  }

  .menu-icon::before {
    top: -9px;
  }

  .menu-icon::after {
    top: 9px;
  }

  /* Open, the outer bars cross into an X and the middle one drops out. */
  .menu-open .menu-icon {
    background: transparent;
  }

  .menu-open .menu-icon::before {
    transform: translateY(9px) rotate(45deg);
  }

  .menu-open .menu-icon::after {
    transform: translateY(-9px) rotate(-45deg);
  }

  /* With no Menu button to open it, the nav just sits under the title. */
  .primary-navigation {
    flex-basis: 100%;
    padding: 10px 0 0;
  }

  .js .primary-navigation {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
    width: 84.375%;
    height: 100%;
    padding: 20px;
    overflow-y: auto;
    background: var(--panel);
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.3s ease, visibility 0.3s;
  }

  .menu-open .primary-navigation {
    transform: none;
    visibility: visible;
  }

  .js .nav a {
    display: block;
    padding: 8px 0;
  }

  .site {
    padding: 20px 20px 40px;
  }

  .site-footer {
    position: static;
    width: auto;
    margin-top: 40px;
    padding: 0;
  }

  .site-info {
    max-width: 190px;
  }
}

a {
  color: var(--title-fg);
}

/* The link at the end of each album page, in the menu's color. */
.back-link {
  color: var(--nav-fg);
  text-decoration: none;
}

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.2rem;
  margin: 2.25rem 0 0.5rem;
}

.lede {
  font-size: 1.1rem;
  color: var(--muted);
}

.album-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.album-list li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
}

.album-list a {
  font-weight: 600;
  text-decoration: none;
}

.count {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

/* The album grid itself is in /album-layout/album.css, shared with Arrange.
   A framed album's widest row can outgrow the usual 42rem page, so main lets
   go of its max-width there and the album caps its own width instead. The
   same goes for a free layout with a width: (album-boxes.css). */
main:has(.album-frame),
main:has(.album-boxes-wide) {
  max-width: none;
}

.album-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Page transitions: on a link to another page of the site, the old page fades
   out to the background colour, then the new one fades in. The header keeps
   its own view-transition-name so it stays put instead of fading. So does
   the footer on wide screens, where it sits in the sidebar; on phones it's at
   the end of the page and fades with everything else. Browsers without
   cross-document view transitions just load the page as before. */
@view-transition {
  navigation: auto;
}

@keyframes fade-out {
  to { opacity: 0; }
}

@keyframes fade-in {
  from { opacity: 0; }
}

::view-transition {
  background: var(--bg);
}

::view-transition-old(root) {
  animation: 0.3s ease-out both fade-out;
}

::view-transition-new(root) {
  animation: 0.4s ease-out 0.3s both fade-in;
}

.site-header {
  view-transition-name: site-header;
}

@media (min-width: 601px) and (min-height: 501px) {
  .site-footer {
    view-transition-name: site-footer;
  }
}

/* A photo that was still loading when the page was ready, usually one
   further down that loading="lazy" held back until you scrolled near it,
   fades in when it arrives. base.liquid adds the class. Photos already
   loaded by then just show. */
.photo-arrived {
  animation: 0.5s ease-out fade-in;
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*),
  .photo-arrived {
    animation: none;
  }
}
