/* Self hosted, so nothing is fetched from a third party and no visitor's
   address is handed to one. Recia and Tabular, Indian Type Foundry, under the
   ITF Free Font Licence. 93 KB for the five files. */
@font-face{font-family:Recia;src:url(fonts/recia-400.woff2) format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:Recia;src:url(fonts/recia-500.woff2) format('woff2');font-weight:500;font-style:normal;font-display:swap}
@font-face{font-family:Recia;src:url(fonts/recia-700.woff2) format('woff2');font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:Tabular;src:url(fonts/tabular-400.woff2) format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:Tabular;src:url(fonts/tabular-500.woff2) format('woff2');font-weight:500;font-style:normal;font-display:swap}

/* ---------------------------------------------------------------
   The astrolabe.

   Palette, five and no sixth, all of it taken off the rendered brass:
     #EAE3D4  plate paper      the ground of everything read
     #241D12  ink              every heading and every paragraph
     #B8862F  brass            the one accent, on the instrument only
     #14110C  night            the band the instrument sits in
     #FFFFFF  unpainted        what is left where nothing is painted

   Type: Recia over Tabular, both Indian Type Foundry, self hosted.
   The relationship in one clause: contrast in construction, a broad
   Renaissance book serif for the argument against a mechanical
   monospace for every figure the instrument produces. Recia is the
   register of a printed treatise from the instrument's own century;
   Tabular is drawn for columns of numbers, which is half this page.

   Sizes, written before building, six:
     12.5 / 15 / 18 / 26 / 40 / 62
   Radius: 0.
----------------------------------------------------------------- */

:root{
  --paper:#EAE3D4;
  --ink:#241D12;
  --brass:#B8862F;
  --night:#14110C;

  --s-fine:12.5px;
  --s-small:15px;
  --s-body:17.5px;
  --s-h3:26px;
  --s-h2:40px;
  --s-h1:clamp(34px,5.6vw,62px);

  --serif:"Recia",Georgia,"Times New Roman",serif;
  --mono:"Tabular",ui-monospace,SFMono-Regular,Consolas,monospace;

  --gut:clamp(20px,5vw,44px);
  --band:clamp(64px,9vw,124px);
}

*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
@media (prefers-reduced-motion:no-preference){ html{scroll-behavior:smooth} }
[id]{scroll-margin-top:24px}

html,body{overflow-x:clip}
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font:400 var(--s-body)/1.6 var(--serif);
}
h1,h2,p,dl,ul,figure{margin:0}
img{max-width:100%;height:auto;display:block}
b,strong{font-weight:600}
i{font-style:italic}

.wrap{width:min(1180px,100% - var(--gut)*2);margin-inline:auto}

.skip{position:absolute;left:-9999px;top:0;z-index:9;background:var(--brass);
  color:var(--night);padding:12px 18px;font:600 var(--s-small)/1 var(--mono)}
.skip:focus{left:0}
:focus-visible{outline:2px solid var(--brass);outline-offset:3px}

.js-only{display:none}
.js .js-only{display:block}

/* ---------- hero ------------------------------------------------ */

.hero{padding:clamp(26px,3vw,38px) 0 clamp(26px,3vw,40px)}
/* the object runs off the right edge rather than squeezing the argument
   into a 36 character measure. html,body clip, so nothing scrolls sideways. */
.hero > .wrap{
  width:auto;max-width:none;margin:0;
  padding-left:max(var(--gut), calc(50vw - 590px));
  padding-right:0;
}
.hero-fig{margin-right:calc(var(--gut) * -1.6)}
.hero-grid{
  display:grid;
  grid-template-columns:minmax(0,.845fr) minmax(0,1.42fr);
  gap:clamp(24px,4vw,54px);
  align-items:center;
}
h1{
  font-size:var(--s-h1);
  font-weight:400;
  line-height:1.04;
  letter-spacing:-.014em;
  max-width:15ch;
}
.lede{margin-top:26px;max-width:50ch;font-size:var(--s-body)}
.meta{
  margin-top:30px;display:flex;flex-wrap:wrap;gap:10px 26px;
  font:400 var(--s-fine)/1 var(--mono);letter-spacing:.1em;text-transform:uppercase;
}
.hero-fig{
  position:relative;
  /* the object is square, so capping its width by viewport height is what
     keeps the whole first screen inside a real laptop window */
  max-width:min(100%, 82vh);
  margin-inline-start:auto;
}
.hero-fig .poster{width:100%;transition:opacity .8s ease}
.hero-fig.ready .poster{opacity:0}
.hero-fig .viewer{
  position:absolute;inset:0;width:100%;height:100%;
  opacity:0;transition:opacity .9s ease;
}
.hero-fig.ready .viewer{opacity:1;cursor:grab}
.hero-fig.ready .viewer:active{cursor:grabbing}
.hero-ctl{display:none;margin-top:28px;align-items:center;gap:16px}
.js .hero-ctl{display:flex}
.hint{font:400 var(--s-fine)/1 var(--mono);letter-spacing:.08em;text-transform:uppercase;opacity:.75}

/* ---------- reading bands --------------------------------------- */

.band{padding:var(--band) 0}
.band + .band{border-top:1px solid rgba(36,29,18,.17)}
.two{
  display:grid;
  grid-template-columns:minmax(0,20ch) minmax(0,1fr);
  gap:clamp(22px,5vw,84px);
  align-items:start;
}
h2{font:500 var(--s-h3)/1.15 var(--serif);letter-spacing:-.008em}
.aside{margin-top:14px;font-size:var(--s-small);max-width:30ch}
.col-body{max-width:64ch}
.col-body p + p{margin-top:1.05em}

.eq{
  margin:1.1em 0 !important;
  font:400 var(--s-h3)/1.2 var(--mono);
  letter-spacing:.01em;
}

.defs{margin-top:34px;border-top:1px solid rgba(36,29,18,.17)}
.defs > div{
  display:grid;grid-template-columns:minmax(0,9em) minmax(0,1fr);
  gap:clamp(12px,3vw,30px);padding:15px 0;
  border-bottom:1px solid rgba(36,29,18,.17);
}
dt{font:600 var(--s-small)/1.45 var(--mono);letter-spacing:.02em}
dd{margin:0;font-size:var(--s-small)}

.plate-fig{margin-bottom:8px}
.plate-fig img{width:min(700px,100%)}
figcaption{margin-top:18px;font-size:var(--s-small);max-width:52ch}

/* ---------- the instrument -------------------------------------- */

.instrument{background:var(--night);color:var(--paper);padding:var(--band) 0}
.instrument h2{color:var(--paper)}
.inst-grid{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(0,1fr);
  gap:clamp(30px,5vw,80px);
  align-items:center;
}
.stage-wrap{display:flex;justify-content:center}
.stage{
  position:relative;
  width:min(600px,88vw);
  aspect-ratio:1;
  overflow:hidden;          /* the layers turn; their boxes must not escape */
}
.layer{position:absolute;inset:0;width:100%;height:100%}
.rete,.rule{will-change:transform}
@media (prefers-reduced-motion:no-preference){
  .rete,.rule{transition:transform .55s cubic-bezier(.25,.7,.3,1)}
  .stage.running .rete,.stage.running .rule{transition:transform .12s linear}
}
.marks{overflow:visible}
.marks circle{fill:var(--brass)}
.marks .halo{fill:none;stroke:var(--brass);stroke-width:.018}

.inst-side .aside{color:var(--paper);max-width:44ch;margin-top:16px}

.controls{display:none;margin-top:30px;gap:16px;max-width:34em}
.js .controls{display:grid}
.ctl{display:block}
.ctl > span{
  display:block;margin-bottom:8px;
  font:400 var(--s-fine)/1 var(--mono);letter-spacing:.1em;text-transform:uppercase;
}
.ctl > span b{color:var(--brass);font-weight:600;letter-spacing:.02em}
input[type=date]{
  font:400 var(--s-small)/1 var(--mono);
  color:var(--paper);background:transparent;
  border:1px solid rgba(234,227,212,.36);border-radius:0;padding:11px 12px;
  color-scheme:dark;
}
input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:24px;
  background:transparent;cursor:pointer;
}
input[type=range]::-webkit-slider-runnable-track{height:1px;background:rgba(234,227,212,.36)}
input[type=range]::-moz-range-track{height:1px;background:rgba(234,227,212,.36)}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;width:14px;height:22px;margin-top:-11px;
  background:var(--brass);border:0;border-radius:0;
}
input[type=range]::-moz-range-thumb{width:14px;height:22px;background:var(--brass);border:0;border-radius:0}

.ctl-row{display:flex;gap:10px;flex-wrap:wrap}
.btn{
  font:600 var(--s-small)/1 var(--mono);letter-spacing:.02em;
  padding:13px 18px;border-radius:0;cursor:pointer;
  background:transparent;color:var(--paper);border:1px solid rgba(234,227,212,.36);
  transition:background .18s ease,border-color .18s ease;
}
.btn:hover{background:rgba(234,227,212,.09);border-color:var(--paper)}
.btn.on{background:var(--brass);border-color:var(--brass);color:var(--night)}

.readout{display:none;margin-top:32px;border-top:1px solid rgba(234,227,212,.24)}
.js .readout{display:block}
.readout > div{
  display:flex;justify-content:space-between;gap:18px;align-items:baseline;
  padding:10px 0;border-bottom:1px solid rgba(234,227,212,.14);
}
.readout dt{font:400 var(--s-fine)/1.4 var(--mono);letter-spacing:.08em;
  text-transform:uppercase;color:var(--paper)}
.readout dd{font:600 var(--s-small)/1.4 var(--mono);font-variant-numeric:tabular-nums;
  color:var(--paper)}
.readout dd.up{color:var(--brass)}

.check{
  display:none;
  margin-top:22px;max-width:46ch;
  font:400 var(--s-fine)/1.7 var(--mono);letter-spacing:.02em;
  color:var(--paper);
}

/* ---------- colophon -------------------------------------------- */

.colophon{background:var(--night);color:var(--paper);padding:var(--band) 0}
.colophon h2{color:var(--paper)}
.colophon p + p{margin-top:1.05em}
.src-head{
  margin-top:40px !important;padding-bottom:11px;
  border-bottom:1px solid rgba(234,227,212,.24);
  font:400 var(--s-fine)/1 var(--mono);letter-spacing:.1em;text-transform:uppercase;
}
.src{list-style:none;margin:0;padding:0}
.src li{padding:12px 0;border-bottom:1px solid rgba(234,227,212,.14);font-size:var(--s-small)}
.fine{font-size:var(--s-small);max-width:54ch}

/* ---------- reveal ---------------------------------------------- */

.js .check{display:block}

.js .reveal{opacity:0;transform:translateY(15px);
  transition:opacity .8s ease,transform .8s cubic-bezier(.2,.7,.3,1)}
.js .reveal.in{opacity:1;transform:none}

/* ---------- narrow ---------------------------------------------- */

@media (max-width:1000px){
  .hero-grid,.inst-grid{grid-template-columns:minmax(0,1fr)}
  .inst-side{order:-1}
  .two{grid-template-columns:minmax(0,1fr);gap:18px}
}
@media (max-width:560px){
  :root{--s-body:17px}
  .defs > div{grid-template-columns:minmax(0,1fr);gap:5px}
  .readout > div{flex-wrap:wrap;gap:4px}
}

@media (forced-colors:active){
  .btn{border:1px solid ButtonText}
  .marks circle,.marks .halo{fill:CanvasText;stroke:CanvasText}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.001ms !important;transition-duration:.001ms !important}
}

/* ---------- the back -------------------------------------------- */

.back .stage{overflow:hidden}
.alidade{will-change:transform}
@media (prefers-reduced-motion:no-preference){
  .alidade{transition:transform .45s cubic-bezier(.25,.7,.3,1)}
}
.marks .day{fill:var(--brass)}
.marks .dayring{fill:none;stroke:var(--brass);stroke-width:.012}
.marks .sight{stroke:var(--brass);stroke-width:.008;stroke-dasharray:.03 .022}

/* ---------- the projection figure -------------------------------- */

.proj{margin:34px 0 8px}
.proj svg{width:100%;max-width:660px;overflow:visible}
.projlab.small{font-size:.082px}
.projline{fill:none;stroke:var(--ink);stroke-width:.011}
.projfaint{fill:none;stroke:var(--ink);stroke-width:.007;opacity:.42}
.projray{fill:none;stroke:var(--brass);stroke-width:.014}
.projdrop{fill:none;stroke:var(--brass);stroke-width:.008;stroke-dasharray:.04 .03}
.projdot{fill:var(--brass)}
.projdotink{fill:var(--ink)}
.projlab{font:400 .105px/1 var(--mono);fill:var(--ink)}
.projlab.acc{fill:var(--brass);font-weight:600}
.proj-ctl{margin-top:18px;max-width:34em}
.proj-ctl .ctl > span{color:var(--ink)}
.proj-ctl .ctl > span b{color:var(--ink)}
.proj-ctl input[type=range]::-webkit-slider-runnable-track{background:rgba(36,29,18,.3)}
.proj-ctl input[type=range]::-moz-range-track{background:rgba(36,29,18,.3)}
.proj-read{
  margin-top:12px;
  font:400 var(--s-fine)/1.7 var(--mono);
  max-width:52ch;
}

/* ---------- the object in the browser ---------------------------- */

.viewer-band{
  background:var(--night);
  color:var(--paper);
  padding:var(--band) 0;
}
.viewer-band h2{color:var(--paper)}
.viewer-band .aside{color:var(--paper);max-width:40ch}
.viewer-grid{
  display:grid;
  grid-template-columns:minmax(0,.85fr) minmax(0,1.25fr);
  gap:clamp(28px,5vw,72px);
  align-items:center;
}
.viewer-stage{position:relative}
.viewer{
  width:100%;
  aspect-ratio:1;
  max-height:76vh;
  margin-inline:auto;
  cursor:grab;
  opacity:0;
  transition:opacity .9s ease;
}
.viewer-stage.ready .viewer{opacity:1}
.viewer:active{cursor:grabbing}
.viewer canvas{display:block;width:100%;height:100%}

.viewer-load{
  position:absolute;left:50%;bottom:6%;transform:translateX(-50%);
  width:min(200px,46%);height:1px;
  background:rgba(36,29,18,.18);
  transition:opacity .5s ease;
}
.viewer-load span{
  display:block;height:1px;width:calc(var(--p,0) * 100%);
  background:var(--brass);
  transition:width .3s ease;
}
.viewer-load.gone{opacity:0;pointer-events:none}
.viewer-band .controls{margin-top:26px}

@media (max-width:1000px){
  .viewer-grid{grid-template-columns:minmax(0,1fr)}
  .viewer-side{order:-1}
}


/* the buttons were drawn for the dark bands; on paper they need ink */
.hero-ctl .btn,
.proj-ctl .btn,
.band .btn{
  color:var(--ink);
  border-color:rgba(36,29,18,.4);
}
.hero-ctl .btn:hover,
.band .btn:hover{background:rgba(36,29,18,.07);border-color:var(--ink)}
.hero-ctl .btn[aria-pressed="true"]{background:var(--brass);border-color:var(--brass);color:var(--night)}
.hint{color:var(--ink)}

.js .hero-ctl{display:flex}          /* later than .js .controls, so it wins */
.hero-ctl .btn{flex:0 0 auto}

/* ---------- getting about a long page ---------------------------- */

.progress{
  position:fixed;left:0;top:0;height:2px;width:0;
  background:var(--brass);
  z-index:20;
  transition:width .12s linear;
}

.anchors{
  border-top:1px solid rgba(36,29,18,.17);
  border-bottom:1px solid rgba(36,29,18,.17);
  background:var(--paper);
}
.anchors .wrap{
  display:flex;flex-wrap:wrap;gap:6px clamp(18px,3vw,42px);
  padding:16px 0;
}
.anchors a{
  font:400 var(--s-fine)/1.5 var(--mono);
  letter-spacing:.09em;text-transform:uppercase;
  color:var(--ink);
  text-decoration:none;
  border-bottom:1px solid transparent;
  transition:border-color .2s ease;
}
.anchors a:hover,.anchors a:focus-visible{border-bottom-color:var(--brass)}
.anchors a[aria-current="true"]{border-bottom-color:var(--ink)}

[id]{scroll-margin-top:26px}

/* one plate, edge to edge, because the engraving deserves to be seen large */
.bleed{margin:0;background:var(--night)}
.bleed img{
  display:block;width:100%;height:auto;
  max-height:80vh;object-fit:cover;object-position:center;
}
.bleed figcaption{
  color:var(--paper);
  max-width:none;                 /* the general figcaption caps at 52ch */
  width:min(1180px,100% - var(--gut)*2);
  margin:22px auto 0;
  padding-bottom:clamp(40px,5vw,64px);
}
.bleed figcaption span{display:block;max-width:56ch}
