/* Base styles. Values taken from the current site's style.css. */

/* Luciole webfont — https://www.luciole-vision.com
   CC-BY: Laurent Bourcellier & Jonathan Perez */

@font-face {
  font-family: "Luciole";
  src: url("../fonts/luciole-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Luciole";
  src: url("../fonts/luciole-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Luciole";
  src: url("../fonts/luciole-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Luciole";
  src: url("../fonts/luciole-bold-italic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --color-text: #000000;
  --color-background: #ffffff;
  --color-surface: #f0f0f0;
  --color-hover: #ffcc00;
  /* Secondary text: language switcher, preview infos */
  --color-text-muted: #767676;
  /* Veil over the preview media, so the infos stay readable on top of it */
  --color-overlay: rgba(255, 255, 255, 0.3);
  --font-text: "Luciole", sans-serif;
  --font-ui: "Luciole", sans-serif;
  --sidebar-width: 180px;
  --page-padding: 50px;
  /* Pages without their own accent colour fall back to black */
  --accent: #000000;
  /* Text on top of an accent fill (project button, active tab) */
  --accent-on: var(--color-background);
}

/* The project colour is set inline on <main> (see site/templates/project.php),
   so the derived colours have to be declared there as well to see it */
:root,
main {
  --accent-text: var(--accent);
}

/* Dark theme follows the system setting. The sidebar, the 3D banner and the
   home page share --color-surface, so they keep the same grey. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --color-text: #f0f0f0;
    --color-background: #121212;
    --color-surface: #1c1c1c;
    --color-text-muted: #a0a0a0;
    --color-overlay: rgba(0, 0, 0, 0.45);
    --accent: #f0f0f0;
  }

  /* Project colours were picked for a white page: mixing them with the text
     colour keeps the titles readable on a dark one */
  :root,
  main {
    --accent-text: color-mix(in srgb, var(--accent) 65%, var(--color-text));
  }
}

/* Light reset */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-text);
  -webkit-font-smoothing: antialiased;
}

img,
video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* The current site only transitions the background, so link text turns yellow instantly */
a {
  color: inherit;
  text-decoration: none;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

a:hover {
  color: var(--color-hover);
}

/* One visible focus style for links, buttons and gallery items */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

small, small * { 
  font-size:0.6em;
  line-height: .8;
}

/* Sidebar layout */

.has-sidebar {
  padding-left: var(--sidebar-width);
}

.site-sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: var(--sidebar-width);
  padding: 20px;
  background-color: var(--color-surface);
}

.site-sidebar-logo svg {
  display: block;
  width: 85.5px;
  height: 100px;
}

/* Menu button and navigation panel only exist below the mobile breakpoint, see the end of this file */
.site-menu-toggle {
  display: none;
}

/* The logo is inline and follows the text colour; the link's own hover colour
   turns it yellow, like the rest of the site */
.site-sidebar-logo,
.home-logo {
  color: var(--color-text);
}

.site-credits {
  margin: 0;
  font-size: 0.75rem;
  text-align: center;
}

/* Navigation */

.site-nav-list {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-sidebar .site-nav-list {
  flex-direction: column;
  align-items: center;
}

.site-nav-link {
  display: block;
  margin: 20px;
  font-weight: 600;
  color:inherit;
}

.site-nav-link[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Language switcher: FR / EN at the bottom of the sidebar, at the top of the
   main on the home page and in the top bar on the phone. The current language
   stays black and is not a link; the others are grey links. */

.site-languages {
  display: flex;
  gap: 10px;
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.site-languages-item {
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-languages-item[aria-current="true"] {
  color: var(--color-text);
}


@media (hover: hover) {
  a.site-languages-item:hover,
  a.site-languages-item:focus-visible {
    color: var(--color-hover);
  }
}

/* Switcher and credits share the bottom of the sidebar, close to each other */
.site-sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Page content */

.page-content {
  padding: var(--page-padding);
}

.page-title {
  margin: 0 0 1em;
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
}

/* Home */

.home {
  background-color: var(--color-surface);
}

.home-content {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
}

/* Each block of the home page keeps the original 20px rhythm */
.home-block {
  margin: 20px 0;
}

.home-logo svg {
  display: block;
  width: 17.1vh;
  height: 20vh;
}

/* The home page has no sidebar: the switcher is pinned to the top of the main,
   away from the centred logo. */
.home .site-languages {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
}

.home .site-nav-list {
  justify-content: space-between;
  width: 50vw;
  max-width: 700px;
  margin: 100px 0px 10px 0px;
}

.home-title {
  margin: 0;
  font-size: 250%;
  font-weight: 700;
  text-align: center;
}

.home-intro {
  width: 60vw;
  max-width: 700px;
  font-size: 150%;
  text-align: center;
}

/* Writer output: no extra space above or below the block */
.home-intro > *:first-child {
  margin-top: 0;
}

.home-intro > *:last-child {
  margin-bottom: 0;
}

/* Project previews (category pages) */

.project-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-preview {
  margin-bottom: 20px;
}

.project-preview-link {
  position: relative;
  display: block;
  height: 40vh;
  overflow: hidden;
}

.project-preview-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  color: var(--color-text);
  opacity: 0;
}

.project-preview-link:hover .project-preview-overlay,
.project-preview-link:focus-visible .project-preview-overlay,
.project-preview-link[data-revealed="true"] .project-preview-overlay {
  background-color: var(--color-overlay);
  opacity: 1;
}

.project-preview-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
  text-align: center;
}

.project-preview-info {
  margin: 23px 0 80px;
  padding: 0 25%;
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: color-mix(in srgb, var(--color-text) 50%, transparent);
}

.project-preview-info-line {
  margin: 0;
}

/* Project page */

.project-hero {
  position: relative;
  height: 40vh;
  overflow: hidden;
}

.project-hero-media {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* 3D banner: the canvas covers the fallback image once WebGL is ready */
.project-hero-3d {
  background-color: var(--color-surface);
  cursor: grab;
}

.project-hero-3d:active {
  cursor: grabbing;
}

.project-hero-3d canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.project-hero-fallback {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Without WebGL, the canvas is hidden and the fallback image shows through */
.project-hero-3d.is-failed canvas {
  display: none;
}

/* The canvas is transparent: without the poster behind it, the banner shows the
   container colour, the same as the sidebar */
.project-hero-3d.is-ready .project-hero-fallback {
  visibility: hidden;
}

.project-body {
  padding: 50px 100px 50px 120px;
}

/* Title and optional button share one line as long as they both fit. When the
   title would have to wrap, the button goes to the next line instead. */
.project-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.project-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-text);
}

.project-button {
  flex: none;
  padding: 0 15px;
  border-radius: 1em;
  background-color: var(--accent);
  color: var(--accent-on);
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.5;
}

/* The current site turns the button red on hover, whatever the accent colour */
.project-button:hover {
  background-color: var(--color-hover);
  color: var(--accent-on);
}

/* The shuffle button is a real <button>, unlike the media link */
button.project-button {
  border: 0;
  cursor: pointer;
}

.project-text {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  margin-top: 20px;
}

/* Infos take one third of the row, description two thirds. When the window is
   too narrow for both minimum widths, the description goes under the infos. */
.project-details {
  flex: 1 1 240px;
}

.project-description {
  flex: 2 1 400px;
}

.project-section + .project-section {
  margin-top: 20px;
}

.project-section-title {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-text);
}

.project-section p {
  margin: 0;
  font-size: 18px;
  text-align: left;
}

.project-description {
  font-size: 18px;
  text-align: left;
}

.project-description p {
  margin: 0;
}

/* Paragraph breaks in the textarea fields need their own spacing (margins reset above) */
.project-section p + p,
.project-description p + p {
  margin-top: .5em;
}

/* Credits are a dense list of names, hence the smaller and tighter setting */
.project-section-credits p {
  font-size: 15px;
  line-height: 1.3;
}

.project-description :is(h2, h3, h4) {
  margin: 20px 0 0;
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  text-align: left;
  color: var(--accent-text);
}

.project-description :is(h2, h3, h4):first-child {
  margin-top: 0;
}

/* Same left and right edges as the texts, see .project-body.
   Three columns of different heights, like a montage of the images.
   The 240px minimum drops the gallery to two columns on medium windows. */
.project-gallery {
  margin-top: 40px;
  columns: 3 240px;
  column-gap: 20px;
}

.project-gallery-item {
  display: block;
  margin-bottom: 20px;
  break-inside: avoid;
}

.project-gallery img {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 767px) {
  .project-gallery {
    columns: 1;
  }
}

/* Gallery tabs: one tab per place or edition. Without JS (no .is-ready) every
   panel stays visible, each one introduced by its own title. */
.project-tabs-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 30px;
  margin-top: 40px;
}

.project-tab {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 700;
  color: color-mix(in srgb, var(--color-text) 40%, transparent);
  cursor: pointer;
}

.project-tab[aria-selected="true"] {
  color: var(--accent-text);
  /*text-decoration: underline;
  text-underline-offset: 4px;*/
}

/* Inactive tabs darken and underline on hover, like the other links of the site.
   The media query avoids a stuck hover on touch screens. */
@media (hover: hover) {
  .project-tab:not([aria-selected="true"]):hover,
  .project-tab:not([aria-selected="true"]):focus-visible {
    color: var(--color-hover);
  }
}

.project-tabs.is-ready .project-tab-panel {
  display: none;
}

.project-tabs.is-ready .project-tab-panel.is-active {
  display: block;
}

.project-tabs.is-ready .project-tab-title {
  display: none;
}

.project-tab-title {
  margin: 40px 0 0;
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-text);
}

/* About page. The layout blocks are shared with the project page (.project-*),
   as on the current site where both pages use the same template. */

/* Dated lists span the whole content width, like the galleries */
.about-timeline {
  margin-top: 40px;
  font-size: 18px;
}

.about-timeline h2 {
  margin: 20px 0 0;
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-text);
}

.about-timeline h2:first-child {
  margin-top: 0;
}

.about-timeline p {
  margin: 0;
  text-align: left;
}

.about-timeline p + p {
  margin-top: 1em;
}

/* Lightbox: no visible controls, see assets/js/main.js */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  background-color: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

body.lightbox-open {
  overflow: hidden;
}

/* Mobile: the sidebar becomes a bar on top of the screen, the navigation opens
   in a compact panel under the menu button. Same breakpoint everywhere. */

@media (max-width: 767px) {
  :root {
    --topbar-height: 80px;
    --page-padding: 20px;
  }

  .has-sidebar {
    padding-top: var(--topbar-height);
    padding-left: 0;
  }

  .site-sidebar {
    right: 0;
    bottom: auto;
    flex-direction: row;
    justify-content: space-between;
    height: var(--topbar-height);
    width: auto;
    padding: 0 20px;
  }

  .site-sidebar-logo svg {
    width: 34px;
    height: 40px;
  }

  /* The copyright stays in the desktop sidebar; hiding it keeps the bar short */
  .site-credits {
    display: none;
  }

  .site-menu-toggle {
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 700;
    color: inherit;
    cursor: pointer;
  }

  /* The bottom group moves to the top bar, next to the menu button. The
     wrapper is pushed right so that it stays on the right without JS too.
     Baseline alignment keeps "Menu" and the languages on the same line of
     text, even though the two have different font sizes. */
  .site-sidebar-bottom {
    flex-direction: row;
    align-items: baseline;
    gap: 16px;
    margin-left: auto;
  }

  .site-sidebar .site-languages {
    font-size: 14px;
  }

  .site-menu-toggle:hover {
    color: var(--color-hover);
  }

  .site-sidebar.is-ready .site-menu-toggle {
    display: block;
  }

  .site-sidebar .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    padding: 10px var(--page-padding) 20px;
    background-color: var(--color-surface);
  }

  .site-sidebar .site-nav-list {
    align-items: flex-start;
  }

  .site-sidebar .site-nav-link {
    margin: 8px 0;
    font-size: 18px;
  }

  /* Without JS (no .is-ready) the panel stays open, so the navigation remains reachable */
  .site-sidebar.is-ready .site-nav {
    display: none;
  }

  .site-sidebar.is-open .site-nav {
    display: block;
  }

  /* Project and about pages */
  .project-body {
    padding: 24px var(--page-padding) 40px;
  }

  .project-text {
    flex-direction: column;
    gap: 20px;
  }

  /* Stacked columns: the desktop minimum widths no longer apply */
  .project-text > * {
    flex: 1 1 auto;
  }

  .project-preview-info {
    margin: 16px 0 0;
    padding: 0;
    font-size: 16px;
  }

  /* Home page, the only one without a sidebar. The intro makes the column
     taller than the screen on a phone, and flex centring would then push its
     top above the viewport: the page simply starts at the top instead. */
  .home-content {
    justify-content: flex-start;
    padding: 20px;
  }

  /* Back into the flow, above the logo, so the two can no longer overlap */
  .home .site-languages {
    position: static;
    transform: none;
    margin-bottom: 20px;
  }

  /* The same percentages as on a wide screen are too large on a phone */
  .home-title {
    font-size: 200%;
  }

  .home .site-nav-list {
    flex-wrap: wrap;
    justify-content: center;
    width: auto;
    margin: 40px 0 10px;
  }

  .home-intro {
    width: 100%;
    font-size: 120%;
  }
}
