@font-face {
  font-family: 'SuisseIntl';
  src: url('fonts/SuisseIntl-Regular-WebXL.woff2') format('woff2');
  font-weight: normal;
  font-style: normal;
}

body {
  margin: 0;
  /* Footer always at the very bottom, even on short pages */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #111111;
  color: #f1f1f1;
  /* Dark native form controls (select dropdowns, file pickers, scrollbars) */
  color-scheme: dark;
  font-family: 'SuisseIntl', sans-serif;
  font-size: 20px;
  font-weight: normal;
}

/* No bold, not even in elements browsers render bold by default */
* {
  font-weight: normal;
  font-synthesis: none;
}

input,
textarea,
select,
button {
  font: inherit;
  padding: 2px 8px;
  color: inherit;
  background: transparent;
  border: 1px solid;
  border-radius: 0;
}

/* Main navigation: three columns – logo, workshop, section links */
header {
  display: grid;
  /* Outer columns share the space equally (so the middle stays centered), but never get narrower than their content */
  grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr);
  align-items: center;
  gap: 8px 24px;
  padding: 16px;
  margin-bottom: 16px;
}

.workshop {
  text-align: center;
}

header nav {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
}

header nav a.button {
  border-radius: 999px;
  padding: 2px 14px;
}

/* Current section (same look as hover) */
header nav a.button.active {
  background: #00ff00;
  border-color: #00ff00;
}

/* Small screens: stack the three parts */
@media (max-width: 900px) {
  header { grid-template-columns: 1fr; }
  header nav { flex-wrap: wrap; }
  .workshop { text-align: left; }
  header nav { justify-content: flex-start; }
}

/* Action links (e.g. "Upload Output") look like the form buttons */
a.button {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid #aaaaaa;
  background: #aaaaaa;
  color: #000000;
  text-decoration: none;
}

/* Upload area above a section's grid: centered in half the screen height */
.actions,
.url-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 0 16px;
}

/* Several download buttons stacked */
.actions.downloads {
  gap: 16px;
}

/* Large, round upload buttons and URL field */
.actions a.button,
.url-row input,
.url-row button {
  font-size: 2em;
  padding: 0.25em 0.9em;
  border-radius: 999px;
}

@media (max-width: 600px) {
  .actions a.button,
  .url-row input,
  .url-row button {
    font-size: 1.3em;
  }
}

/* Buttons (and button-style links): grey, green on hover */
button,
::file-selector-button {
  background: #aaaaaa;
  color: #000000;
  border: 1px solid #aaaaaa;
  cursor: pointer;
}

a.button:hover,
button:hover,
::file-selector-button:hover {
  background: #00ff00;
  border-color: #00ff00;
  color: #000000;
}

a {
  color: #00ff00;
  text-decoration: none;
}

option {
  background: #111111;
  color: #f1f1f1;
}

.narrow {
  max-width: 470px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Single post */
.single {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

.single img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.single .name,
.single .caption,
.single .date {
  padding: 4px 0 0;
}

/* Author and component set pages */
.page-title {
  font-size: inherit;
  margin: 0;
  padding: 0 16px 16px;
}

h2.page-title {
  padding-top: 16px;
}

.post-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-form > div {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.post-form button {
  margin-top: 8px;
  align-self: flex-start;
}

/* Feed: full-width grid, 4 columns down to 1 on mobile */
.feed {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px 16px;
  padding: 0 16px 32px;
}

@media (max-width: 1200px) {
  .feed { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .feed { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .feed { grid-template-columns: 1fr; }
}

.post img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.post .name,
.post .caption {
  padding: 4px 0 0;
}

/* Inspirations: URL field above a masonry grid (4 columns down to 1) */
.url-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 800px;
}

.url-row {
  display: flex;
  gap: 8px;
}

@media (max-width: 600px) {
  .url-row { flex-direction: column; }
  .url-row button { align-self: flex-start; }
}

.url-row input {
  flex: 1;
  min-width: 0;
}

.masonry {
  columns: 4;
  column-gap: 16px;
  padding: 0 16px 32px;
}

@media (max-width: 1200px) {
  .masonry { columns: 3; }
}

@media (max-width: 900px) {
  .masonry { columns: 2; }
}

@media (max-width: 600px) {
  .masonry { columns: 1; }
}

.inspiration {
  break-inside: avoid;
  margin-bottom: 24px;
}

.inspiration img,
.single img.natural {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto;
}

.inspiration .name,
.inspiration .caption {
  padding: 4px 0 0;
}

/* Metadata list on the detail page */
.meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 16px 0 0;
}

.meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 600px) {
  .meta { grid-template-columns: 1fr; }
  .meta dd { margin-bottom: 8px; }
}

/* Component set overview: one row per set, all images side by side, centered.
   Every image is 1/12 of the width, so a set of 12 fills the row exactly. */
.set-list {
  padding: 0 16px 32px;
}

.set-row {
  margin-bottom: 32px;
}

.set-info {
  padding-bottom: 8px;
  text-align: center;
}

.set-images {
  --per-row: 12;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.set-images img {
  display: block;
  width: calc((100% - (var(--per-row) - 1) * 8px) / var(--per-row));
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

/* Phones: 6 per row, otherwise the images get too small */
@media (max-width: 600px) {
  .set-images { --per-row: 6; }
}

/* Modals (upload forms, single post) */
.modal {
  width: calc(100% - 32px);
  max-width: 470px;
  max-height: calc(100vh - 32px);
  padding: 16px;
  border: 0;
  background: #f1f1f1;
  color: #111111;
  /* Light native form controls inside the light modal */
  color-scheme: light;
}

/* No focus outline around the modal box itself (the fields inside keep theirs) */
.modal:focus,
.modal:focus-visible {
  outline: none;
}

/* Links in the light modal (e.g. the author's name): dark, green would be hard to read here */
.modal a {
  color: #111111;
  text-decoration: underline;
}

.modal-wide {
  max-width: 800px;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.8);
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.modal img {
  display: block;
  /* Square image that always fits into the window, leaving room for the text below */
  width: min(100%, calc(100vh - 220px));
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.modal .name,
.modal .caption,
.modal .date {
  padding: 4px 0 0;
}

main {
  flex: 1;
}

/* Footer: imprint link and (when unlocked) the logout button */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 32px 16px;
}

footer form {
  margin: 0;
}

button.logout {
  border-radius: 999px;
}

/* Explanation text in upload modals */
.info {
  margin: 0 0 8px;
}

/* Smooth cross-fade between pages (View Transitions API; browsers without support just navigate normally) */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* Scroll reveal (classes are added by app.js) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* Buttons inside modals: round, no border, dark on the light modal */
.modal button,
.modal ::file-selector-button {
  border: 0;
  border-radius: 999px;
  background: #111111;
  color: #f1f1f1;
  padding: 4px 14px;
}

.modal button:hover,
.modal ::file-selector-button:hover {
  background: #00ff00;
  color: #000000;
}
