/*
Theme Name: Pål Rees
Description: A quiet, minimalist portfolio theme for Pål Rees. Current projects on the front page, an archive list and an info page.
Version: 4.4
Requires at least: 6.0
Requires PHP: 7.4
License: GNU General Public License v2 or later
Text Domain: paal-rees
*/

/* ---------- Fonts (self-hosted, no external requests) ---------- */

@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("assets/fonts/inter-latin-ext-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #e6f3e0;
  --ink: #1c1c1a;
  --muted: #8a8780;
  --rule: #cadfc6;
  /* One font everywhere: Inter. ("--serif" is kept as the name for titles.) */
  --serif: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --side: 240px;
  --column: 820px;
  --thumb: 560px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; height: auto; }

.screen-reader-text {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Side column ---------- */

.side {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--side);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
}
.admin-bar .side { top: 32px; }

.name {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.nav ul { margin-top: 56px; list-style: none; }
.nav li { margin-bottom: 6px; }
.nav a { color: var(--muted); transition: color .2s; }
.nav a:hover,
.nav .current-menu-item > a,
.nav a[aria-current="page"] { color: var(--ink); }

.nav .plus { font-size: 18px; line-height: 1; }

.side-foot { margin-top: auto; color: var(--muted); font-size: 12px; }

/* ---------- Main column ---------- */

.main {
  margin-left: var(--side);
  padding: 48px 56px 96px 40px;
}

.label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 32px;
}

/* Current projects: one per row, image with text beside it */
.stack {
  display: flex;
  flex-direction: column;
  gap: 56px;
  max-width: 760px;
}

.work {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 32px;
  align-items: end;
}
.work-text { display: block; padding-bottom: 2px; }
.work .frame { display: block; overflow: hidden; background: var(--rule); }
.work .frame img { width: 100%; transition: transform .8s ease, opacity .4s; }
.work a.frame:hover img, .work:has(.work-text:hover) a.frame img { transform: scale(1.012); opacity: .92; }
.work .frame .media-item { margin: 0; }
.work h2 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 4px;
  transition: opacity .2s;
}
.work-text:hover h2 { opacity: .6; }
.work p { color: var(--muted); font-size: 13px; }

.empty { color: var(--muted); max-width: 480px; }

/* ---------- Videos (click to play) ---------- */

.video-facade {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #2a2a28;
  cursor: pointer;
  overflow: hidden;
}
.video-facade img { width: 100%; height: auto; transition: opacity .4s, transform .8s ease; }
.media-item.video:not(.custom-cover) .video-facade { aspect-ratio: 16 / 9; }
.media-item.video:not(.custom-cover) .video-facade img { height: 100%; object-fit: cover; }
.video-blank { display: block; aspect-ratio: 16 / 9; background: #2a2a28; }
.video-facade .play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s ease;
}
.video-facade:hover img { opacity: .88; transform: scale(1.012); }
.video-facade:hover .play { transform: scale(1.06); }
.video-facade:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Music links ---------- */

.listen a { border: 0 !important; color: var(--ink); transition: opacity .2s; }
.listen a:hover { opacity: .6; }
.listen-icon { display: inline-block; width: 1.2em; color: var(--muted); }

/* ---------- Project page ---------- */

.project {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 560px);
  gap: 56px;
  align-items: start;
}
.project-text h1 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.meta { color: var(--muted); margin-top: 8px; display: flex; flex-wrap: wrap; column-gap: 1.5em; }
.project-text .entry { margin-top: 28px; }
.project-text .entry > p, .project-text .entry > ul { max-width: none; }
/* Headings in the text column (e.g. "Credits") become small labels */
.project-text .entry h2, .project-text .entry h3, .project-text .entry h4 {
  font-family: var(--sans); font-size: 12px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); margin: 32px 0 8px; line-height: 1.6;
}
.project-text .entry h2 ~ p, .project-text .entry h3 ~ p { font-size: 13px; }
.project-text .entry h2 + *, .project-text .entry h3 + * { margin-top: 0; }
.project-text .listen { margin-top: 24px; }
.project-text .wp-block-embed { margin: 24px 0 0; }
.project-text .wp-block-embed iframe { width: 100%; }

.project-media { display: flex; flex-direction: column; gap: 40px; }
.project-media > * { margin: 0 !important; }
.project-media img { width: 100%; }

.back { display: inline-block; margin-top: 48px; color: var(--muted); font-size: 13px; }
.back:hover { color: var(--ink); }
.back-end { display: none; }

/* Content written in the WordPress editor */
.entry > * + * { margin-top: 1em; }
.entry > p, .entry > ul, .entry > ol, .entry > h2, .entry > h3 { max-width: 620px; }
.entry figure, .entry .wp-block-image, .entry .wp-block-gallery { margin-top: 40px; margin-bottom: 40px; }
.entry img { width: 100%; }
.entry figcaption, .entry .wp-element-caption {
  color: var(--muted); font-size: 12px; margin-top: 8px; text-align: left;
}
.entry h2, .entry h3 { font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 1.35; margin-top: 2em; }
.entry ul, .entry ol { padding-left: 1.2em; }
.entry a { border-bottom: 1px solid var(--rule); }
.entry a:hover { border-color: var(--ink); }
.entry blockquote { font-family: var(--serif); font-size: 18px; line-height: 1.4; max-width: 620px; }
.entry .wp-block-gallery { gap: 16px; }

/* ---------- Project lists: Current and Archive (open/close) ---------- */

.archive-list { list-style: none; max-width: var(--column); }
.archive-list summary { display: block; cursor: pointer; list-style: none; }
.archive-list summary::-webkit-details-marker { display: none; }
.archive-list summary:focus-visible { outline: 1px solid var(--ink); outline-offset: 4px; }

/* One row: year · title · medium. When open, the picture sits above it
   (starting at the year) and the short text sits beside the picture. */
.row {
  display: grid;
  grid-template-columns: 72px minmax(0, 300px) minmax(0, 1fr);
  grid-template-areas:
    "pic pic txt"
    "yr  ttl med";
  column-gap: 24px;
  align-items: baseline;
  padding: 8px 0;
}
.archive-list > li:first-child .row { padding-top: 0; }
.archive-list details[open] .row { padding-bottom: 32px; }
.archive-list li + li details[open] .row { padding-top: 32px; }

.row .year { grid-area: yr; color: var(--muted); }
.row .title { grid-area: ttl; font-family: var(--serif); font-size: 15px; font-weight: 400; line-height: 1.4; transition: opacity .2s; }
.row .medium {
  grid-area: med; color: var(--muted);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
.archive-list summary:hover:not(:has(.row-pic:hover, .row-text:hover)) .title { opacity: .6; }

.row-pic, .row-text { display: none; align-self: start; animation: paalrees-fade .45s ease; }
details[open] .row-pic, details[open] .row-text { display: block; }
.row-pic { grid-area: pic; margin-bottom: 18px; }
.row-text { grid-area: txt; max-width: 380px; }
.row-summary { display: block; transition: opacity .2s; }
.row-text:hover .row-summary { opacity: .6; }

/* Current page: a plain list of titles, each a link to its project page. */
.title-list { list-style: none; }
.title-list li { padding: 8px 0; }
.title-list li:first-child { padding-top: 0; }
.title-list a { font-size: 15px; line-height: 1.4; transition: opacity .2s; }
.title-list a:hover { opacity: .6; }
@media (min-width: 801px) {
  /* Content starts level with the first menu item ("Current"), not with the name. */
  .title-list, .archive-list { margin-top: 76px; }
  .page-text { margin-top: var(--info-drop, 76px); }
}
.row-meta { display: none; }

/* Pictures are limited in both width and height, so tall (portrait) pictures
   come out about as large as wide ones instead of towering over them. */
.row-pic { --pic-w: 340px; --pic-h: 280px; }
.row-pic .project-feature { display: inline-block; max-width: min(100%, var(--pic-w)); vertical-align: top; overflow: hidden; line-height: 0; }
.row-pic .project-feature.is-video { display: block; width: var(--pic-w); max-width: 100%; }
.row-pic .project-feature img {
  width: auto; height: auto; max-width: 100%; max-height: var(--pic-h);
  transition: opacity .3s, transform .8s ease;
}
.row-pic .project-feature .media-item { margin: 0; }
.row-pic .media-item.video.custom-cover .video-facade { display: inline-block; width: auto; max-width: 100%; vertical-align: top; line-height: 0; }
.row:has(a.project-feature:hover, .row-text:hover) a.project-feature img { opacity: .88; transform: scale(1.012); }

@keyframes paalrees-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .row-pic, .row-text { animation: none; } }

/* Plain list used by category/search pages */
.plain-list { list-style: none; max-width: 760px; border-top: 1px solid var(--rule); }
.plain-list a {
  display: grid; grid-template-columns: 72px 1fr auto; gap: 24px;
  padding: 14px 0; border-bottom: 1px solid var(--rule);
}
.plain-list .year, .plain-list .medium { color: var(--muted); }
.plain-list .title { font-family: var(--serif); font-size: 15px; font-weight: 400; }
.plain-list .medium { font-size: 13px; text-align: right; }

/* ---------- Info / plain pages ---------- */

.page-text { max-width: 560px; }
/* No heading above the text. */
.page-text .entry > :first-child { margin-top: 0; }
.page-text .entry > p:first-child {
  font-family: var(--serif); font-size: 19px; line-height: 1.45; margin-bottom: 32px;
}
.page-text .entry h2 {
  font-family: var(--sans); font-size: 12px; text-transform: uppercase;
  letter-spacing: .14em; color: var(--muted); margin: 40px 0 12px;
}

/* ---------- Medium screens: project text above the pictures ---------- */

@media (max-width: 1100px) {
  .project { display: block; }
  .project-text { max-width: 560px; margin-bottom: 48px; }
  .project-media { max-width: 560px; }
  .project-text .back { display: none; }
  .back-end { display: block; }
}

/* ---------- Small screens ---------- */

@media (max-width: 800px) {
  .side {
    position: static;
    width: auto;
    padding: 28px 20px 0;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
  }
  .admin-bar .side { top: 0; }
  .name { font-size: 15px; }
  .nav ul { margin: 0; display: flex; gap: 18px; }
  .nav li { margin: 0; }
  .side-foot { display: none; }
  .main { margin-left: 0; padding: 40px 20px 72px; }
  .stack { gap: 56px; }
  .work { display: block; }
  .work-text { padding: 14px 0 0; }
  .row {
    grid-template-columns: 52px minmax(0, 1fr);
    grid-template-areas:
      "pic pic"
      "yr  ttl"
      ".   med"
      "txt txt";
    column-gap: 16px;
  }
  .row-pic { --pic-w: 100%; --pic-h: 400px; }

  .row-text { max-width: none; margin-top: 14px; }
  .project-text h1 { font-size: 22px; }
  .project-media { gap: 28px; }
  .plain-list a { grid-template-columns: 52px 1fr; gap: 16px; }
  .plain-list .medium { grid-column: 2; text-align: left; margin-top: -10px; }
}
