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

/* --- "ocean" theme: underwater. Deep-blue gradient with light rays from the
   surface and slowly rising bubbles, frosted-glass panels, square corners.
   Appended after base.css. --- */

:root {
  --bg: #04263d;
  --fg: #e7f6fb;
  --muted: #8ec3d6;
  --accent: #6ee7f0;
  --line: rgba(160, 230, 255, .18);
  --tile: rgba(255, 255, 255, .06);
  --glass: rgba(180, 235, 255, .08);
  --gap: 10px;
  --row: 240px;
  color-scheme: dark;
}

body {
  min-height: 100vh;
  background: linear-gradient(180deg, #0d6a86 0%, #07425f 22%, #042a43 55%, #01111f 100%) fixed;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
}
/* light rays from the surface */
body::before {
  content: ""; position: fixed; inset: -20% -10% 30%; z-index: -1; pointer-events: none;
  background: repeating-linear-gradient(100deg,
    transparent 0 60px, rgba(190, 240, 255, .07) 60px 90px, transparent 90px 170px,
    rgba(190, 240, 255, .04) 170px 230px, transparent 230px 320px);
  mask-image: linear-gradient(180deg, #000, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent);
  transform: skewX(-8deg);
}
/* bubbles */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .35), rgba(255, 255, 255, .05) 60%, transparent 62%),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .3), rgba(255, 255, 255, .04) 60%, transparent 62%),
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .25), rgba(255, 255, 255, .03) 60%, transparent 62%);
  background-size: 14px 14px, 9px 9px, 6px 6px;
  background-repeat: no-repeat;
  animation: bubbles 18s linear infinite;
  opacity: .8;
}
.page { position: relative; z-index: 0; }
@keyframes bubbles {
  0%   { background-position: 8% 110%, 92% 120%, 55% 105%; }
  100% { background-position: 14% -10%, 86% -15%, 60% -8%; }
}
@media (prefers-reduced-motion: reduce) { body::after { animation: none; opacity: 0; } }

a { color: var(--accent); }

/* frosted-glass header bar (geometry: the shared bar.css, appended after this) */
header.site {
  background: var(--glass); border-color: rgba(110, 231, 240, .5) var(--line) var(--line);   /* the surface on top */
  backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
}
.brand { color: var(--fg); font-size: 1.15rem; font-weight: 600; letter-spacing: .04em; }
.brand::before { content: "◦ "; color: var(--accent); }
header.site nav a { color: var(--fg); }
header.site nav a:hover { background: rgba(110, 231, 240, .15); text-decoration: none; }
@media (max-width: 600px) { .brand::before { content: none; } .brand { box-shadow: 0 0 0 1px var(--line); } }

.crumbs a { color: var(--muted); }

header.album {
  max-width: 48rem; margin: 30px auto 36px; text-align: center;
}
header.album h1 { font-weight: 500; text-shadow: 0 2px 30px rgba(110, 231, 240, .35); }
.subtitle { color: var(--muted); }
.lead { color: #cde9f2; }

/* square tiles that glow when touched */
.grid li { overflow: hidden; position: relative; transition: transform .3s ease, box-shadow .3s; }
.grid li:hover { transform: translateY(-4px); box-shadow: 0 0 0 2px rgba(110, 231, 240, .6), 0 14px 40px rgba(110, 231, 240, .25); z-index: 2; }
.grid a:hover img { opacity: 1; }
.grid .cap {
  display: block; position: absolute; left: 8px; right: 8px; bottom: 8px;
  padding: 6px 10px;
  background: rgba(4, 38, 61, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--fg); font-size: .82rem;
  opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s;
}
.grid a:hover .cap { opacity: 1; transform: none; }

h2.section { border-bottom: 0; color: var(--accent); font-weight: 500; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; }
h2.section::after { content: ""; display: block; height: 1px; margin-top: 8px; background: linear-gradient(90deg, var(--accent), transparent); }

/* photo page */
figure.photo img { box-shadow: 0 20px 60px rgba(0, 0, 0, .5), 0 0 80px rgba(110, 231, 240, .12); }
figcaption { color: #cde9f2; }
.pager {
  max-width: 34rem; padding: 4px; border-radius: 2px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.pager a { padding: 6px 16px; border-radius: 2px; }
.pager a:hover { background: rgba(110, 231, 240, .15); text-decoration: none; }

/* index pages: glass cards */
.cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px 18px; }   /* 4 per row, as Travel */
.cards a {
  padding: 8px 8px 12px;
  border-radius: 3px;
  background: var(--glass); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .3s, box-shadow .3s;
}
.cards a:hover { transform: translateY(-4px); box-shadow: 0 12px 40px rgba(110, 231, 240, .2); }
.cards picture { border-radius: 2px; }
.cards .t, .cards .d { padding: 0 4px; }
.cards a:hover .t { text-decoration: none; color: var(--accent); }

footer.site { border-top: 0; text-align: center; color: var(--muted); }

/* blogs: text on a glass panel */
.post {
  padding: 30px 40px;
  background: rgba(2, 25, 42, .55); border: 1px solid var(--line);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.post figure img { border-radius: 0; }
.posts li { border-top: 1px solid var(--line); }
.posts img { border-radius: 0; }
.posts a:hover .t { color: var(--accent); }

@media (max-width: 600px) {
  .post { padding: 20px 16px; }
}

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