/* ==========================================================
   pieterwattel.nl - basic styling

   The page exists twice:
     .site-light  black text on white (the normal page)
     .site-dark   white text on black (a copy, laid on top)
   The slider (aside) reveals the dark copy by clipping it.
   To change colors, only edit --bg and --fg below.
   ========================================================== */


/* ---------- 1. Basics ---------- */

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 18px;
}

* {
  box-sizing: border-box;
}


/* ---------- 2. The two themes ---------- */

.site-light,
.site-dark {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
}

.site-light {
  --bg: #f6f6f3;
  --fg: #0c0c0c;
  /* button colors: the face is the page color, the bevel lines are grays */
  --face: #f6f6f3;
  --outer-light: #f6f6f3;
  --outer-dark: #0c0c0c;
  --inner-light: #dfdfdf;
  --inner-dark: #808080;
}

.site-dark {
  --bg: #0c0c0c;
  --fg: #f6f6f3;
  --face: #0c0c0c;
  --outer-light: #f6f6f3;
  --outer-dark: #808080;
  --inner-light: #808080;
  --inner-dark: #404040;

  z-index: 1;                 /* on top of the light page */
  pointer-events: none;       /* clicks go through to the light page */
  clip-path: inset(0 0 0 85vw); /* index.js changes this while dragging */
}


/* ---------- 3. Layout: [empty] [content] [nav] ---------- */

.mainDiv {
  display: flex;
  width: 100vw;
  height: 80vh;
  margin-top: 10vh;
}

.mainDiv > :nth-child(1) { width: 15vw; }  /* empty left space */
.mainDiv > :nth-child(2) { width: 70vw; }  /* title + main box */
.mainDiv > :nth-child(3) { width: 15vw; }  /* nav */

#indexContent {
  display: flex;
  flex-direction: column;
  height: 100%;
}

h1,
h3 {
  margin: 0 0 0.5em;
}

/* the bordered content box: "currently .. while .." on top, the page below */
.box {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: 2px solid var(--fg);
}

#currentActivity {
  margin: 0;
  padding: 0.5em 0.5em 0;
  font-size: 1.17em; /* former h3 size, so the tagline stays the same */
  font-weight: bold;
}

/* "currently .. while .." shows on the home page. The no-JS line in <main> does not count; a real page (agenda, projects, guestbook, contact) hides it. */
.box:has(main > :not(noscript)) #currentActivity {
  display: none;
}

main {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.5em;
}


/* ---------- 4. Nav buttons ---------- */

nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  margin-top: 10vh;
}

/* Windows 95 button: a thin 2-line bevel.
   outer line = the border, inner line = the inset shadow.
   Border colors are in the order: top right bottom left. */
nav button {
  font: inherit;
  padding: 0.3em 0.6em;
  color: var(--fg);
  background: var(--face);
  border: 2px solid;
  border-color: var(--outer-light) var(--outer-dark) var(--outer-dark) var(--outer-light);
  box-shadow:
    inset -1px -1px var(--inner-dark),
    inset 1px 1px var(--inner-light);   /* raised */
  cursor: pointer;
}

/* .is-hover / .is-active are set by index.js so the dark copy shows them too */

/* hover: only a dotted line inside, the colors stay the same */
nav button:hover,
nav button.is-hover {
  outline: 2px dotted var(--fg);
  outline-offset: -6px;
}

/* pressed: the bevel turns around (inset) and the text sinks 1px */
nav button:active,
nav button.is-active {
  border-color: var(--outer-dark) var(--outer-light) var(--outer-light) var(--outer-dark);
  box-shadow:
    inset 1px 1px var(--inner-dark),
    inset -1px -1px var(--inner-light);
  padding: calc(0.3em + 1px) calc(0.6em - 1px) calc(0.3em - 1px) calc(0.6em + 1px);
}

nav button[aria-current="page"] .nav-label {
  text-decoration: underline;   /* the page you are on */
}


/* ---------- 5. Agenda ---------- */

.agenda-block {
  margin-bottom: 1.5em;
}

.agenda-block h2 {
  margin: 0 0 0.5em;
}

.agenda-event {
  display: grid;
  grid-template-columns: 8em 1fr;  /* date and time range | title */
  gap: 0 1em;
  max-width: 800px;
  margin: 0.5em 0;
  padding: 0.4em 0.6em;
  border: 1px solid var(--fg);
}

.agenda-event p,
.agenda-event h3 {
  margin: 0;
  font-size: 1em;
}

.agenda-when {
  display: flex;
  flex-direction: column;
}

.agenda-times {
  display: flex;
  flex-direction: column;
}

.agenda-time {
  white-space: nowrap; /* "start: 20:00" stays on one line */
}

.agenda-tickets {
  text-decoration: underline;
}

/* project label of an upcoming event: in the top-right corner of the card */
.agenda-event:not(.agenda-event-past) {
  position: relative;
}

.agenda-event:not(.agenda-event-past) > .agenda-when {
  grid-column: 1;
}

.agenda-event:not(.agenda-event-past) > .agenda-body {
  grid-column: 2;
  padding-right: 6em;
}

.agenda-event:not(.agenda-event-past) .agenda-project {
  position: absolute;
  top: 0.4em;
  right: 0.6em;
  font-size: 0.8em;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* old events: a slimmer box, one line each */
.agenda-event-past {
  display: grid;
  grid-template-columns: 1fr auto;  /* event name | project (right) */
  align-items: baseline;
  gap: 0 0.6em;
  margin: 0.35em 0;
  padding: 0.15em 0.5em;
}

.agenda-event-past .agenda-title {
  order: 1;
}

.agenda-event-past .agenda-project {
  order: 2;                         /* after the event name: far right */
  font-size: 0.8em;
  font-weight: bold;
  text-align: right;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* color sits in a left bar; the 1px border stays the page foreground */
.agenda-event[style*="--project-color"] {
  position: relative;
  padding-left: calc(0.6em + 1em);
}

.agenda-event-past[style*="--project-color"] {
  padding-left: calc(0.5em + 1em);
}

.agenda-event[style*="--project-color"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1em;
  background: var(--project-color);
  border-right: 1px solid #F6F6F3;
}


/* ---------- 5b. Projects ---------- */

/* one box per project: title, visual, a line, short description */
.project {
  max-width: 540px;
  margin: 0 0 1.5em;
  border: 2px solid var(--fg);
}

.project h2 {
  margin: 0;
  padding: 0.3em 0.5em;
  font-size: 1.1em;
  border-bottom: 1px solid var(--fg);
}

/* the visual: an empty slot, the real image/website is laid over it */
.project-visual {
  height: 264px;
  background: #fff;
}

/* media layer: one copy of each image/website, above light AND dark page */
.media-layer {
  position: fixed;
  z-index: 1;                /* above .site-dark, below the slider handle */
  overflow: hidden;          /* clips media when the box scrolls */
  pointer-events: none;      /* only the media itself is clickable */
}

.media {
  position: absolute;
  overflow: hidden;
  pointer-events: auto;
  background: #fff;
}

.media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.media-click {
  cursor: pointer;
}

/* the still keeps its shape and fills the frame on the tighter side */
.media-click img {
  object-fit: contain;
  object-position: center;
}

.media iframe {
  display: block;
  border: 0;
  transform-origin: 0 0;     /* index.js scales it down from a desktop width */
}

.media iframe.media-video {
  width: 100%;
  height: 100%;
  transform: none;           /* examples fill the project frame, not a desktop preview */
}

/* the line between visual and description */
.project-text {
  padding: 0.5em;
  border-top: 2px solid var(--fg);
}

.project-text p {
  margin: 0 0 0.5em;
  font-size: 0.9em;
}

.project-text p:last-child {
  margin-bottom: 0;
}

.project a,
.project-example {
  font: inherit;
  color: inherit;
  text-decoration: underline;
}

.project-example {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}


/* ---------- 5c. Contact ---------- */

.contact h2 {
  margin: 0 0 0.5em;
}

.contact a {
  text-decoration: underline;
  cursor: pointer;
}

.contact-note {
  font-weight: bold;
}


/* ---------- 5d. Guestbook ---------- */

.guestbook h2 {
  margin: 0 0 0.5em;
}

.guestbook-button {
  font: inherit;
  padding: 0.3em 0.6em;
  color: var(--fg);
  background: var(--bg);
  border: 2px solid var(--fg);
  cursor: pointer;
}

.guestbook-buttons {
  display: flex;
  gap: 0.5em;
  margin: 0.5em 0;
}

.guestbook-note {
  font-weight: bold;
}

.guestbook-list {
  margin-top: 1em;
}

.guestbook-entry {
  max-width: 600px;
  margin-bottom: 0.8em;
  padding: 0.4em 0.6em;
  border: 1px solid var(--fg);
}

.guestbook-entry p {
  margin: 0;
}

.guestbook-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.guestbook-form {
  max-width: 600px;
}

.guestbook-field {
  display: block;
  margin-bottom: 0.8em;
}

.guestbook-field span {
  display: block;
  margin-bottom: 0.2em;
}

.guestbook-field input,
.guestbook-field textarea {
  display: block;
  width: 100%;
  font: inherit;
  color: var(--fg);
  background: var(--bg);
  border: 2px solid var(--fg);
  padding: 0.3em;
}

.guestbook-trap {
  position: absolute;
  left: -9999px;
}


/* ---------- 6. Slider handle ---------- */

aside {
  position: fixed;
  top: 0;
  right: 0;
  width: 15vw;
  height: 100vh;
  z-index: 2;
  pointer-events: none;   /* only the handle is clickable */
}

.aside-slider {
  pointer-events: auto;
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 2rem;
  height: 3.2rem;
  padding: 0;
  cursor: ew-resize;
  touch-action: none;
  background: #000;
  border: 2px solid #fff;
  border-radius: 2rem;
  outline: 2px solid #000;   /* keeps it visible on the white side */
}

.aside-slider img {
  display: block;
  width: 100%;
  height: auto;
}

.aside-slider-arrow {
  width: 1.15rem;
  height: 0.7rem;
  margin-bottom: 0.28rem;
  fill: none;
  stroke: #fff;
  stroke-width: 3;
}


/* ---------- 7. Phone: everything stacked, slider at the bottom ---------- */

@media (max-width: 480px) {
  .mainDiv {
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    margin-top: 0;
  }

  .mainDiv > :nth-child(1) { width: 100%; height: 5vh; }
  .mainDiv > :nth-child(2) { width: 100%; flex: 1; min-height: 0; }
  .mainDiv > :nth-child(3) { width: 100%; }  /* nav: only as tall as its buttons */

  nav {
    flex-direction: row;
    justify-content: space-around;
    margin-top: 0;
    gap: 0;
    padding-bottom: 0.5em;
  }

  /* title, place and project each on their own line; date and time stay together */
  .agenda-event,
  .agenda-event-past {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15em;
  }

  .agenda-when {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 0.6em;
  }

  .agenda-event:not(.agenda-event-past) > .agenda-body {
    padding-right: 0;
  }

  .agenda-event:not(.agenda-event-past) .agenda-project,
  .agenda-event-past .agenda-project {
    position: static;
    text-align: left;
  }

  aside {
    top: auto;
    left: 0;
    bottom: 0;
    width: 100%;
    /* resting edge is the top of the bottom buttons; index.js sets the same minimum */
    height: var(--phone-slider-min, 12vh);
  }

  .aside-slider {
    left: 50%;
    top: 0;
    cursor: ns-resize;
  }

  .aside-slider-arrow {
    transform: rotate(90deg);
  }
}
