/* Styled after ozthorn.co.uk: white, black, Karla, bold uppercase titling,
   square images with tight gutters. */
:root {
  --bg: #fff;
  --fg: #111;
  --ink: #222;
  --muted: #777;
  --line: #e6e6e6;
  --soft: #f5f5f4;
  --card: #f0f0ef;
  --overlay: rgba(10, 10, 10, 0.95);
  --gap: 8px;
  --edge: clamp(16px, 2.6vw, 36px);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 400 16.5px/1.6 Karla, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

/* ── Header ─────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px var(--edge);
  background: var(--bg);
}
.site-title {
  font-weight: 800;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1;
  letter-spacing: .02em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}
.site-nav ul {
  display: flex;
  gap: clamp(20px, 3vw, 40px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { border-bottom-color: currentColor; }
.site-nav a[aria-current="page"],
.site-nav .in-section > a { border-bottom-color: var(--ink); }

/* Dropdowns, as on ozthorn.co.uk: shown on hover or keyboard focus. */
.site-nav .has-sub { position: relative; }
.site-nav .sub {
  position: absolute;
  top: 100%;
  left: -14px;
  z-index: 20;
  display: none;
  flex-direction: column;
  gap: 0;
  min-width: 160px;
  padding: 10px 14px;
  background: var(--bg);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .08);
}
.site-nav .has-sub:hover > .sub,
.site-nav .has-sub:focus-within > .sub { display: flex; }
.site-nav .sub a { display: inline-block; padding: 6px 0; }

.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  margin-right: -8px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 18px;
  height: 1.5px;
  margin: 0 auto;
  background: var(--ink);
  transition: transform .2s, opacity .2s;
}
.menu-toggle span { position: relative; }
.menu-toggle span::before,
.menu-toggle span::after { content: ""; position: absolute; left: 0; }
.menu-toggle span::before { top: -6px; }
.menu-toggle span::after { top: 6px; }
.menu-open .menu-toggle span { background: transparent; }
.menu-open .menu-toggle span::before { transform: translateY(6px) rotate(45deg); }
.menu-open .menu-toggle span::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 700px) {
  .menu-toggle { display: block; }
  .header-end { gap: 14px; }
  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 4px var(--edge) 16px;
  }
  .menu-open .site-nav { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav a { display: block; padding: 12px 0; font-size: 13px; border: 0; }
  .site-nav .sub {
    position: static;
    display: flex;
    min-width: 0;
    padding: 0 0 6px 16px;
    box-shadow: none;
  }
  .site-nav .sub a { padding: 8px 0; font-size: 12px; color: var(--muted); }
  .site-nav .sub a[aria-current="page"] { color: var(--ink); }
  .site-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
}

.header-end { display: flex; align-items: center; gap: clamp(20px, 3vw, 40px); }

/* Account avatar: Google photo, or an initial on a dark disc. */
.account { position: relative; }
.account[hidden] { display: none; }
.account-button {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}
.account-button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.account-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 30;
  min-width: 220px;
  padding: 14px 16px 10px;
  background: var(--bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
}
.account-menu[hidden] { display: none; }
.account-name { margin: 0; font-weight: 700; font-size: 14px; }
.account-name:empty { display: none; }
.account-email { margin: 0 0 10px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.account-signout {
  display: block;
  margin: 0 -16px;
  padding: 10px 16px 6px;
  border-top: 1px solid var(--line);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
}
.account-signout:hover { text-decoration: underline; text-underline-offset: 3px; }
[data-mode="share"] .account { display: none; }

/* ── View heading + filters ─────────────────────────── */
.view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 8px var(--edge) 20px;
}
.view-title {
  margin: 0;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
}
.count { font-weight: 400; color: var(--muted); margin-left: 6px; letter-spacing: .05em; }

.filters { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.filters button, .text-button {
  border: 0;
  border-bottom: 1px solid transparent;
  padding: 2px 0;
  background: none;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.filters button:hover, .text-button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ── Gallery ────────────────────────────────────────── */
.gallery {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: 0 var(--edge) 48px;
}
.col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.card { position: relative; }
.card-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: zoom-in;
}
.card .media {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--card);
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity .4s;
}
.card img.loaded { opacity: 1; }
.card:hover img.loaded { opacity: .85; }
.card .tag {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, .92);
  color: var(--ink);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity .2s;
}
.card:hover .tag, .card-open:focus-visible .tag { opacity: 1; }
@media (hover: none) { .card .tag { opacity: 1; } }
.card-open:focus-visible { outline: none; }
.card-open:focus-visible .media { outline: 2px solid var(--ink); outline-offset: 2px; }
.caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0 4px;
  font-weight: 500;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
}
.has-notes {
  flex: none;
  font-weight: 700;
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.empty { text-align: center; color: var(--muted); padding: 60px 16px; }

/* ── Lightbox ───────────────────────────────────────── */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #eee;
  overflow: hidden;
}
.lightbox::backdrop { background: rgba(10, 10, 10, 0.95); }
.lb-body {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 24px 64px;
}
.lb-figure { margin: 0; min-width: 0; display: flex; justify-content: center; }
.lb-figure img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 48px);
  object-fit: contain;
}
.lb-info {
  flex: 0 0 340px;
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  padding-right: 4px;
}
.lb-type {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: #999;
}
.lb-title {
  margin: 0 0 16px;
  font-weight: 800;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: .01em;
  text-transform: uppercase;
  color: #fff;
}
.lightbox .notes { color: #ddd; }
.lightbox .notes a { color: #fff; }
.lightbox .notes .callout { background: rgba(255, 255, 255, .07); }
.lightbox .notes blockquote { border-color: #555; color: #ccc; }
.lightbox .notes hr { border-color: #333; }

.lb-close, .lb-nav {
  position: absolute;
  z-index: 1;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
  opacity: .7;
  font: 300 40px/1 Karla, sans-serif;
  padding: 12px 16px;
}
.lb-close:hover, .lb-nav:hover { opacity: 1; }
.lb-close { top: 8px; right: 8px; }
.lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 4px; top: 50%; transform: translateY(-50%); }

@media (max-width: 800px) {
  .lb-nav { display: none; }
  .lb-body { overflow-y: auto; padding: 56px 16px 24px; }
  .lightbox.has-info .lb-body {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 20px;
    padding: 56px 16px 32px;
  }
  .lightbox.has-info .lb-figure img { max-height: 70dvh; }
  .lb-info { flex: none; max-height: none; overflow: visible; }
}

/* ── Notion content (gallery notes + documents) ─────── */
.notes { font-size: 15.5px; line-height: 1.6; }
.notes > :first-child { margin-top: 0; }
.notes p { margin: 0 0 .7em; }
.notes h2, .notes h3, .notes h4, .notes h5, .notes h6 { line-height: 1.25; margin: 1.3em 0 .5em; }
.notes h3 { font-size: 18px; font-weight: 700; }
.notes h4 { font-size: 16px; font-weight: 700; }
.notes h5, .notes h6 { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.notes ul, .notes ol { margin: 0 0 .7em; padding-left: 1.25em; }
.notes li { margin: .2em 0; }
.notes li > ul, .notes li > ol { margin: .2em 0 0; }
.notes .todo { list-style: none; padding-left: 0; }
.notes .todo li.done { color: var(--muted); text-decoration: line-through; }
.notes blockquote { margin: 0 0 .7em; padding-left: 14px; border-left: 2px solid var(--line); color: #444; }
.notes hr { border: 0; border-top: 1px solid var(--line); margin: 1.6em 0; }
.notes a { text-underline-offset: 2px; }
.notes code { font: 13px ui-monospace, monospace; background: var(--soft); padding: 1px 4px; }
.notes .callout {
  display: flex;
  gap: 12px;
  margin: 0 0 10px;
  padding: 12px 14px;
  background: var(--soft);
}
.notes .callout-icon { flex: none; line-height: 1.6; }
.notes .callout-body { min-width: 0; flex: 1; }
.notes .callout-body > :last-child { margin-bottom: 0; }
.notes .callout-body h3, .notes .callout-body h4, .notes .callout-body h5 { margin-top: .2em; }
.notes details.toggle-plain > summary { cursor: pointer; font-weight: 500; }

/* ── Document pages ─────────────────────────────────── */
.page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 760px);
  gap: clamp(24px, 5vw, 72px);
  padding: 0 var(--edge) 80px;
}
.page-main .view-bar { padding: 8px 0 20px; }
.page-actions { display: flex; gap: 20px; }
.page-side { position: sticky; top: 76px; align-self: start; max-height: calc(100dvh - 96px); overflow-y: auto; padding-top: 8px; }
.contents > summary {
  list-style: none;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 10px;
  pointer-events: none;
}
.contents > summary::-webkit-details-marker { display: none; }
.toc { list-style: none; margin: 0; padding: 0; font-size: 14px; line-height: 1.35; }
.toc li { margin: 0; }
.toc a { display: block; padding: 4px 0; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--ink); }
.toc .toc-group { margin-top: 14px; }
.toc .toc-group a { color: var(--ink); font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }

.doc > details.toggle { border-top: 1px solid var(--line); }
.doc > details.toggle:last-of-type { border-bottom: 1px solid var(--line); }
.doc > h2 {
  margin: 48px 0 12px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.doc > hr { display: none; }
details.toggle > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  list-style: none;
  cursor: pointer;
}
details.toggle > summary::-webkit-details-marker { display: none; }
details.toggle > summary::after {
  content: "+";
  margin-left: auto;
  font-weight: 400;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
}
details.toggle[open] > summary::after { content: "–"; }
.doc > details.toggle > summary { padding: 16px 0; }
.doc > details.toggle > summary h2 {
  margin: 0;
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .01em;
}
.doc > details.toggle[open] { padding-bottom: 20px; }
.doc > details.toggle:hover > summary h2 { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.doc h3 { font-size: 16px; font-weight: 700; letter-spacing: .02em; margin: 1.2em 0 .5em; }
.doc > [id] { scroll-margin-top: 80px; }

@media (max-width: 860px) {
  .page-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .page-side { position: static; max-height: none; overflow: visible; padding: 0 0 8px; }
  .contents { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
  .contents > summary { pointer-events: auto; cursor: pointer; margin-bottom: 0; }
  .contents[open] > summary { margin-bottom: 8px; }
  .contents > summary::after { content: " +"; color: var(--muted); }
  .contents[open] > summary::after { content: " –"; }
}

/* ── Login ──────────────────────────────────────────── */
.login {
  max-width: 380px;
  margin: 6vh auto 80px;
  padding: 0 var(--edge);
}
.login .view-title { margin-bottom: 12px; }
.login-lede { margin: 0 0 28px; color: #444; }
.button {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
}
.button:hover { background: #000; }
.button-outline { background: var(--bg); color: var(--ink); }
.button-outline:hover { background: var(--soft); }
.button:disabled { opacity: .5; cursor: wait; }
.login-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-form { display: grid; gap: 14px; }
.login-form label {
  display: grid;
  gap: 6px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
}
.login-form input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #ccc;
  border-radius: 0;
  background: var(--bg);
  font: 400 16px Karla, sans-serif;
  letter-spacing: normal;
  text-transform: none;
}
.login-form input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: var(--ink); }
.login-form .text-button { justify-self: start; }
.login-message { min-height: 1.6em; margin: 20px 0 0; }
.login-message.error { color: #a4161a; }
.login-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* ── Sharing ────────────────────────────────────────── */
[data-mode="share"] .site-nav .in-section { display: none; }
.share-banner {
  margin: -8px var(--edge) 20px;
  font-size: 14px;
  color: var(--muted);
}
/* Admin: a small share icon in each photo's corner, and one corner button for
   the whole page. Quiet until hovered. */
.card-share, .page-share {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .15);
}
.card-share svg, .page-share svg { width: 15px; height: 15px; }
.card-share {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  opacity: 0;
  transition: opacity .15s;
}
.card:hover .card-share, .card-share:focus-visible { opacity: 1; }
@media (hover: none) { .card-share { opacity: .85; } }
.page-share-wrap {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
}
.page-share { width: 40px; height: 40px; background: var(--ink); color: #fff; opacity: .55; transition: opacity .15s; }
.page-share:hover, .page-share[aria-expanded="true"] { opacity: 1; }
.page-share-menu {
  position: absolute;
  right: 0;
  bottom: 48px;
  display: grid;
  min-width: 190px;
  padding: 6px 0;
  background: var(--bg);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .2);
}
.page-share-menu[hidden] { display: none; }
.page-share-menu button {
  padding: 10px 16px;
  border: 0;
  background: none;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
}
.page-share-menu button:hover { background: var(--soft); }
.lb-share {
  position: absolute;
  top: 18px;
  left: 20px;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, .5);
  background: none;
  color: #fff;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .16em;
  text-transform: uppercase;
  cursor: pointer;
}
.lb-share:hover { border-color: #fff; }
.share-dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 28px;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.share-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.share-dialog .view-title { margin-bottom: 16px; }
.share-close {
  position: absolute;
  top: 12px;
  right: 14px;
  border: 0;
  background: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.share-form { display: grid; gap: 14px; }
.share-what { margin: 0; font-weight: 500; }
.share-form label { font-size: 14px; color: #444; }
.share-form select {
  margin-left: 6px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 0;
  background: var(--bg);
  font: inherit;
}
.share-url {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 0;
  font: 14px ui-monospace, monospace;
  background: var(--soft);
}
.share-status { margin: 0; font-size: 14px; color: var(--muted); }
.share-list { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.share-list li {
  display: grid;
  gap: 2px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.share-list li.expired { opacity: .55; }
.share-row-title { font-weight: 500; }
.share-row-meta { font-size: 13px; color: var(--muted); }
.share-row-actions { display: flex; gap: 18px; margin-top: 4px; }
.text-button.danger:hover { color: #a4161a; }

/* ── Footer (as ozthorn.co.uk) ──────────────────────── */
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px var(--edge) 40px;
  text-align: center;
}
.social { display: flex; gap: 18px; margin: 0; padding: 0; list-style: none; }
.social a { display: block; color: var(--ink); opacity: .8; }
.social a:hover { opacity: 1; }
.social svg { display: block; width: 16px; height: 16px; }
.footer-info { margin: 0; font-size: 13.2px; }
.footer-logo img { display: block; width: 70px; height: 70px; margin-top: 10px; opacity: .5; }
.footer-logo:hover img { opacity: .8; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
