/* Shared studio colours and typography. */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: #212529; line-height: 1.5; }
img { max-width: 100%; height: auto; }
a { overflow-wrap: anywhere; }
a:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 3px solid #245b89; outline-offset: 3px; }
.parent { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; min-height: 100svh; }
.main-header, .main-footer, .sidebar { background: rgb(196,196,196); }
.main-header { border-bottom: 2px solid black; }
.main-nav, .sidebar { text-align: left; font-size: 1.1rem; }
.main-nav ul { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; list-style: none; margin: 0; padding: .5rem 1rem; width: 100%; }
.main-nav li { min-width: 0; }
.main-nav a, .sidebar a { display: inline-block; min-height: 44px; padding: .6rem .75rem; color: #212529; text-decoration: none; }
.main-nav a:hover, .sidebar a:hover { background: rgba(255,255,255,.3); color: black; }
.sidebar a[aria-current="page"] { font-weight: bold; text-decoration: underline; text-underline-offset: .2em; }
.hatlogo { display: block; width: 50px; height: auto; }
.main-footer { border-top: 2px solid black; padding: .7rem max(.7rem, env(safe-area-inset-right)) max(.7rem, env(safe-area-inset-bottom)) max(.7rem, env(safe-area-inset-left)); overflow-wrap: anywhere; }
.contents-area { min-width: 0; background: rgb(240,242,248); text-align: center; }
h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 2.5vw, 2rem); }
h1, h2, p { overflow-wrap: anywhere; }
.container-homepage, .container-about { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; padding: clamp(.5rem, 2vw, 2rem); }
.homepage-box { display: flex; justify-content: center; align-items: center; flex: 1 1 360px; min-width: 0; padding: 1.2rem; }
.open-img { width: 400px; max-width: 100%; border: 1px solid #1f1f1f; }
.container-photo { display: grid; grid-template-columns: minmax(240px, max-content) minmax(0, 1fr); min-height: 100%; }
.sidebar { max-width: 35vw; min-width: 0; padding: 1rem 1rem 2rem 0; border-right: 2px solid black; overflow-wrap: anywhere; }
.sidebar ul { padding-left: 1.5rem; margin: 0; }
.sidebar details > summary { display: none; }
.bodyarea { container-type: inline-size; min-width: 0; padding: 1rem 0 2rem; }
.bodyarea > h1:first-child { margin-top: 0; }
.bodyarea > h1, .bodyarea > h2, .bodyarea > p { padding-inline: 1rem; }
.gallery-description { white-space: pre-line; }
.scroll-container { display: flex; align-items: flex-start; gap: 3rem; width: 100%; max-width: none; overflow-x: auto; padding: 1.25rem; scroll-snap-type: x proximity; }
.scroll-item { flex: 0 0 auto; width: min-content; max-width: 100%; margin: 0; scroll-snap-align: center; }
.scroll-item figcaption { font-style: italic; width: 0; min-width: 100%; padding-top: 1.25rem; text-align: left; font-size: .95rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; color: #444; }
.scroll-item img { display: block; flex: 0 0 auto; width: auto; max-width: min(600px, calc(100cqw - 40px)); max-height: 600px; height: auto; margin: 0; border: 1px solid black; scroll-snap-align: center; }
.gallery-grid { flex-wrap: wrap; }
.gallery-grid img { max-width: 60px; max-height: 60px; }
.scroll-container > p { white-space: normal; margin: 0; }
.scroll-container::-webkit-scrollbar { height: 10px; }
.scroll-container::-webkit-scrollbar-thumb { background: #777; border-radius: 10px; }
.container-about { align-items: flex-start; }
.about-box { flex: 1 1 360px; min-width: 0; max-width: 800px; padding: clamp(1rem, 3vw, 2.2rem); text-align: left; font-size: 1.2rem; }
.about-box h1 { font-size: 1.4em; font-weight: bold; }
.about-box h2 { font-size: 1.2em; font-style: italic; }
.about-img { width: 600px; max-width: 100%; border: 1px solid #1f1f1f; padding: 1rem; }
@media (max-width: 700px) {
  .main-nav ul { padding: .5rem; gap: 0; }
  .main-nav .nav-link { padding: .6rem; }
  .container-photo { grid-template-columns: minmax(0, 1fr); }
  .sidebar { max-width: none; padding: .5rem 1rem; border-right: 0; border-bottom: 2px solid black; }
  .sidebar details > summary { display: list-item; cursor: pointer; min-height: 44px; padding: .6rem 0; }
  .sidebar details:not([open]) > ul { display: none; }
  .sidebar details[open] > ul { padding-bottom: 1rem; }
  .scroll-container { padding: 1rem; }
  .homepage-box { padding: .75rem; }
}
@media (min-width: 701px) {
  .sidebar details:not([open]) > ul { display: block; }
}

/* Lift photographs gently from the page, with light from the upper left. */
.open-img, .about-img, .scroll-item img {
  box-shadow: 7px 9px 10px rgba(0, 0, 0, .28);
}

/* Keep keyboard scrolling without outlining the photograph collection. */
.scroll-container:focus, .scroll-container:focus-visible {
  outline: none;
}

.gallery-cover { display: block; width: max-content; max-width: 100%; }
.empty-cover { display: block; width: 240px; max-width: calc(100cqw - 40px); padding: 3rem 1rem; border: 1px solid #777; }

/* Reserve space for the complete footer as the browser window changes size.
   Long pages scroll inside the main area, leaving both banners visible. */
@media (min-width: 701px) and (min-height: 500px) {
  .parent {
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  .contents-area {
    min-height: 0;
    overflow-y: auto;
  }
  .main-footer { min-width: 0; }
}

.contact-panel { margin-top: 2rem; font-size: 1rem; }
.contact-panel label { display: block; margin: 1rem 0 .35rem; font-weight: bold; }
.contact-panel input, .contact-panel textarea { width: 100%; min-width: 0; padding: .7rem; border: 1px solid #777; border-radius: 3px; background: #fff; color: #212529; font: inherit; }
.contact-panel textarea { resize: vertical; }
.contact-panel button { padding: .75rem 1.25rem; min-height: 44px; border: 1px solid #333; background: #333; color: white; border-radius: 3px; font: inherit; }
.contact-panel :is(input, textarea, button):focus-visible { outline: 3px solid #245b89; outline-offset: 3px; }
.contact-notice { padding: .75rem; border-left: 3px solid #777; background: #e4e6eb; }
.contact-hint { font-size: .9rem; }
.contact-errors { color: #9c2020; }
.contact-errors.validation-summary-valid { display: none; }
.contact-trap { display: none; }

/* Folder names navigate; separate arrow buttons expand their child branches. */
.sidebar .folder-expandable { list-style: none; position: relative; }
.folder-toggle { position: absolute; top: 0; left: -1.5rem; width: 1.5rem; min-height: 44px; padding: .6rem 0; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.folder-toggle:hover { background: rgba(255,255,255,.3); }
.folder-toggle:focus-visible { outline: 3px solid #245b89; outline-offset: 1px; }
.sidebar ul[hidden] { display: none !important; }

/* Keep original photo sizing and let each pane scroll within the window. */
@media (min-width: 701px) and (min-height: 500px) {
  .container-photo { height: 100%; min-height: 0; width: 100%; }
  .container-photo > .sidebar { overflow-y: auto; }
  .bodyarea { min-height: 0; overflow-y: auto; padding-bottom: 1rem; }
}
.scroll-container { overflow-x: scroll; }
.scroll-container::-webkit-scrollbar-track { background: #ddd; }

.photo-view-link {
  display: block;
  cursor: zoom-in;
}

.photo-view {
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #181818;
}

.photo-view::backdrop {
  background: rgb(0 0 0 / 88%);
}

.photo-view img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100dvw - 2rem);
  max-height: calc(100dvh - 6rem);
  object-fit: contain;
}

.photo-view form button {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid #fff;
  border-radius: 50%;
  background: #181818;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

.photo-view-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .25rem .5rem;
  color: #fff;
}

.photo-view-controls button {
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid currentColor;
  border-radius: .25rem;
  background: #181818;
  color: inherit;
  font-size: 1.25rem;
}

.photo-view-controls button:disabled {
  opacity: .4;
}
