/* 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; }
}

/* --- "classic" look: the original vode.iki.fi idea (blue background, white
   page, light-blue title band, menu bar, text + photo columns, buttons),
   redrawn crisper. Used by the front page; also available as an album theme. --- */

:root {
  --bg: #5f78ad;
  --fg: #1f2b45;
  --text: #2b3a5c;
  --muted: #5f6d8a;
  --accent: #2a4c9c;
  --line: #d6ddeb;
  --tile: #eef2f8;
  --title: #4d67a3;
  --gap: 14px;
  color-scheme: light;
}

body {
  background: linear-gradient(180deg, #6f88bc, #56709f) fixed var(--bg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  padding: 32px 16px 48px;
}

/* the page: white card with a crisp edge and a soft shadow */
.page {
  max-width: 1040px;
  margin: 0 auto;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(20, 35, 70, .35), 0 20px 50px rgba(15, 25, 55, .35);
}
header.site, main, footer.site { max-width: none; }

/* title band + menu bar */
header.site { display: block; padding: 0; border: 0; }
.brand {
  display: block; margin: 0;
  padding: 24px 36px 18px;
  background: linear-gradient(180deg, #f2f6fb, #d9e3f0);
  border-bottom: 1px solid #c3cfe2;
  color: var(--title);
  font-size: clamp(1.9rem, 5vw, 2.8rem); font-weight: 750; letter-spacing: -.02em; line-height: 1.1;
}
.brand:hover { text-decoration: none; }
header.site nav {
  display: flex; flex-wrap: wrap; gap: 0;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-size: .9rem;
}
header.site nav a {
  padding: 11px 12px 9px;
  color: var(--accent); font-weight: 500;
  border-bottom: 2px solid transparent;
}
header.site nav a:hover { border-bottom-color: var(--title); text-decoration: none; }

main { padding: 0 36px; }
.crumbs { margin-top: 16px; }
.crumbs a { color: var(--muted); }
header.album h1 { color: var(--text); font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
.subtitle, .lead { color: var(--text); }

footer.site {
  margin-top: 48px;
  padding: 14px 36px;
  background: #f4f6fa;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: .78rem; text-align: center;
}

/* buttons (front page) and photo pager */
.buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.buttons a, .pager a {
  display: inline-block;
  padding: 7px 22px;
  background: #fff;
  border: 1px solid #9fb0d0; border-radius: 4px;
  color: var(--accent); font-size: .9rem; font-weight: 600;
  transition: background .15s, color .15s;
}
.buttons a:hover, .pager a:hover { background: var(--title); border-color: var(--title); color: #fff; text-decoration: none; }
.pager .up { color: var(--accent); }

/* --- front page --- */

.intro {
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px 48px; align-items: center;
  max-width: 860px; margin: 48px auto 8px;
}
.intro h2 { color: var(--title); font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; margin: 0 0 14px; }
.intro p { color: var(--text); font-size: .95rem; line-height: 1.6; margin: 0 0 12px; }
.intro img {
  width: 100%;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15), 0 10px 28px rgba(20, 35, 70, .22);
}

.recent { max-width: 860px; margin: 48px auto 0; }
.recent h2 {
  color: var(--title); font-size: .8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em;
  padding-top: 28px; margin: 0 0 16px;
  border-top: 1px solid var(--line);
}
.recent .cards { grid-template-columns: repeat(4, 1fr); gap: 20px 16px; }
.recent .cards picture { border-radius: 3px; }
.recent .cards .t { color: var(--text); font-size: .88rem; }

/* --- "classic" album theme: uniform thumbnail grid --- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--gap); }
.grid::after { content: none; }
.grid li {
  aspect-ratio: 4 / 3;
  background: var(--tile);
  border: 1px solid var(--line); border-radius: 3px;
  padding: 8px;
  transition: border-color .15s;
}
.grid li:hover { border-color: var(--title); }
.grid img { object-fit: contain; }
figure.photo img { max-height: calc(100vh - 300px); max-height: calc(100svh - 300px); }

/* --- small screens --- */

@media (max-width: 760px) {
  .intro { grid-template-columns: 1fr; gap: 28px; margin-top: 28px; }
  .recent .cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  body { padding: 0; background: #fff; }
  .page { border-radius: 0; box-shadow: none; }
  .brand { padding: 18px 16px 14px; }
  header.site nav { padding: 0 6px; }
  header.site nav a { padding: 10px 8px 8px; }
  main { padding: 0 16px; }
  footer.site { padding: 14px 16px; }
  .grid { grid-template-columns: repeat(2, 1fr); --gap: 8px; }
  .grid li { padding: 4px; }
  figure.photo img { max-height: none; }
}
