/* vode.iki.fi - base stylesheet = the "clean" theme.
   Other themes (dark.css, frame.css) are appended after this and override it.
   No JavaScript needed anywhere. */

:root {
  --bg: #f6f7fa;
  --fg: #1d2330;
  --muted: #5c6578;
  --accent: #34508f;          /* the old site's blue, a little deeper */
  --line: #dde1ea;
  --tile: #e6e9f0;
  --gap: 6px;
  --row: 220px;               /* target row height of the photo grid */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318;
    --fg: #e6e8ee;
    --muted: #9aa2b4;
    --accent: #8fa8e0;
    --line: #2a2f3a;
    --tile: #1c2029;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; max-width: 100%; height: auto; }

header.site, main, footer.site { max-width: 1600px; margin: 0 auto; padding: 0 16px; }

header.site {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 24px;
  padding-top: 14px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--fg); }
header.site nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }

.crumbs { font-size: .875rem; color: var(--muted); margin: 14px 0 8px; }
.crumbs a { color: var(--muted); }

/* --- album page --- */

header.album { max-width: 46rem; margin-bottom: 20px; }
header.album h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.15; margin: 0 0 4px; }
.subtitle { font-size: 1.15rem; margin: 0; }
.info { color: var(--muted); font-size: .9rem; margin: 4px 0 0; }
.lead { margin: 12px 0 0; }

/* Justified grid: every tile grows in proportion to its aspect ratio (--r),
   so all tiles in a row get the same height. The ::after spacer keeps the
   last row from stretching. */
.grid {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: var(--gap);
}
.grid::after { content: ""; flex-grow: 1e6; }
.grid li {
  flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row));
  aspect-ratio: var(--r);
  background: var(--tile);
}
.grid a, .grid picture { display: block; width: 100%; height: 100%; }
.grid .cap { display: none; }          /* shown by the dark theme */
.grid img { width: 100%; height: 100%; object-fit: cover; transition: opacity .15s; }
.grid a:hover img { opacity: .85; }
@media (max-width: 600px) {
  :root { --row: 115px; --gap: 4px; }
}

/* --- photo page --- */

figure.photo { margin: 0; }
figure.photo img {
  margin: 0 auto;
  max-height: calc(100vh - 230px);
  max-height: calc(100svh - 230px);
  width: auto;
}
figcaption { text-align: center; font-size: 1.05rem; margin-top: 10px; }

.pager {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 40rem; margin: 10px auto;
}
.pager a { padding: 6px 4px; }
.pager .up { color: var(--muted); font-size: .9rem; }

.exif { text-align: center; color: var(--muted); font-size: .8rem; margin: 0 0 16px; }

footer.site {
  margin-top: 40px; padding-top: 14px; padding-bottom: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .8rem;
}

/* --- index pages (Travel, SCUBA, ...): album cards --- */

h2.section {
  font-size: 1rem; font-weight: 600;
  margin: 40px 0 14px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.cards {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 24px 16px;
}
.cards a { display: block; color: var(--fg); }
.cards a:hover { text-decoration: none; }
.cards picture { display: block; aspect-ratio: 3 / 2; overflow: hidden; background: var(--tile); }
.cards img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.cards a:hover img { transform: scale(1.04); }
.cards .t { display: block; margin-top: 8px; font-weight: 600; font-size: .95rem; line-height: 1.3; }
.cards a:hover .t { text-decoration: underline; }
.cards .d { display: block; margin-top: 2px; color: var(--muted); font-size: .8rem; }
@media (max-width: 600px) {
  .cards { grid-template-columns: repeat(2, 1fr); gap: 18px 10px; }
  .cards .t { font-size: .85rem; }
}

/* --- video page --- */

figure.video { margin: 0; }
figure.video video {
  display: block; margin: 0 auto;
  width: 100%; height: auto;
  max-height: calc(100vh - 260px);
  max-height: calc(100svh - 260px);
  background: #000;
}

/* album descriptions: paragraphs and links (from album.toml) */
.lead p { margin: 0 0 .7em; }
.lead p:last-child { margin-bottom: 0; }
.lead a, .links a { text-decoration: underline; text-underline-offset: 2px; }
.links { margin: 12px 0 0; font-size: .9rem; }
h2.section + .lead { margin: -4px auto 14px; }

/* --- travel blogs: post page and list of posts --- */

.post { max-width: 42rem; margin: 0 auto; font-size: 1.05rem; line-height: 1.65; }
.post header.album { margin-left: 0; margin-right: 0; }
.post p { margin: 0 0 1em; }
.post figure { margin: 1.6em 0; }
.post figure img { margin: 0 auto; border-radius: 3px; }
.post figcaption { color: var(--muted); font-size: .9rem; text-align: center; margin-top: 6px; }
.post + .pager, .post ~ .links { max-width: 42rem; margin-left: auto; margin-right: auto; }

.posts { list-style: none; padding: 0; max-width: 46rem; margin: 0 auto 32px; }
.posts li { border-top: 1px solid var(--line); }
.posts a {
  display: grid; grid-template-columns: 160px 1fr; grid-template-rows: auto auto 1fr;
  column-gap: 18px; padding: 16px 0; color: var(--fg);
}
.posts a:hover { text-decoration: none; }
.posts a:hover .t { text-decoration: underline; }
.posts img { grid-row: 1 / 4; width: 160px; height: 110px; object-fit: cover; border-radius: 3px; }
.posts .t { font-weight: 600; font-size: 1.1rem; }
.posts .d { color: var(--muted); font-size: .85rem; }
.posts .x { color: var(--muted); font-size: .95rem; margin-top: 4px; }
@media (max-width: 600px) {
  .posts a { grid-template-columns: 96px 1fr; column-gap: 12px; }
  .posts img { width: 96px; height: 72px; }
  .posts .x { display: none; }
}

/* --- "dark" theme: gallery / portfolio look. Appended after base.css. --- */

:root {
  --bg: #0c0d0f;
  --fg: #e8e9ec;
  --muted: #8b909a;
  --accent: #d6deee;
  --line: #22252b;
  --tile: #17191d;
  --gap: 3px;
  --row: 260px;
  color-scheme: dark;
}
@media (max-width: 600px) {
  :root { --row: 120px; --gap: 2px; }
}

header.site { border-bottom: 0; justify-content: space-between; }
.brand { font-weight: 600; font-size: .9rem; letter-spacing: .14em; text-transform: uppercase; }
header.site nav a { color: var(--muted); font-size: .9rem; }
header.site nav a:hover { color: var(--fg); text-decoration: none; }

.crumbs { text-align: center; margin-top: 18px; }

header.album { max-width: none; text-align: center; margin: 24px 0 32px; }
header.album h1 { font-weight: 300; letter-spacing: .02em; }
.subtitle { color: var(--muted); }
.lead { max-width: 40rem; margin: 14px auto 0; color: #c3c7cf; }

/* grid runs edge to edge */
.grid { margin: 0 -13px; }
.grid li { position: relative; overflow: hidden; }
.grid img { transition: transform .5s ease, opacity .2s; }
.grid a:hover img { opacity: 1; transform: scale(1.03); }
.grid .cap {
  display: block; position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 12px 9px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .75));
  color: #fff; font-size: .85rem;
  opacity: 0; transition: opacity .2s;
}
.grid a:hover .cap, .grid a:focus-visible .cap { opacity: 1; }

/* photo page: as big as possible on black */
figure.photo img { max-height: calc(100vh - 200px); max-height: calc(100svh - 200px); }
figcaption { color: #c3c7cf; font-weight: 300; }
.pager a { color: var(--muted); }
.pager a:hover { color: var(--fg); text-decoration: none; }

footer.site { border-top: 0; text-align: center; }

/* index pages */
h2.section {
  color: var(--muted); font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
}
.cards .t { font-weight: 400; }
