/* 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;
}
footer.site a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }   /* e-mail: readable on every theme's footer */

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

/* --- "magazine" theme: a printed travel magazine. Cream paper, serif type,
   double rules, drop caps, masonry columns with captions under the photos.
   Appended after base.css. --- */

:root {
  --bg: #f3eee4;
  --fg: #1c1a16;
  --muted: #6f675a;
  --accent: #a3271c;            /* magazine red */
  --line: #cfc5b3;
  --tile: #e4dccd;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --caps: "Avenir Next", "Gill Sans", "Trebuchet MS", system-ui, sans-serif;
  --plate: #fffdf8;             /* the paper around a photo on its own page */
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {   /* the device is in dark mode: a night edition on dark warm paper */
  :root {
    --bg: #1b1915;
    --fg: #ebe3d3;
    --muted: #a59b88;
    --accent: #e07a68;
    --line: #4a4336;
    --tile: #2b2720;
    --plate: #26231d;
  }
}

body { font-family: var(--serif); font-size: 17px; line-height: 1.6; }
a { color: var(--accent); }

/* masthead: one bar between double rules -- site name left, sections right
   (its geometry is the shared bar.css, appended after this) */
:root { --bar-rule: double; }
header.site { border-color: var(--fg); background: var(--bg); }
.brand { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.45rem; letter-spacing: -.01em; color: var(--fg); }
.brand:hover { text-decoration: none; color: var(--accent); }
header.site nav a { color: var(--fg); }
header.site nav a:hover { color: var(--accent); text-decoration: none; }
@media (max-width: 600px) { .brand { box-shadow: 0 0 0 1px var(--line); } }

main, footer.site { max-width: 1200px; }

/* album opening: big serif headline, italic standfirst, drop cap */
header.album { max-width: 44rem; margin: 40px auto 44px; text-align: center; }
header.album h1 { font-weight: 400; font-size: clamp(1.9rem, 5vw, 3.4rem); line-height: 1.02; letter-spacing: -.02em; }
.subtitle { font-style: italic; font-size: 1.3rem; color: var(--muted); margin-top: 8px; }
.info {
  font-family: var(--caps); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  margin-top: 14px;
}
.info::before, .info::after { content: " — "; color: var(--line); }
header.album .lead { text-align: left; font-size: 1.12rem; margin-top: 28px; }
header.album p.lead { text-align: center; font-style: italic; color: var(--muted); }   /* index pages: one intro line */
header.album .lead p:first-child::first-letter {
  float: left; font-size: 4.4em; line-height: .82; padding: .06em .08em 0 0;
  color: var(--accent); font-weight: 400;
}

/* masonry: CSS columns, every photo at its own shape, caption printed underneath */
.grid { display: block; columns: 3 300px; column-gap: 28px; }
.grid::after { content: none; }
.grid li {
  break-inside: avoid; aspect-ratio: auto; background: none;
  margin: 0 0 28px;
}
.grid a { height: auto; color: var(--fg); }
.grid a:hover { text-decoration: none; }
.grid picture { aspect-ratio: var(--r); height: auto; background: var(--tile); }
.grid img { transition: filter .3s; }
.grid a:hover img { opacity: 1; filter: saturate(1.15) contrast(1.05); }
.grid .cap {
  display: block; padding-top: 7px;
  font-style: italic; font-size: .9rem; line-height: 1.4; color: var(--muted);
  border-bottom: 1px solid var(--line); padding-bottom: 8px;
}
h2.section {
  text-align: center; border-bottom: 0;
  font-weight: 400; font-style: italic; font-size: 1.8rem;
  margin: 56px 0 22px;
}
h2.section::before {
  content: ""; display: block; width: 60px; margin: 0 auto 18px;
  border-top: 3px double var(--fg);
}
h2.section + .lead { max-width: 40rem; text-align: center; font-style: italic; }

/* photo page: a full-page plate with a thin keyline */
figure.photo img { padding: 10px; background: var(--plate); box-shadow: 0 0 0 1px var(--line); }
figcaption { font-style: italic; font-size: 1.2rem; margin-top: 16px; }
.pager { font-family: var(--caps); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.exif { font-family: var(--caps); letter-spacing: .04em; }

/* index pages: a contents page */
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 36px 28px; }
.cards .t { font-weight: 400; font-size: 1.25rem; line-height: 1.2; margin-top: 12px; }
.cards .d {
  font-family: var(--caps); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase;
}

footer.site {
  text-align: center; border-top: 3px double var(--fg);
  font-family: var(--caps); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
}

/* blogs: a long-read feature */
.post { max-width: 38rem; font-size: 1.15rem; line-height: 1.7; }
.post header.album { text-align: center; }
.post > p:first-of-type::first-letter {
  float: left; font-size: 4.2em; line-height: .8; padding: .08em .1em 0 0; color: var(--accent);
}
.post figure { margin: 2em -4rem; }
.post figure img { border-radius: 0; }
.post figcaption { font-style: italic; text-align: left; border-left: 2px solid var(--accent); padding-left: 10px; }
.posts li { border-top: 1px solid var(--line); }
.posts .t { font-weight: 400; font-size: 1.45rem; line-height: 1.2; }
.posts .d { font-family: var(--caps); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; margin-top: 4px; }
.posts .x { font-style: italic; }
.posts img { border-radius: 0; }

@media (max-width: 760px) {
  .post figure { margin: 1.6em 0; }
}
@media (max-width: 600px) {
  .grid { columns: 2; column-gap: 12px; }
  .grid li { margin-bottom: 14px; }
  .grid .cap { font-size: .78rem; }
}

/* --- the shared top bar (magazine's masthead) and content width: appended LAST to the magazine, brutalist,
   swiss, ocean and baltic themes, so the site name, the menu and the breadcrumbs sit in
   exactly the same place on every page and nothing jumps when a page changes theme.
   Only geometry and the menu's type are fixed here; colours, backgrounds, rule colours,
   the site name's typeface and hover effects belong to each theme. Themes may decorate
   with background / box-shadow / colour, never with padding, margins or border widths.
   Sticky: the bar needs a background in every theme (content scrolls under it).
   --bar-rule: style of the top rule (double = magazine; solid elsewhere). --- */

html { scrollbar-gutter: stable; }        /* a scrollbar on a long page doesn't shift the bar */

header.site {
  box-sizing: border-box; position: sticky; top: 0; z-index: 10;   /* stays at the top when scrolling */
  display: flex; flex-wrap: nowrap; flex-direction: row;
  justify-content: space-between; align-items: center; gap: 0 24px;
  width: auto; max-width: 1200px; height: 46px;
  margin: 22px auto 0; padding: 0 16px;
  border-width: 3px 0 1px; border-style: var(--bar-rule, solid) none solid; border-radius: 0;
}
.brand {
  line-height: 1; white-space: nowrap;          /* its typeface and size: the theme's */
  writing-mode: horizontal-tb; transform: none; margin: 0;
}
header.site nav {
  order: 0; display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: flex-end;
  gap: 0 8px; margin: 0 -9px 0 0;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", system-ui, sans-serif;
  font-size: .72rem; font-weight: 600; font-style: normal; line-height: 1.6;
  letter-spacing: .2em; text-transform: uppercase;
}
header.site nav a {
  position: static; display: block; padding: 6px 9px; margin: 0; border: 0;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
}
header.site nav a::before { content: none; }

.crumbs {
  margin: 14px 0 8px; text-align: center;
  font-family: "Avenir Next", "Gill Sans", "Trebuchet MS", system-ui, sans-serif;
  font-size: .72rem; font-weight: 400; letter-spacing: .08em; text-transform: uppercase;
}

/* the content below the bar: Travel's width (1200 px), same left/right edges in every theme;
   the layout inside it is the theme's */
main, footer.site { max-width: 1200px; margin-left: auto; margin-right: auto; padding-left: 16px; padding-right: 16px; }

/* phones: the site icon instead of the name, so the sections fit on one line */
@media (max-width: 600px) {
  header.site { gap: 0 14px; height: 40px; margin-top: 12px; padding: 0 16px; }
  .brand {
    flex: none; width: 30px; height: 30px; padding: 0; border-radius: 50%;
    background: url(/apple-touch-icon.png) center / cover;
    overflow: hidden; text-indent: 100%; white-space: nowrap;   /* name kept for screen readers */
  }
  header.site nav { gap: 0 4px; margin-right: -5px; font-size: .68rem; letter-spacing: .12em; }
  header.site nav a { flex: none; padding: 6px 5px; }
}
