/*
 * Photography Wrapped — the website. Layout, top bar, buttons and sections are
 * Easy Exif's (photo-settings-overlay/public/css/site.css), which follows
 * can-i-format's, so the photography projects read as one family: warm paper
 * neutrals, with green for anything you act on.
 */

:root {
  --bg: #fcfcfc;
  --surface: #ffffff;
  --surface-2: #f2f2f2;
  --border: #e4e4e4;
  --border-strong: #cecece;
  --text: #060606;
  --text-dim: #555555;
  --text-faint: #808080;

  --accent: #1f8a4c;
  --accent-text: #ffffff;
  /* Green for links and small tags. Same as --accent on the light page. */
  --accent-light: #1f8a4c;


  --radius: 10px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* The illustrated photographs in the hero, straight from scan-cropper's
     landing page: the two sites are meant to look like one family, and these
     are mid-tone enough to sit on either paper, so there is no dark set. */
  --print-sun: #f6d27a;
  --print-skin: #e9c6a9;
  --print-hair-1: #5b4232;
  --print-hair-2: #2f2a28;
  --print-hair-3: #a9713f;
  --print-sky-1: #9cc7dd;
  --print-sky-2: #56708c;
  --print-sky-3: #c3d8cf;
  --print-sky-4: #d9c7dd;
  --print-land-1: #5f8f6c;
  --print-land-2: #b5714f;
  --print-land-3: #4f7d86;
  --print-land-4: #7a6a96;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171512;
    --surface: #1f1c18;
    --surface-2: #28241f;
    --border: #35302a;
    --border-strong: #4a433a;
    --text: #f0ebe2;
    --text-dim: #b5ab9b;
    --text-faint: #837a6b;

    --accent: #4caf6e;
    --accent-text: #0b1a10;
    --accent-light: #8fd3a5;

    --theme-sun: none;
    --theme-moon: block;
  }
}

/* The same values, for someone who chose dark with the toggle. */
:root[data-theme="dark"] {
  --bg: #171512;
  --surface: #1f1c18;
  --surface-2: #28241f;
  --border: #35302a;
  --border-strong: #4a433a;
  --text: #f0ebe2;
  --text-dim: #b5ab9b;
  --text-faint: #837a6b;

  --accent: #4caf6e;
  --accent-text: #0b1a10;
  --accent-light: #8fd3a5;

  --theme-sun: none;
  --theme-moon: block;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
h1 {
  font-size: 1.05rem;
}
h2 {
  font-size: 1rem;
}

a {
  color: var(--accent-light);
}

code {
  font-family: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* ---- chrome ------------------------------------------------------------ */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  display: block;
  flex: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar-link {
  font-size: 0.875rem;
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 8px;
}
.topbar-link:hover {
  background: var(--surface-2);
  color: var(--text);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--text-dim);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
.theme-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}
.theme-toggle svg {
  width: 16px;
  height: 16px;
}
.theme-sun {
  display: var(--theme-sun, block);
}
.theme-moon {
  display: var(--theme-moon, none);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  font-weight: 550;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  padding: 0.6rem 1.1rem;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}
.button:hover {
  background: var(--surface-2);
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.button.primary:hover {
  filter: brightness(1.08);
}

.topbar .button {
  font-size: 0.875rem;
  padding: 0.4rem 0.85rem;
  white-space: nowrap;
}

main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- hero --------------------------------------------------------------- */

.landing-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 3rem;
  align-items: center;
  padding: 4.5rem 0 3.5rem;
}

/* The text starts at the same height on every site, whatever the length of its
   lede: the headline sits 6.5rem below the top of the demo panel. */
.landing-hero > :first-child {
  align-self: start;
  padding-top: 6.5rem;
}
.landing-hero h2 {
  font-size: clamp(2rem, 4.4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  margin-bottom: 1rem;
  text-wrap: balance;
}
.landing-hero .lede {
  font-size: 1.1rem;
  color: var(--text-dim);
  max-width: 48ch;
  margin: 0 0 1.75rem;
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}
/* ---- demo ---------------------------------------------------------------
 * Real slides in the panel Easy Exif and can-i-format both use, stepped
 * through by demo.js. Each is an SVG the app drew (see README), with a dark
 * twin swapped in by <picture>.
 */

.demo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.1rem;
  box-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.35);
  aspect-ratio: 13 / 14;
  display: flex;
  flex-direction: column;
}
/* The slide on screen, and the whole deck down the side of it. The rail's
   width is a share of the panel rather than a number of pixels, so the twelve
   photographs, the slide and the thumbnails all keep their proportions as the
   hero narrows. */
.demo-body {
  display: flex;
  align-items: flex-start;
  gap: 2.4%;
}
.demo-rail {
  flex: 0 0 11.5%;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0;
  transition: opacity 0.45s ease;
}
/* Held back while the sheet is being read: the deck does not exist yet, and a
   column of slides beside it would say otherwise. */
.demo-rail.is-on {
  opacity: 1;
}
.demo-thumb {
  border-radius: 3px;
  border: 1px solid var(--border);
  overflow: hidden;
  opacity: 0.62;
  transition: opacity 0.4s ease, border-color 0.4s ease;
}
.demo-thumb.is-on {
  opacity: 1;
  border-color: var(--accent);
}
.demo-thumb img {
  display: block;
  width: 100%;
  height: auto;
}

/* Every slide is drawn square, so the stack holds that shape and they sit on
   top of one another; only the one marked is-on shows. */
.demo-slides {
  flex: 1;
  position: relative;
  /* Four by five, the shape the hero's slides are drawn at: a square one
     beside the rail could not fill a panel taller than it is wide. */
  aspect-ratio: 4 / 5;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.demo-slides picture {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.6s ease;
}
.demo-slides picture.is-on {
  opacity: 1;
}
.demo-slides img {
  display: block;
  width: 100%;
  height: 100%;
}
/* The scan the panel opens on: demo.js draws a contact sheet of photographs
   over the slides, a line reads down it, the photographs gather into a stack,
   and the stack gives way to the first slide. Staged by class rather than by
   one long keyframe table, because it plays once and then is gone — the loop
   scan-cropper's hero runs needs the percentages; this does not. */
.demo-scan {
  position: absolute;
  inset: 0;
  background: var(--surface);
  transition: opacity 0.55s ease;
}
.demo-scan.is-done {
  opacity: 0;
}
.pw-scene {
  display: block;
  width: 100%;
  height: 100%;
}

/* A photograph on the sheet. It turns and shrinks about its own middle, so
   the distances demo.js works out are centre to centre. */
.pw-tile {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 1.05s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s ease;
}
.pw-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1;
}
/* Traced rather than switched on, so the mark follows the line that is
   reading it. `pathLength` makes one unit the whole way round whatever the
   shape measures. */
.pw-trace {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.is-reading .pw-trace {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.45s ease-out;
  transition-delay: var(--read);
}
.pw-sweep {
  fill: var(--accent);
  opacity: 0;
}
.is-reading .pw-sweep {
  animation: pw-sweep 1.5s linear both;
}
@keyframes pw-sweep {
  0% {
    transform: translateY(0);
    opacity: 0;
  }
  4% {
    opacity: 0.85;
  }
  92% {
    opacity: 0.85;
  }
  100% {
    transform: translateY(497px);
    opacity: 0;
  }
}

/* Every photograph on to the same spot, each leaving a little after the one
   before, which is what makes it read as a stack being gathered rather than a
   grid collapsing. */
.is-gathering .pw-tile {
  transform: translate(var(--dx), var(--dy)) scale(1.5) rotate(var(--spin));
  transition-delay: var(--gather);
}
.is-gathering .pw-trace {
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 0.3s ease-in;
  transition-delay: 0ms;
}

/* The first slide comes up as the scan goes, rather than being revealed sitting
   there all along. */
.demo-slides.is-arriving picture.is-on {
  animation: demo-arrive 0.6s ease both;
}
@keyframes demo-arrive {
  from {
    opacity: 0.3;
    transform: scale(0.985);
  }
}
@media (prefers-reduced-motion: reduce) {
  .demo-slides picture {
    transition: none;
  }
}

/* ---- sections ----------------------------------------------------------- */

.band {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 3.5rem;
}
.band > h2 {
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  letter-spacing: -0.02em;
  margin-bottom: 2rem;
  text-wrap: balance;
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.steps li::before {
  content: counter(step);
  display: inline-grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 650;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.steps h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
.steps p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.92rem;
}

.ui {
  font-size: 0.86em;
  font-weight: 600;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  white-space: nowrap;
}

.site-foot {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 17px 24px 18px;
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}
.site-foot p {
  margin: 0;
}
.site-foot a {
  color: var(--text-dim);
}
.site-foot a:hover {
  color: var(--text);
}

/* ---- guide -------------------------------------------------------------- */

.guide {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 3rem;
  padding: 2.5rem 0 4rem;
}

.toc {
  position: sticky;
  top: 4.5rem;
  align-self: start;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
  font-size: 0.88rem;
}
.toc p {
  margin: 0 0 0.5rem;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--text-dim);
  text-decoration: none;
}
.toc a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.prose {
  max-width: 72ch;
}
.prose > header {
  margin-bottom: 2.5rem;
}
.prose > header h2 {
  font-size: clamp(1.8rem, 3.6vw, 2.4rem);
  letter-spacing: -0.025em;
  margin-bottom: 0.6rem;
}
.prose > header p {
  font-size: 1.05rem;
  color: var(--text-dim);
  margin: 0;
}
.prose section {
  padding-top: 1rem;
  margin-bottom: 2.25rem;
  scroll-margin-top: 4rem;
}
.prose section + section {
  border-top: 1px solid var(--border);
  padding-top: 2.25rem;
}
.prose h3 {
  font-size: 1.35rem;
  letter-spacing: -0.015em;
  margin-bottom: 0.75rem;
}
.prose h4 {
  font-size: 1rem;
  margin: 1.5rem 0 0.4rem;
}
.prose p {
  margin: 0 0 0.9rem;
}
.prose ul,
.prose ol {
  margin: 0 0 1rem;
  padding-left: 1.3rem;
}
.prose li {
  margin-bottom: 0.4rem;
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 1rem;
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}
.prose th,
.prose td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--border);
}
.prose th {
  font-weight: 600;
  color: var(--text-dim);
  font-size: 0.82rem;
}

.callout {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin: 0 0 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.callout p:last-child {
  margin-bottom: 0;
}

kbd {
  font-family: var(--sans);
  font-size: 0.86em;
  font-weight: 600;
  padding: 0.05em 0.4em;
  border-radius: 5px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  white-space: nowrap;
}

@media (max-width: 860px) {
  .guide {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding-top: 1.5rem;
  }
  .toc {
    position: static;
    max-height: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 0.85rem;
  }
  .toc > ol {
    columns: 2;
    column-gap: 0.5rem;
  }
}

@media (max-width: 560px) {
  .toc > ol {
    columns: 1;
  }
}

/* ---- about -------------------------------------------------------------- */

/* Who made it, laid out as on can-i-format's about page: the photo with the
   name beside it, sitting on its bottom edge; then the links with the words
   beside them, starting level. */
.about {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  grid-template-areas:
    "photo intro"
    "links text";
  column-gap: 3rem;
  row-gap: 1.5rem;
  align-items: start;
  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 0;
}
/* Cropped to a circle by the browser, so the file stays a plain square. */
.avatar {
  grid-area: photo;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border);
}
.socials {
  grid-area: links;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.1rem;
}
.socials a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
}
.socials a:hover {
  color: var(--accent-light);
}
.socials svg {
  flex: none;
}
.about-intro {
  grid-area: intro;
  align-self: end;
}
.about-intro h2 {
  font-size: 2.2rem;
  letter-spacing: -0.025em;
}
.about-text {
  grid-area: text;
  max-width: 72ch;
  /* Matches the links' top padding, so the first line sits level with the
     first link. */
  padding-top: 0.3rem;
}
.about-text p {
  margin: 0 0 0.9rem;
}
.about-cta {
  margin-top: 1.8rem;
}

@media (max-width: 760px) {
  .about {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "photo"
      "intro"
      "text"
      "links";
    padding: 2.5rem 0;
  }
  .avatar {
    width: 112px;
    height: 112px;
  }
  .about-intro h2 {
    font-size: 1.8rem;
  }
}

/* ---- narrow screens ----------------------------------------------------- */

@media (max-width: 860px) {
  .demo {
    aspect-ratio: auto;
  }
  .landing-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    padding: 2.75rem 0 2.5rem;
  }
  .landing-hero > :first-child {
    padding-top: 0;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  main {
    padding: 0 16px;
  }
  .topbar {
    padding: 0.65rem 16px;
  }
  .topbar-right {
    gap: 0.25rem;
  }
  .brand h1 {
    white-space: nowrap;
  }
}

@media (max-width: 380px) {
  .topbar .brand-mark {
    display: none;
  }
  .brand h1 {
    font-size: 0.9rem;
  }
  .topbar .button {
    padding: 0.4rem 0.65rem;
  }
}
