/* Oscar Miller — shared styles for every page */

/* ABC Areal (Dinamo, free fonts licence — see docs/decisions/0001-areal-font.md).
   The variable WOFF2 exactly as supplied; the licence forbids converting it.
   One file covers Regular to Bold and has the dark-mode axis used below. */
@font-face {
  font-family: "ABC Areal";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("assets/fonts/ABCArealVariable.woff2") format("woff2");
}

/* The HOME tag's face on the old site. Cut down to H, O, M and E (under 1KB). */
@font-face {
  font-family: "Source Code Pro";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/source-code-pro-home.woff2") format("woff2");
}

:root {
  --ink: #000;
  --paper: #fff;
  --font: "ABC Areal", Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  overflow-x: hidden;
  /* Lighter than Areal Regular (its lightest weight) without changing letter widths —
     see docs/decisions/0002-lighter-areal.md. DRKM is Areal's dark-mode axis, which
     thins strokes (~5% less ink, every device); thin rendering adds ~9% on Macs. */
  font-variation-settings: "DRKM" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------
   Home — on desktop, a scaled copy of the old 1024px canvas.
   Positions are the old pixel values as % of 1024 (or of the
   canvas height, 631), so the layout scales with the window.
   Like the old site, the canvas sits in the middle of the window.
   --------------------------------------------------------------- */

.home-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
}

.home {
  position: relative;
  width: min(1024px, 100%);
  margin: 0 auto;
  aspect-ratio: 1024 / 631;
  container-type: inline-size;
}

.home__drawing {
  position: absolute;
  left: 7.81%;   /* 80px */
  top: 7.45%;    /* 47px */
  width: 66.8%;  /* 684px */
  z-index: 1;
}

.home__signature {
  position: absolute;
  left: -30.96%; /* -317px — runs off the left edge on purpose */
  top: -23.77%;  /* -150px */
  width: 84.86%; /* 869px */
  z-index: 2;
  pointer-events: none;
}

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

.home__nav li {
  position: absolute;
  z-index: 3;
  font-size: 3.91cqw; /* 40px at 1024 */
  line-height: 1;
}

/* Each link fills its old button box, which turns red on hover */
.home__nav a {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border-radius: 5px;
}
.home__nav a:hover {
  background: rgba(200, 0, 0, 0.8);
  color: #fff;
  text-decoration: none;
}

/* left, top, width, height of the old buttons: 638,72 350x72 / 552,169 364x71 /
   610,265 364x71 / 638,401 350x65 / 695,494 350x62 */
.home__nav li:nth-child(1) { left: 62.3%;  top: 11.41%; width: 34.18%; height: 7.03cqw; }
.home__nav li:nth-child(2) { left: 53.91%; top: 26.78%; width: 35.55%; height: 6.93cqw; }
.home__nav li:nth-child(3) { left: 59.57%; top: 42%;    width: 35.55%; height: 6.93cqw; }
.home__nav li:nth-child(4) { left: 62.3%;  top: 63.55%; width: 34.18%; height: 6.35cqw; }
.home__nav li:nth-child(5) { left: 67.87%; top: 78.29%; width: 34.18%; height: 6.05cqw; }

/* Phones: stack signature, drawing, then the links */
@media (max-width: 700px) {
  .home-page { display: block; }
  .home {
    aspect-ratio: auto;
    padding: 16px;
  }
  /* :nth-child(n) matches every link but is as specific as the desktop
     per-link rules above, so it switches off their sizes too */
  .home__drawing,
  .home__signature,
  .home__nav li:nth-child(n) {
    position: static;
    width: auto;
    height: auto;
  }
  /* relative, not static, so it stays on top of the drawing as on desktop */
  .home__signature { position: relative; inset: auto; width: 80%; margin-bottom: -18%; }
  .home__nav { margin-top: 24px; }
  .home__nav li { font-size: 28px; line-height: 1.8; }
  .home__nav a { display: inline-flex; padding: 0 8px; margin-left: -8px; }
}

/* ---------------------------------------------------------------
   Inner pages — the old 1024px column, with the tilted HOME tag
   in its top-left corner. Sizes are the old pixel values.
   --------------------------------------------------------------- */

.page {
  position: relative;
  width: min(1024px, 100%);
  margin: 0 auto;
  padding: 110px 16px 96px;
}

/* One spot on every page. -40px clears Desktop Publishing's first line; on windows
   too narrow for that it slides in to 0 so the star is never cut off. */
.home-tag {
  position: absolute;
  left: clamp(-40px, (1024px - 100vw) / 2, 0px);
  top: 46px;
  width: 184px;
  height: 51px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgb(167, 100, 0);
  color: #fff;
  border-radius: 5px;
  transform: rotate(-30deg);
  font-family: "Source Code Pro", ui-monospace, Menlo, monospace;
  font-size: 30px;
  font-weight: 400;
  z-index: 10;
}
.home-tag:hover { background: rgba(82, 41, 0, 0.8); text-decoration: none; }
/* Rounded star: the round stroke join softens the points, like the old icon */
.home-tag svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 3;
  stroke-linejoin: round;
}

/* Intro text. Line breaks copy the old site, one .line each. Areal at 88% of the old
   font size gives the old line widths. Each page's block sat in its own spot, so the
   modifiers below set the old top (as margin from the 110px padding) and centre. */
.lead {
  position: relative;
  margin: 0;
  text-align: center;
  font-size: 33.5px; /* old 38px */
  font-weight: 400;
  line-height: 31px;
}
.lead .line { display: block; }

.lead--photography { font-size: 37px; line-height: 36px; margin-top: 18px; left: 103px; } /* old 42px; top 128 */
.lead--drawings { font-size: 35px; line-height: 36px; margin-top: -51px; left: 23px; }    /* old 41px; top 59 */
.lead--desktoppublishing { margin-top: -37px; left: 3px; } /* top 73 */
.lead--bio { margin-top: 10px; left: 6px; }                /* top 120 */

.page__photo {
  width: 631px;
  aspect-ratio: 631 / 480;
  object-fit: cover;
  margin: 47px auto 0; /* old top 384 */
}

.pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 53px;
  max-width: 886px;
  margin: 55px auto 0; /* old top 252 */
}

/* Photography — the old hand-placed collage. Each .shot carries its old
   left/top/width/height (px on the 1024 canvas) as --x --y --w --h; the
   collage starts at old top 300 and ends at 4296, and scales with the window.
   Crops the old site applied are inline on the img. */
.collage {
  position: relative;
  margin: 64px -16px 0; /* -16px: span the whole 1024 canvas, not the padded column */
  aspect-ratio: 1024 / 3996;
}
.shot {
  position: absolute;
  overflow: hidden;
  left: calc(var(--x) / 1024 * 100%);
  top: calc((var(--y) - 300) / 3996 * 100%);
  width: calc(var(--w) / 1024 * 100%);
  height: calc(var(--h) / 3996 * 100%);
}
.shot img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}

/* Drawings — the old page as one canvas, from old top 150 to 9060. Legend,
   pricing and every work sit at their old positions. --u is one old pixel,
   so everything scales with the window. Works carry their picture box
   (--x --y --w --h) and caption box (--tx --ty --tw); crops are inline. */
.canvas {
  /* One old pixel. The collage runs from -283 to 1,255 on the old 1,024 canvas, so it is
     scaled around the page's centre: as drawn from 1,622 px windows up, and smaller below
     that rather than cut at the window's edges (#4). */
  --u: min(1px, 100vw / 1024, (100vw - 32px) / 1590);
  position: relative;
  margin: 19px -16px 0;
  height: calc(8910 * var(--u));
  container-type: inline-size;
}

/* Status dots — colours from the old site's legend */
.dot {
  display: inline-block;
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  vertical-align: -0.05em;
}
.dot--sold { background: rgb(232, 15, 0); }
.dot--nfs { background: rgb(255, 238, 0); }
.dot--available { background: rgb(0, 123, 255); }

.key { position: absolute; inset: 0; }

/* Legend: labels centred on old x 138; each dot at its own old spot, staggered */
.legend { list-style: none; margin: 0; padding: 0; }
.legend li { position: absolute; left: calc(50% - 512 * var(--u)); width: calc(1024 * var(--u)); height: 0; top: calc((var(--ty) - 150) * var(--u)); }
.legend .dot {
  position: absolute;
  left: calc(var(--dx) * var(--u));
  top: calc((var(--dy) - var(--ty)) * var(--u));
  width: calc(26 * var(--u));
  height: calc(26 * var(--u));
}
.legend .label {
  position: absolute;
  left: calc(38 * var(--u));
  width: calc(200 * var(--u));
  transform: translateY(-50%);
  text-align: center;
  font-size: calc(33.5 * var(--u)); /* old 38px */
  line-height: 1;
}

/* Pricing: centred on old x 857, heading centred on old y 174 */
.pricing {
  position: absolute;
  left: calc(50% + 45 * var(--u)); /* old 557 */
  top: calc(6.5 * var(--u));
  width: calc(600 * var(--u));
  text-align: center;
  font-size: calc(29 * var(--u)); /* old 33px */
  line-height: calc(37.5 * var(--u));
}
.pricing h2 { margin: 0; font-size: calc(35 * var(--u)); font-weight: 700; line-height: 1; } /* old 40px */
.pricing p { margin: calc(14 * var(--u)) 0 0; }

.work {
  position: absolute;
  margin: 0;
  left: calc(50% + (var(--x) - 512) * var(--u));
  top: calc((var(--y) - 150) * var(--u));
  width: calc(var(--w) * var(--u));
  height: calc(var(--h) * var(--u));
}
.frame { position: absolute; inset: 0; overflow: hidden; }
.frame img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
}
/* Captions stay smaller than the old ones (Sam's call), centred in the old caption box */
.work figcaption {
  position: absolute;
  left: calc((var(--tx) - var(--x)) * var(--u));
  top: calc((var(--ty) - var(--y)) * var(--u));
  width: calc(var(--tw) * var(--u));
  text-align: center;
  font-size: calc(22 * var(--u));
  font-weight: 400;
  line-height: 1.2;
}
/* Raised to the top-right of the title, like the old site */
.work .dot { width: 0.65em; height: 0.65em; vertical-align: 0.55em; margin-left: 0.15em; }

/* Contact — the old layout from old top 153 to 468, scaling like Drawings
   (--u is one old pixel). Signature at -62,153; each row is the old 64x50
   icon box at x 460 with its text starting at the old x (--tx). */
.contact {
  --u: calc(100cqw / 1024);
  position: relative;
  margin: 43px -16px 0;
  aspect-ratio: 1024 / 315;
  container-type: inline-size;
}
.contact__signature {
  position: absolute;
  left: calc(-62 * var(--u));
  top: 0;
  width: calc(480 * var(--u));
  max-width: none;
}
.contact__list { list-style: none; margin: 0; padding: 0; }
.contact__list li {
  position: absolute;
  left: 0;
  width: 100%;
  top: calc((var(--y) - 153) * var(--u));
  height: calc(50 * var(--u));
}
.contact__icon {
  position: absolute;
  left: calc(460 * var(--u));
  width: calc(64 * var(--u));
  height: calc(50 * var(--u));
}
.contact__list a {
  position: absolute;
  left: calc(var(--tx) * var(--u));
  top: 50%;
  transform: translateY(-50%);
  font-size: calc(33.5 * var(--u)); /* old 38px */
  line-height: 1;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .page { padding-top: 124px; }
  .home-tag { left: -10px; top: 30px; transform: rotate(-30deg) scale(0.75); }
  /* Text wraps naturally on phones: lines run on, old positions switched off */
  .lead { font-size: 24px; line-height: 1.15; margin-top: 0; left: 0; }
  .lead .line { display: inline; }
  .lead--drawings { font-size: 20px; }
  .collage { aspect-ratio: auto; margin: 32px 0 0; display: flex; flex-direction: column; gap: 40px; }
  .shot { position: relative; left: auto; top: auto; width: 100%; height: auto; aspect-ratio: var(--w) / var(--h); }
  .page__photo { width: 100%; margin-top: 32px; }
  .pair { grid-template-columns: 1fr; gap: 16px; margin-top: 32px; }
  /* Drawings: everything back in the flow, one work per row */
  .canvas { aspect-ratio: auto; height: auto; margin: 24px 0 0; display: flex; flex-direction: column; gap: 40px; }
  .key { position: static; display: flex; flex-direction: column; align-items: center; gap: 24px; }
  .legend { font-size: 20px; line-height: 1.5; }
  .legend li { position: static; height: auto; }
  .legend .dot { position: static; width: 0.8em; height: 0.8em; margin-right: 16px; vertical-align: -0.05em; }
  .legend .label { position: static; width: auto; transform: none; font-size: inherit; line-height: inherit; }
  .pricing { position: static; width: auto; font-size: 18px; line-height: 1.2; }
  .pricing h2 { font-size: 22px; }
  .pricing p { margin-top: 8px; }
  .work { position: static; width: auto; height: auto; }
  .frame { position: relative; aspect-ratio: var(--w) / var(--h); }
  .work figcaption { position: static; width: auto; margin-top: 12px; font-size: 17px; }
  .contact { aspect-ratio: auto; margin: 0; }
  .contact__signature { position: static; width: 70%; max-width: 100%; }
  .contact__list li { position: static; width: auto; height: auto; display: flex; align-items: center; gap: 12px; padding: 10px 0; }
  .contact__icon { position: static; width: 40px; height: 31px; }
  .contact__list a { position: static; transform: none; font-size: 20px; }
}
