/* ryanwatt.ca
   Written by hand. No variables, no preprocessor, no build step — this file
   is served exactly as it appears here, at /style.css.

   The layout is floats and fixed pixel widths on purpose. The page is not
   centred and does not fill the window: the nav sits in a narrow column at
   the top right, the text sits in a 500px column set in from the left, and
   everything else is empty. */

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  line-height: 18px;
  color: #333;
  background: #fff;
  margin: 0;
}

/* Nav. Same on every page. */

#menu {
  float: right;
  width: 150px;
  margin-top: 30px;
  margin-right: 20px;
  text-align: right;
}

#menu .title {
  color: #000;
}

#menu ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

#menu a {
  display: inline-block;
  color: #0864c7;
}

/* The page you're currently on goes black, keeping the underline. The only
   state in the nav, and the only thing marking where you are. */

#menu a[aria-current="page"] {
  color: #000;
}

/* An empty column holding the text away from the left edge. It has no
   content and no height; it exists only to take up 200px. */

#left {
  float: left;
  width: 200px;
  height: 1px;
  overflow: hidden;
  margin: 0;
  padding: 0;
}

/* Text. Set down from the top by the same distance the nav sits below the top
   edge — so the column begins level with where the menu ends rather than at the
   very top. One value, easy to move. */

#content {
  float: left;
  width: 500px;
  margin-top: 150px;
  margin-bottom: 60px;
}

#content a {
  color: #0864c7;
}

/* Heading sizes are left at the browser default, which is the whole point:
   they were never chosen. Only the spacing is set. */

#content h1,
#content h2,
#content h3 {
  margin: 0;
}

#content h2 {
  margin-top: 2em;
}

#content h3 {
  margin-top: 1.5em;
}

#content li {
  margin-bottom: 0.7em;
}

#content blockquote {
  margin-left: 0;
  padding-left: 12px;
  border-left: 1px solid #ddd;
  color: #777;
}

#content pre {
  overflow-x: auto;
  font-size: 12px;
}

/* Markdown emits a bare <img> as a raw HTML block, so it gets no paragraph
   margin of its own. */

#content img {
  max-width: 100%;
  margin-bottom: 13px;
}

/* Photos page. A single image, edge to edge, inset by a border the width of
   the nav column on every side. No text column, no left gutter. */

body.full-bleed {
  margin: 0;
}

#photo-frame {
  position: fixed;
  top: 150px;
  right: 150px;
  bottom: 150px;
  left: 150px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

/* Photos. A grid of thumbnails, three across, evenly spaced, filling left to
   right and then down. No captions in this view.

   Horizontal grid (the rule for anything laid across the page): the left edge
   sits at 200px, level with the text column, and the width is divided into an
   odd number of equal columns — 3 here — separated by a fixed 20px gutter. The
   gutter is the horizontal spacing unit; nothing is placed off a column's left
   edge. Same 200px left and 150px top as the text pages, so the grid's corner
   lines up with the headshot on About. */

#gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 760px;
  margin: 0 auto 60px 200px;
  /* The 150px drop is padding, not margin: the grid is the first in-flow child
     here (the nav floats), and a top margin would collapse through <body> and
     take the floated nav down with it. Padding keeps the nav pinned at top. */
  padding-top: 150px;
}

#gallery figure {
  margin: 0;
}

#gallery figure a {
  display: block;
}

/* All the photos are 3:2; width 100% with height auto keeps each thumbnail's
   own aspect ratio, so a future portrait shot would keep its shape too. The
   drag/select-off pair, with the context-menu handler in gallery.js, turns off
   the one-click save — it doesn't lock the files down, nothing on the open web
   can, it just removes the obvious grab. */
#gallery img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

#gallery figcaption {
  display: none; /* captions belong to the enlarged view, not the grid */
}

/* Lightbox. Click a thumbnail and the photo takes over the screen on white:
   arrow keys or the on-screen arrows move between photos, clicking the photo
   advances, and ×, Escape, or a click off the photo closes it. The caption
   sits tight under the image and left-aligned to it. Built by /gallery.js;
   with no JavaScript a thumbnail is just a link to the full image. */

#lightbox {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2000;
  background: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  box-sizing: border-box;
}

/* The id selector's display:flex outranks the browser's [hidden] rule, so the
   hidden state has to be stated at the same specificity or the box never
   closes. */
#lightbox[hidden] {
  display: none;
}

.lb-figure {
  margin: 0;
  max-width: 90vw;
}

.lb-img {
  display: block;
  max-width: 90vw;
  max-height: 82vh;
  width: auto;
  height: auto;
  cursor: pointer;
  -webkit-user-drag: none;
  -webkit-user-select: none;
  user-select: none;
}

.lb-cap {
  margin-top: 8px; /* tight under the image */
  text-align: left; /* left-justified to the image */
  color: #333;
}

/* Close and the arrows: solid black, and kept at the body text size so their
   stroke weight matches the text rather than reading as heavy glyphs. */
.lb-close,
.lb-prev,
.lb-next {
  position: fixed;
  background: none;
  border: 0;
  padding: 12px;
  color: #000;
  font-family: inherit;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}

.lb-close {
  top: 16px;
  left: 20px;
}

.lb-prev,
.lb-next {
  top: 50%;
  transform: translateY(-50%);
}

.lb-prev {
  left: 16px;
}

.lb-next {
  right: 16px;
}

/* Phones. The fixed columns above are wider than a phone screen, so they
   stack. This is the one rule here that answers to a device the rest of the
   layout predates — without it the site is unreadable on a phone. */

@media (max-width: 720px) {
  #menu {
    float: none;
    width: auto;
    margin: 20px 20px 0 20px;
    text-align: left;
  }

  #left {
    display: none;
  }

  #content {
    float: none;
    width: auto;
    margin: 20px;
  }

  /* Three across on a phone too, but without the desktop top drop — the nav
     already stacks above the grid here. */
  #gallery {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 20px;
    padding-top: 0;
  }

  #photo-frame {
    top: 160px;
    right: 20px;
    bottom: 20px;
    left: 20px;
  }
}

/* Intro gate. Homepage only. A single still photo fills the screen with the
   word "Enter" set over the sun; a click or tap dismisses it and it does not
   come back — the site remembers you've entered. This is the one page that
   departs from the no-hero, no-JavaScript rule, on purpose. */

/* Hidden by default: with no JavaScript, or for a visitor who has already
   entered, the gate never shows and the homepage is what you get. The head
   script adds `intro` to <html> before the body paints — only for a first
   visit — which is the single thing that reveals it. */
#splash {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  background: #fff; /* shown until the photo paints */
  cursor: pointer;
  opacity: 1;
  transition: opacity 0.6s ease;
  overflow: hidden;
}

html.intro #splash {
  display: block;
}

#splash.leaving {
  opacity: 0;
}

/* The photo covers the screen without letterboxing. Rather than object-fit on
   a viewport-sized image — which would slide the sun around as the window is
   resized — the photo keeps its 3:2 box inside #splash-stage, and the stage is
   sized to always cover the viewport. Because the "Enter" label is placed as a
   percentage of that same box, it stays locked to the sun at every window
   shape. 150vh is the stage width that makes a 3:2 box exactly one viewport
   tall; max() picks whichever of that or the full width is larger. */
#splash-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: max(100vw, 150vh);
  aspect-ratio: 3 / 2;
}

#splash-photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* "Enter →" set over the sun (a little left of centre, just above the midline),
   pinned as a percentage of the stage so it tracks the sun. It's the site's own
   text — 13px Helvetica — in black, which reads cleanly on the blown-out sun;
   the → is the same glyph the photo lightbox uses. pointer-events off so the
   click falls through to the gate. To move it, change these two percentages. */
#splash-enter {
  position: absolute;
  left: 44%;
  top: 55%;
  transform: translate(-50%, -50%);
  color: #000;
  white-space: nowrap;
  pointer-events: none;
}
