/*
Theme Name: Slant
Description: A black-and-white photography theme. A slanted line splits the screen; clicking a menu item flips the colours, so photos sit on black with the narrow side turning white. Includes a Carousel, Gallery and About page template.
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: slant
*/

:root {
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --pad: clamp(1.25rem, 3.2vw, 2.75rem);
  --slant: 12vw;                                   /* how far the line leans (desktop) */
  --slant-m: 7vw;                                  /* ... on phones */
  --strip-w: calc(100vw / 6 + var(--slant) / 2);   /* the line sits 1/6 from the right at mid-height */
  --strip-h: calc(100vh / 8 + var(--slant-m) / 2);
  --ease: cubic-bezier(.65, 0, .25, 1);
}
@supports (height: 100svh) { :root { --strip-h: calc(100svh / 8 + var(--slant-m) / 2); } }

html[data-theme="light"] { --main-bg: #fff; --main-fg: #000; --strip-bg: #000; --muted: #666; --line: #d9d9d9; color-scheme: light; }
html[data-theme="dark"]  { --main-bg: #000; --main-fg: #fff; --strip-bg: #fff; --muted: #9b9b97; --line: #262626; color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--main-bg); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--main-bg); color: var(--main-fg); font: 400 1rem/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.screen-reader-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; padding: .6rem 1rem; background: var(--main-fg); color: var(--main-bg); }
.skip-link:focus { left: 0; }

/* ---------- The slanted strip ---------- */
.stage-strip {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: var(--strip-w);
  background: var(--strip-bg);
  clip-path: polygon(var(--slant) 0, 100% 0, 100% 100%, 0 100%);
  transition: width .6s var(--ease);
  pointer-events: none;
}
.is-covering .stage-strip { width: calc(100vw + var(--slant)); }   /* step 1 of the flip: the strip sweeps across */
.is-arriving .stage-strip { width: 0; }                            /* step 2 happens on the next page: new strip slides in */

/* ---------- Layout ---------- */
.site {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-right: calc(var(--strip-w) + var(--pad));
  transition: opacity .5s .2s;
}
@supports (height: 100svh) { .site { min-height: 100svh; } }
.is-arriving .site { opacity: 0; }
.site main { flex: 1 0 auto; transition: opacity .22s; }
.is-fading-out .site main, .is-fading-in .site main { opacity: 0; }

/* ---------- Header & menu ---------- */
.site-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; padding: 1.4rem 0 1.4rem var(--pad); }
.site-title { font-weight: 500; font-size: 1.05rem; letter-spacing: .01em; text-decoration: none; }
.custom-logo { display: block; max-height: 2.6rem; width: auto; }
.site-nav .menu { display: flex; flex-wrap: wrap; gap: .25rem clamp(1.25rem, 2.5vw, 2.25rem); list-style: none; margin: 0; padding: 0; }
.site-nav a { display: inline-block; padding: .35rem 0; color: var(--muted); font-size: .95rem; text-decoration: none; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav .current_page_item > a { color: var(--main-fg); border-bottom-color: currentColor; }

/* First view: your site title in large type, the menu smaller (about 2/5 of the title) beneath it */
.slant-home .site-header { flex: 1; flex-direction: column; flex-wrap: nowrap; align-items: flex-start; justify-content: flex-start; padding-bottom: var(--pad); }
.slant-home .site-title { display: block; font-size: clamp(2.1rem, 6vw, 5.2rem); font-weight: 300; letter-spacing: -.035em; line-height: 1.05; text-wrap: balance; }
.slant-home .site-nav { margin-top: clamp(2rem, 5vw, 4rem); }
.slant-home .site-nav .menu { flex-direction: column; gap: .2em; }
.slant-home .site-nav a { display: block; padding: 0; border: 0; color: var(--main-fg); font-size: clamp(1.25rem, 3vw, 2.6rem); font-weight: 300; letter-spacing: -.025em; line-height: 1.15; transition: opacity .25s; }
.slant-home .site-nav .menu:hover a { opacity: .28; }
.slant-home .site-nav .menu a:hover { opacity: 1; }

/* Inner pages: no visible site title. The menu sits top right; the page title takes the title's place */
body:not(.slant-home) .brand { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
body:not(.slant-home) .brand:focus-within { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
@media (min-width: 721px) {
  body:not(.slant-home) .site-header { position: absolute; z-index: 5; top: calc(1.4rem + .55rem); left: var(--pad); right: calc(var(--strip-w) + var(--pad)); padding: 0; justify-content: flex-end; pointer-events: none; }
  body:not(.slant-home) .site-nav { pointer-events: auto; }
  body:not(.slant-home) .page-title { max-width: calc(100% - 18rem); }
}

/* The page you are on is already shown as the big title, so it is left out of the small menu */
body:not(.slant-home) .site-nav .current-menu-item,
body:not(.slant-home) .site-nav .current_page_item { display: none; }

/* The "<" back arrow: as tall as the page title's capital letters */
.back-link { display: inline-block; margin-right: .3em; color: inherit; text-decoration: none; transition: opacity .2s, transform .25s; }
.back-link svg { display: block; width: .36em; height: .72em; overflow: visible; }
.back-link:hover { opacity: .6; transform: translateX(-.06em); }

/* ---------- Text pages ---------- */
.page { padding: 1.4rem 0 5rem var(--pad); }
.page-title { margin: 0 0 clamp(1.5rem, 4vw, 3rem); font-weight: 300; font-size: clamp(2.1rem, 6vw, 5.2rem); line-height: 1.05; letter-spacing: -.035em; text-wrap: balance; }
.entry { max-width: 40rem; font-family: var(--serif); font-size: 1.15rem; line-height: 1.75; }
.entry > * + * { margin-top: 1.1em; }
.entry > :first-child { margin-top: 0; }
.entry a { text-decoration-thickness: 1px; text-underline-offset: .2em; }
.entry h2, .entry h3 { margin-top: 2em; font-family: var(--sans); font-weight: 500; line-height: 1.25; }
.entry blockquote { margin-left: 0; padding-left: 1.25rem; border-left: 1px solid var(--line); color: var(--muted); }
.entry figure { margin: 2em 0; }
.entry figcaption { margin-top: .5rem; font: .85rem/1.4 var(--sans); color: var(--muted); }
.post-meta { margin: -.75rem 0 1.5rem; color: var(--muted); font-size: .9rem; }

.about-body { display: grid; gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.about-body.has-photo { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.about-photo { position: sticky; top: 2rem; margin: 0; }
.about-photo img { display: block; width: 100%; }
@media (max-width: 900px) { .about-body.has-photo { grid-template-columns: 1fr; } .about-photo { position: static; } }

.post-list { max-width: 40rem; margin: 0; padding: 0; list-style: none; }
.post-list li { padding: 1.25rem 0; border-top: 1px solid var(--line); }
.post-list h2 { margin: 0 0 .25rem; font-weight: 400; font-size: 1.4rem; }
.post-list a { text-decoration: none; }

/* ---------- Gallery pages ---------- */
.page-head { margin-bottom: clamp(1.5rem, 4vw, 3rem); }
.page-head .page-title { margin-bottom: 1rem; }
.g-grid { --row: 14rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.g-grid::after { content: ""; flex-grow: 1000000; }
.g-item { position: relative; display: block; overflow: hidden; background: #161616; }
.g-item::before { content: ""; display: block; padding-bottom: var(--r); }
.g-item img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; transition: opacity .25s; }
.g-item:hover img { opacity: .8; }
@media (max-width: 600px) { .g-grid { --row: 8.5rem; gap: .35rem; } }

/* ---------- Carousel page ---------- */
.slant-carousel .site { height: 100vh; min-height: 0; overflow: hidden; }
@supports (height: 100svh) { .slant-carousel .site { height: calc(100svh - var(--wp-admin--admin-bar--height, 0px)); } }
.carousel-page { display: flex; flex-direction: column; flex: 1 1 0; min-height: 0; padding-bottom: var(--pad); }
.carousel-page .page-title { flex: 0 0 auto; }
.car-stage { position: relative; flex: 1 1 0; min-height: 0; }
.carousel { position: absolute; top: 0; left: 0; width: calc(var(--car-scale, .85) * 100%); height: calc(var(--car-scale, .85) * 100%); overflow: hidden; background: #000; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.slide { position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden; transition: opacity .9s ease, visibility 0s .9s; }
.slide.is-current { opacity: 1; visibility: visible; transition: opacity .9s ease; }
.slide img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; }
.carousel[data-fit="cover"] .slide img { object-fit: cover; }

.car-nav { position: absolute; top: 0; bottom: 0; z-index: 3; display: flex; align-items: center; width: 16%; min-width: 4rem; padding: 0 1rem; border: 0; background: none; color: #fff; opacity: 0; cursor: pointer; transition: opacity .35s; -webkit-tap-highlight-color: transparent; }
.car-prev { left: 0; justify-content: flex-start; }
.car-next { right: 0; justify-content: flex-end; }
.car-nav svg { width: 2.25rem; height: 2.25rem; filter: drop-shadow(0 1px 6px rgba(0, 0, 0, .7)); }
.ui-on .car-nav { opacity: .7; }
.ui-on .car-nav:hover, .car-nav:focus-visible { opacity: 1; }
.carousel.is-single .car-nav { display: none; }

.car-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding: 2.75rem 1rem .9rem 1.25rem; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); color: #fff; opacity: 0; transition: opacity .4s; pointer-events: none; }
.ui-on .car-bar, .car-bar:focus-within { opacity: 1; pointer-events: auto; }
.car-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.25rem; margin: 0 0 .6rem; font-size: .9rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.car-count { font-variant-numeric: tabular-nums; }
.car-caption { color: #c9c9c6; }
.car-tools { display: flex; gap: .25rem; }
.car-btn { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: none; color: #fff; cursor: pointer; transition: background .2s; }
.car-btn:hover { background: rgba(255, 255, 255, .16); }
.car-btn svg { width: 1.35rem; height: 1.35rem; }
.car-play .i-pause, .car-full .i-exit { display: none; }
.is-playing .car-play .i-pause { display: block; }
.is-playing .car-play .i-play { display: none; }
.is-fullscreen .car-full .i-exit { display: block; }
.is-fullscreen .car-full .i-enter { display: none; }
.car-progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; height: 2px; pointer-events: none; }
.car-progress span { display: block; height: 100%; background: rgba(255, 255, 255, .75); transform: scaleX(0); transform-origin: left; }
.car-progress.run span { animation: car-progress var(--delay, 6000ms) linear forwards; }
@keyframes car-progress { to { transform: scaleX(1); } }
.carousel-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; color: var(--muted); text-align: center; }
.carousel-empty p { max-width: 34rem; margin: 0; font-family: var(--serif); font-size: 1.15rem; }

/* ---------- Lightbox ---------- */
body.lb-open { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .97); color: #fff; touch-action: pan-y; }
.lb-img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; transition: opacity .25s; }
.lb-img.is-loading { opacity: 0; }
.lb-btn { position: absolute; display: grid; place-items: center; width: 3rem; height: 3rem; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .35); color: #fff; cursor: pointer; transition: background .2s; }
.lb-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-btn svg { width: 1.5rem; height: 1.5rem; }
.lb-close { top: .75rem; right: .75rem; }
.lb-prev { left: .75rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: .75rem; top: 50%; transform: translateY(-50%); }
.lb-meta { position: absolute; left: var(--pad); right: var(--pad); bottom: 1rem; display: flex; gap: 1.25rem; margin: 0; font-size: .9rem; text-shadow: 0 1px 6px rgba(0, 0, 0, .8); pointer-events: none; }
.lb-caption { color: #c9c9c6; }

/* ---------- Footer ---------- */
.site-footer { padding: 2rem 0 2rem var(--pad); color: var(--muted); font-size: .85rem; }
.site-footer p { margin: 0; }

/* ---------- Phones: the strip becomes a band along the bottom ---------- */
@media (max-width: 720px) {
  :root { --strip-w: 0px; }
  .stage-strip { top: auto; left: 0; width: auto; height: var(--strip-h); clip-path: polygon(0 var(--slant-m), 100% 0, 100% 100%, 0 100%); transition: height .6s var(--ease); }
  .is-covering .stage-strip { width: auto; height: calc(100vh + var(--slant-m)); }
  .is-arriving .stage-strip { width: auto; height: 0; }
  .site { padding-right: var(--pad); padding-bottom: var(--strip-h); }
  body:not(.slant-home) .site-header { padding: 1.4rem 0 0 var(--pad); }
  .page { padding-top: 1rem; }
  .slant-carousel .site { padding-bottom: var(--strip-h); }
}
@supports (height: 100svh) { @media (max-width: 720px) { .is-covering .stage-strip { height: calc(100svh + var(--slant-m)); } } }

@media (prefers-reduced-motion: reduce) {
  .stage-strip, .site, .site main, .slide, .slide.is-current, .car-nav, .car-bar, .lb-img { transition-duration: .01ms !important; transition-delay: 0s !important; }
}
