/*
Theme Name: SIMproductions Editorial
Theme URI: https://www.sim-productions.com/
Description: Minimal editorial portfolio theme for SIMproductions. One large image per screen, fixed side navigation, crop-mark frames. Uses the "portfolio" post type and "portfolio-categories" taxonomy (minimalio-portfolio plugin) and registers a fallback if the plugin is off.
Version: 1.0.3
Requires at least: 6.3
Requires PHP: 8.0
Tested up to: 6.9
License: GPL-2.0-or-later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: simp
*/

:root {
  --bg: #eff3f3;
  --ink: #141617;
  --muted: #8b9294;
  --line: #141617;
  --rail: 330px;                  /* left rail kept free for the fixed brand + nav */
  --col: min(60vw, 900px, calc(100vw - var(--rail) - 100px));   /* image column */
  --col-left: max(calc(50% - var(--col) / 2 + 60px), var(--rail));
  --label: "Economica", "Arial Narrow", sans-serif;
  --display: "Saira Extra Condensed", "Economica", sans-serif;
  --text: "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 11px/1.9 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--ink); color: var(--bg); }

.label {
  font-family: var(--label);
  font-size: 13px;
  letter-spacing: .1em;
  text-transform: uppercase;
}

/* ---------- fixed chrome ---------- */

.about-toggle {
  position: fixed; top: 22px; left: 32px; z-index: 60;
  display: inline-flex; align-items: center; gap: 10px;
  background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink);
}
.about-toggle svg { width: 10px; transition: transform .4s var(--ease); }
body.about-open .about-toggle svg { transform: rotate(180deg); }

.brand {
  position: fixed; z-index: 40;
  top: 15vh; left: 32px;            /* sits in the left rail, never over the images */
  color: var(--ink);
  pointer-events: none;
}
.brand a { pointer-events: auto; }
.brand .mark { width: 46px; height: 46px; margin-bottom: 26px; }
.brand .name {
  display: block;
  font-family: var(--display); font-weight: 300;
  font-size: 27px; letter-spacing: .3em; line-height: 1; text-transform: uppercase;
}
.brand .sub {
  margin-top: 18px;
  font-family: var(--label); font-size: 9.5px; letter-spacing: .16em; line-height: 1.6;
  text-transform: uppercase;
}

.side-nav {
  position: fixed; left: 32px; bottom: 30px; z-index: 50;
  display: flex; flex-direction: column; gap: 9px;
}
.side-nav a { position: relative; width: fit-content; }
.side-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 2px; height: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform .4s var(--ease);
}
.side-nav a:hover::after, .side-nav a.is-active::after { transform: scaleX(1); }
.side-nav .gap { height: 14px; }

.pager {
  position: fixed; right: 32px; bottom: 30px; z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 22px;
}
.pager button {
  background: none; border: 0; padding: 4px; cursor: pointer; color: var(--ink);
  transition: transform .3s var(--ease), opacity .3s;
}
.pager button:hover { transform: translateY(-2px); }
.pager button.next:hover { transform: translateY(2px); }
.pager button:disabled { opacity: .25; cursor: default; transform: none; }
.pager svg { width: 16px; display: block; }

/* ---------- about panel ---------- */

.about-panel {
  position: fixed; inset: 0 0 auto 0; z-index: 55;
  background: #fff;
  transform: translateY(-101%);
  transition: transform .7s var(--ease);
  max-height: 100vh; overflow: auto;
}
body.about-open .about-panel { transform: none; box-shadow: 0 0 60px rgba(0,0,0,.06); }
.about-panel .inner {
  display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 48px;
  width: var(--col); margin: 0 0 0 var(--col-left);
  padding: 92px 0 64px;
}
.about-panel h2 { margin: 0 0 14px; font-weight: 400; font-size: 13px; }
.about-panel p { margin: 0 0 10px; max-width: 34ch; }
.about-panel ul { list-style: none; margin: 0; padding: 0; }
.about-panel .more { display: inline-block; margin-top: 16px; border-bottom: 1px solid; }

/* ---------- feed ---------- */

main.feed {
  width: var(--col);
  margin-left: var(--col-left);
  padding: 14vh 0 26vh;
}

.entry { padding-bottom: 22vh; }
.entry[hidden] { display: none; }
.entry .meta {
  text-align: right; margin-bottom: 18px; line-height: 1.55;
}
.entry .meta::before {
  content: ""; display: block; width: 18px; height: 1px;
  background: var(--line); margin: 0 0 9px auto;
}
.entry h2 { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: .02em; }
.entry .cat, .entry .year {
  font-family: var(--label); font-size: 11px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
/* crop-mark frame: only the four corners are drawn, just outside the picture */
.entry .media, .prose .wp-block-image {
  display: block; position: relative;
  --mark: rgba(20, 22, 23, .7); --len: 18px; --gap: 10px;
}
.entry .media::before, .entry .media::after,
.prose .wp-block-image::before, .prose .wp-block-image::after {
  content: ""; position: absolute; inset: calc(var(--gap) * -1); pointer-events: none;
  transition: inset .6s var(--ease);
}
.entry .media::before, .prose .wp-block-image::before { background:
  linear-gradient(var(--mark), var(--mark)) top left / var(--len) 1px no-repeat,
  linear-gradient(var(--mark), var(--mark)) top left / 1px var(--len) no-repeat,
  linear-gradient(var(--mark), var(--mark)) top right / var(--len) 1px no-repeat,
  linear-gradient(var(--mark), var(--mark)) top right / 1px var(--len) no-repeat; }
.entry .media::after, .prose .wp-block-image::after { background:
  linear-gradient(var(--mark), var(--mark)) bottom left / var(--len) 1px no-repeat,
  linear-gradient(var(--mark), var(--mark)) bottom left / 1px var(--len) no-repeat,
  linear-gradient(var(--mark), var(--mark)) bottom right / var(--len) 1px no-repeat,
  linear-gradient(var(--mark), var(--mark)) bottom right / 1px var(--len) no-repeat; }
.entry .media img {
  width: 100%; height: auto; background: #e3e8e8;
}
/* on hover the corners open out a little */
.entry a.media:hover::before, .entry a.media:hover::after { inset: calc(var(--gap) * -1.6); }

.entry .credits { margin-top: 24px; color: #3a3f41; font-size: 10.5px; }
.entry .credits p { margin: 0; }
.entry .credits a { border-bottom: 1px solid rgba(0,0,0,.35); }
.entry .credits a:hover { border-color: currentColor; }

.embed { position: relative; width: 100%; background: #e3e8e8; }
.embed iframe { display: block; width: 100%; border: 0; }
.embed.video { aspect-ratio: 16 / 9; }
.embed.video iframe { position: absolute; inset: 0; height: 100%; }

/* reveal on scroll — like the reference, items fade up as they arrive */
.js .reveal { opacity: 0; transform: translateY(28px); transition: opacity 1.1s var(--ease), transform 1.1s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

.page-head { margin-bottom: 16vh; text-align: right; }
.page-head h1 {
  margin: 0; font-family: var(--display); font-weight: 300;
  font-size: clamp(30px, 4.4vw, 60px); letter-spacing: .2em; line-height: 1.1; text-transform: uppercase;
  overflow-wrap: anywhere;
}
.page-head p { margin: 14px 0 0 auto; max-width: 42ch; color: #3a3f41; }


.muted { color: var(--muted); }
.screen-reader-text {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px); white-space: nowrap;
}
.skip-link {
  position: fixed; top: -60px; left: 32px; z-index: 100; background: var(--ink); color: var(--bg);
  padding: 8px 14px; transition: top .2s;
}
.skip-link:focus { top: 12px; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.about-panel .contact p { margin: 0 0 6px; }
.about-panel a:not(.more) { border-bottom: 1px solid rgba(0,0,0,.3); }
.empty { color: var(--muted); }

/* ---------- page + project content (Gutenberg blocks) ---------- */

.prose { font-size: 12px; line-height: 1.9; }
.prose > * { margin-top: 0; margin-bottom: 28px; }
.prose p { max-width: 62ch; }
.prose a { border-bottom: 1px solid rgba(0,0,0,.35); }
.prose a:hover { border-color: currentColor; }
.prose h2, .prose h3, .prose h4,
.prose .has-x-large-font-size, .prose .has-large-font-size, .prose .has-xx-large-font-size {
  font-family: var(--display); font-weight: 300; letter-spacing: .16em; text-transform: uppercase;
  line-height: 1.2; max-width: none; margin-top: 10vh;
}
.prose h2, .prose .has-x-large-font-size, .prose .has-xx-large-font-size { font-size: 28px !important; }
.prose h3, .prose .has-large-font-size { font-size: 20px !important; }
.prose h4 { font-size: 15px; }
.prose > :first-child { margin-top: 0; }
.prose .has-text-align-center { text-align: right; }   /* align headings with the feed meta */
.prose ul, .prose ol { padding-left: 1.2em; }
.prose ul.wp-block-list { list-style: none; padding: 0; }
.prose strong { font-weight: 700; }
.prose .wp-block-spacer { max-height: 8vh; }
.prose .wp-block-columns { display: flex; flex-wrap: nowrap; gap: 40px; align-items: flex-start; }
.prose .wp-block-column { flex: 1 1 0; min-width: 0; }
.prose .wp-block-column > :last-child { margin-bottom: 0; }
.prose .wp-block-group { margin-bottom: 28px; }
.prose figcaption, .prose .wp-element-caption {
  margin-top: 16px; font-size: 10.5px; color: var(--muted); text-align: left;
}
.prose .wp-element-caption:empty { display: none; }
.prose .alignwide, .prose .alignfull { width: 100%; max-width: 100%; margin-left: 0; margin-right: 0; }

.prose .wp-block-image { margin: 0 0 48px; }
.prose .wp-block-image img { width: 100%; height: auto; background: #e3e8e8; }
.prose .wp-block-image a { border: 0; }

/* galleries (core + the Minimalio gallery block): two calm columns with crop marks */
.prose .wp-block-gallery,
.prose .wp-block-minimalio-blocks-minimalio-gallery {
  display: block; columns: 2 300px; column-gap: 48px; margin-bottom: 48px;
}
.prose .wp-block-gallery .wp-block-image,
.prose .wp-block-minimalio-blocks-minimalio-gallery .wp-block-image {
  break-inside: avoid; display: block; width: 100% !important; margin: 10px 0 48px;
}

/* embeds */
.prose .wp-block-embed { margin: 0 0 48px; }
.prose iframe { max-width: 100%; border: 0; display: block; }
.prose .wp-block-embed.is-type-video .wp-block-embed__wrapper { position: relative; aspect-ratio: 16 / 9; }
.prose .wp-block-embed.is-type-video .wp-block-embed__wrapper::before { display: none; }
.prose .wp-block-embed.is-type-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* buttons */
.prose .wp-block-button__link, .prose .wp-element-button {
  display: inline-block; background: none !important; color: var(--ink) !important;
  border: 1px solid var(--ink); border-radius: 0 !important; padding: 8px 18px;
  font-family: var(--label); font-size: 13px; letter-spacing: .1em; text-transform: uppercase;
  transition: background .3s, color .3s;
}
.prose .wp-block-button__link:hover { background: var(--ink) !important; color: var(--bg) !important; }

/* click-to-load placeholder for YouTube / SoundCloud / Spotify / Vimeo */
.consent-embed {
  position: relative; width: 100%; min-height: 200px;
  display: grid; place-items: center; background: #e3e8e8;
}
.is-type-video .consent-embed, .consent-embed[data-provider="youtube"], .consent-embed[data-provider="vimeo"] {
  position: absolute; inset: 0; min-height: 0;
}
.consent-embed__btn {
  display: grid; gap: 6px; justify-items: center; max-width: 36ch; padding: 18px;
  background: none; border: 0; cursor: pointer; color: var(--ink); text-align: center;
}
.consent-embed__btn .label { border: 1px solid var(--ink); padding: 8px 18px; transition: background .3s, color .3s; }
.consent-embed__btn:hover .label { background: var(--ink); color: var(--bg); }
.consent-embed__note { font-size: 10px; color: var(--muted); }
.consent-embed.loaded { background: none; display: block; min-height: 0 !important; }
.consent-embed.loaded iframe { width: 100%; }
.is-type-video .consent-embed.loaded iframe { position: absolute; inset: 0; height: 100%; }

/* single project */
.single .hero { padding-bottom: 10vh; }
.project-nav {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: center;
  margin-top: 14vh; padding-top: 18px; border-top: 1px solid rgba(0,0,0,.12);
}
.project-nav > :last-child { text-align: right; }
.pagination .nav-links { display: flex; gap: 18px; }

main > .foot {
  margin-top: 8vh; padding-top: 18px; border-top: 1px solid rgba(0,0,0,.12);
  display: flex; justify-content: space-between; color: var(--muted);
}

/* ---------- small screens ---------- */

@media (max-width: 860px) {
  :root { --col: calc(100vw - 32px); --col-left: 16px; }
  .brand { position: absolute; top: 64px; left: 16px; }
  .brand .mark { width: 36px; height: 36px; margin-bottom: 16px; }
  .brand .name { font-size: 22px; }
  .about-toggle { position: absolute; top: 18px; left: 16px; }
  .side-nav {
    position: sticky; top: 0; left: auto; bottom: auto;
    flex-direction: row; gap: 18px; overflow-x: auto; white-space: nowrap;
    padding: 14px 16px; margin-top: 196px;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(8px);
    scrollbar-width: none;
  }
  .side-nav::-webkit-scrollbar { display: none; }
  .side-nav .gap { width: 1px; height: auto; background: rgba(0,0,0,.2); }
  .pager { display: none; }
  main.feed { padding-top: 40px; }
  .entry { padding-bottom: 12vh; }
  .page-head { margin-bottom: 8vh; text-align: left; }
  .page-head p { margin-left: 0; }
  .about-panel .inner { grid-template-columns: 1fr; gap: 28px; padding: 72px 0 40px; }
  .prose .has-text-align-center { text-align: left; }
  .prose .wp-block-columns { flex-direction: column; gap: 0; }
  .prose .wp-block-column { flex-basis: auto; width: 100%; }
  .project-nav { grid-template-columns: 1fr; text-align: center; }
  .project-nav > :last-child { text-align: center; }
  .skip-link { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .about-panel { transition: none; }
}

/* logged-in admin bar */
.admin-bar .about-toggle { top: 54px; }
.admin-bar .about-panel { top: 32px; }
@media (max-width: 860px) {
  .admin-bar .about-toggle { top: 64px; }
  .admin-bar .brand { top: 110px; }
}
@media (max-width: 782px) { .admin-bar .about-panel { top: 46px; } }
