/* Personal: the whole page is set in Shihan Hand, a typeface made from four of every letter he wrote,
   held to a three-line copybook ruling. The page opens in the sand; then a notebook sheet comes up over it,
   ruled on the same three lines the font was built on, and everything after is written on that sheet.
   Loaded after home.css, only on /personal/. */
@font-face{font-family:"Shihan Hand";src:url(fonts/shihan-hand.woff2) format("woff2");font-weight:100 900;font-display:block}
/* the same letters with their line box fixed, so a line of text sits exactly on one ruled line:
   baseline at .6 of the pitch, x-height (470) on the dashed line, capitals and ascenders (760) on the top line */
@font-face{font-family:"Shihan Hand Ruled";src:url(fonts/shihan-hand.woff2) format("woff2");font-weight:100 900;font-display:block;ascent-override:120%;descent-override:80%;line-gap-override:0%}

/* every rule on the site draws its type from --sans, so the hand takes over the header, menu and footer too.
   The handwriting is small on its body, so the interface text is lifted to the x-height it was sized for */
body.personal{font-synthesis:none;--sans:"Shihan Hand","Geist",ui-sans-serif,system-ui,sans-serif;--hand:"Shihan Hand","Geist",ui-sans-serif,system-ui,sans-serif;--ruled:"Shihan Hand Ruled","Shihan Hand","Geist",ui-sans-serif,system-ui,sans-serif}
.personal .top,.personal .menu,.personal .foot,.personal .skip{font-size-adjust:ex-height .6}
.personal :is(h1,h2,p,a,span,button,input,li){letter-spacing:0}
.personal .mark{text-transform:none;font:400 22px/20px var(--hand);letter-spacing:0}
.personal .mark-short{font-weight:400;font-size:15px;line-height:18px}
.personal .nav a{font-size:var(--t-3);color:var(--ink-2)}
@media (min-width:861px){.personal .nav a{font-size:var(--t-4)}}
.personal .foot-mark{font-weight:400}

/* the title is written, left to right, the way a pen would */
@property --pen{syntax:"<percentage>";inherits:false;initial-value:125%}
.personal .h1{font:400 clamp(84px,9.4vw,150px)/.9 var(--hand);color:rgb(var(--cw));padding:.12em .14em .3em;margin:-.12em -.14em -.3em;letter-spacing:-.025em;
  -webkit-mask-image:linear-gradient(100deg,#000 calc(var(--pen) - 16%),transparent var(--pen));mask-image:linear-gradient(100deg,#000 calc(var(--pen) - 16%),transparent var(--pen));
  animation:pen 1.9s cubic-bezier(.42,.05,.28,1) .25s both}
@keyframes pen{from{--pen:0%}to{--pen:125%}}
.personal .h1 .c{animation:none}
.personal .hero .lede{font:400 clamp(28px,2.8vw,42px)/1.22 var(--hand);color:var(--ink-2);max-width:min(12em,100%);text-wrap:pretty}
/* the note sits under the lede, clear of the sand name */
.personal .hero-in .hero-note{position:static;margin-top:28px;font:400 clamp(20px,1.5vw,23px)/1.4 var(--hand);color:var(--ink-2);max-width:21em;text-align:left;text-wrap:pretty}
html:not(.gl) .personal .hero-note{display:block}

/* the site's veil darkens the left for a text column; here the sand is even on both sides of the notebook */
html.gl .personal .veil{background:radial-gradient(120% 95% at 50% 48%,transparent 52%,rgb(var(--ck)/.8) 100%)}
html.gl .personal .veil::before,html.gl .personal .veil::after{display:none}

/* ================= the notebook ================= */
/* colour roles for the sheet: paper, the ruling, the pen, a sand-coloured ink, and pencil */
.personal{--paper:#15120E;--rule:rgb(216 192 150/.24);--rule-mid:rgb(216 192 150/.16);--pen:#EEE6D6;--pen-sand:#E3AA68;--graphite:#958C7E;--edge:rgb(var(--cw)/.07);
  --grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .94 0 0 0 0 .86 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E")}
html[data-theme="light"] .personal{--paper:#F3EDE0;--rule:rgb(64 88 140/.26);--rule-mid:rgb(64 88 140/.17);--pen:#1D2535;--pen-sand:#A8722F;--graphite:#6E6A62;--edge:rgb(20 20 22/.07);
  --grain:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .18 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E")}

/* --P is the pitch of the ruling. Every block on the sheet is a whole number of pitches tall */
.sheet{--P:60px;--pad:clamp(20px,7vw,104px);position:relative;z-index:0;isolation:isolate;width:min(1120px,100% - 2*var(--gut));margin:0 auto;
  padding:calc(2*var(--P)) var(--pad) calc(2*var(--P) + 24px);color:var(--pen);font:400 calc(var(--P)/2)/var(--P) var(--ruled);font-synthesis:none}
.sheet .defs{position:absolute;width:0;height:0;overflow:hidden}
/* the paper: three lines to every pitch (top, dashed middle, baseline), a little tooth, and a torn foot */
.paper{position:absolute;inset:0;z-index:-1;border-radius:6px 6px 0 0;box-shadow:inset 0 0 0 1px var(--edge);
  background:
    linear-gradient(to bottom,transparent calc(var(--P)*.2167),var(--rule) 0 calc(var(--P)*.2167 + 1px),transparent 0 calc(var(--P)*.6),var(--rule) 0 calc(var(--P)*.6 + 1px),transparent 0) 0 0/100% var(--P),
    var(--grain) 0 0/220px 220px,
    var(--paper);
  clip-path:polygon(0 0,100% 0,100.00% calc(100% - 13.0px),97.34% calc(100% - 20.2px),95.83% calc(100% - 28.9px),91.65% calc(100% - 11.7px),90.10% calc(100% - 4.2px),86.53% calc(100% - 20.3px),85.44% calc(100% - 24.6px),81.52% calc(100% - 21.0px),80.78% calc(100% - 26.6px),77.75% calc(100% - 7.7px),74.87% calc(100% - 17.6px),73.34% calc(100% - 4.4px),70.69% calc(100% - 15.4px),68.20% calc(100% - 16.5px),65.88% calc(100% - 9.0px),63.47% calc(100% - 5.9px),59.13% calc(100% - 13.5px),57.05% calc(100% - 7.1px),54.54% calc(100% - 22.5px),51.57% calc(100% - 7.3px),50.59% calc(100% - 8.9px),48.22% calc(100% - 11.9px),45.60% calc(100% - 4.3px),41.60% calc(100% - 18.0px),40.52% calc(100% - 13.2px),37.24% calc(100% - 10.6px),35.38% calc(100% - 6.1px),31.56% calc(100% - 21.1px),29.13% calc(100% - 18.8px),27.13% calc(100% - 23.1px),25.23% calc(100% - 20.7px),21.69% calc(100% - 21.8px),20.62% calc(100% - 19.8px),16.52% calc(100% - 21.4px),15.33% calc(100% - 21.7px),13.35% calc(100% - 18.0px),9.94% calc(100% - 15.5px),6.95% calc(100% - 19.0px),5.18% calc(100% - 6.4px),2.00% calc(100% - 10.0px),0.00% calc(100% - 11.5px))}
.paper::after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(90deg,var(--rule-mid) 0 6px,transparent 6px 12px);
  -webkit-mask:linear-gradient(to bottom,transparent calc(var(--P)*.3667),#000 0 calc(var(--P)*.3667 + 1px),transparent 0) 0 0/100% var(--P);
  mask:linear-gradient(to bottom,transparent calc(var(--P)*.3667),#000 0 calc(var(--P)*.3667 + 1px),transparent 0) 0 0/100% var(--P)}
html[data-theme="light"] .sheet::before{content:"";position:absolute;inset:0 0 calc(3*var(--P));z-index:-2;border-radius:6px;box-shadow:0 40px 90px -50px rgb(0 0 0/.45),0 2px 10px rgb(60 40 10/.06)}

/* type on the ruling. A line box of n pitches puts the baseline at n·P/2 + .2·size, so each size is nudged onto a ruled baseline */
.sheet :where(h2,p,figcaption,.specimen){--n:1;--fs:calc(var(--P)/2);font:400 var(--fs)/calc(var(--n)*var(--P)) var(--ruled);letter-spacing:0;color:var(--pen);max-width:none;
  position:relative;top:calc(var(--n)*var(--P)/2 - .4*var(--P) - .2*var(--fs));text-wrap:pretty}
/* headings stay on one line, all at one size: the longest, "Four of every letter", sets it when the column is narrow */
.sheet h2{--n:2;--fs:min(calc(1.6*var(--P)),calc((min(1120px,100vw - 2*var(--gut)) - 2*var(--pad))/8.6));letter-spacing:-.02em;white-space:nowrap}
.sheet .w{max-width:28em}
.sheet .gr,.sheet p .gr{--fs:max(20px,calc(.42*var(--P)));color:var(--graphite)}
.sheet p .gr{font-size:var(--fs);line-height:1;top:0}
.sheet a{color:inherit;text-decoration:underline;text-decoration-color:var(--pen-sand);text-decoration-thickness:2px;text-underline-offset:calc(var(--P)*.1);transition:color var(--d-2)}
.sheet a:hover{color:var(--pen-sand)}
.sheet a:focus-visible{outline:2px solid var(--pen-sand);outline-offset:4px;border-radius:2px}

/* the label: who it belongs to, in a plate drawn by hand */
.plate{position:relative;display:block;width:fit-content;max-width:100%;padding:0 30px}
.plate .plate-line{position:absolute;left:0;top:calc(var(--P)*.04);width:100%;height:calc(100% - var(--P)*.08);overflow:visible}
.plate p .gr{margin-right:.35em}
.plate path{vector-effect:non-scaling-stroke;--d:clamp(0,var(--e,1)/.35,1)}

/* contents: one ruled line a row, dotted leaders, page numbers in his hand */
.index{margin-top:calc(2*var(--P));max-width:24em}
.index ol{margin:0;padding:0;list-style:none}
.index a{display:flex;align-items:baseline;gap:14px;height:var(--P);text-decoration:none;color:var(--pen);font:400 calc(var(--P)/2)/var(--P) var(--ruled)}
.index a i{flex:1;min-width:24px;height:0;border-bottom:3px dotted var(--graphite);opacity:.55;transform:translateY(-3px)}
.index a b{font-weight:400;color:var(--graphite);min-width:1ch;text-align:right}
.index a:hover span,.index a:focus-visible span{color:var(--pen-sand)}
.index a:focus-visible{outline:2px solid var(--pen-sand);outline-offset:2px}

/* the entries */
.entry{margin-top:calc(2*var(--P))}
.flow.sheet-sand{position:absolute;inset:0;z-index:-3;padding:0;pointer-events:none}
.entry > * + *{margin-top:var(--P)}
.entry > h2 + *{margin-top:0}
.entry .w + .w{margin-top:0}
.entry .note{max-width:34em}
/* text and figure side by side: the text keeps to the ruling (personal.js centres it by whole pitches), the figure centres on it */
.pair{display:grid;grid-template-columns:minmax(16em,1fr) minmax(0,auto);column-gap:var(--P);align-items:start}
.pair > figure{align-self:center;min-height:calc(4*var(--P));display:flex;align-items:center}
.pair > div > * + *{margin-top:var(--P)}

/* ink: line drawings that draw themselves as the page is read */
.ink{margin:0;color:var(--pen)}
.ink svg{display:block;overflow:visible}
.ink .tr{filter:url(#tremble)}
.sheet svg path{--d:clamp(0,(var(--e,1) - var(--s,0))/.6,1);fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;
  stroke-dasharray:1px 2px;stroke-dashoffset:calc((1 - var(--d))*1.02px)}
.sheet svg .thin{stroke-width:1.1}
.sheet svg .faint{opacity:.5}
.sheet svg .sand{stroke:var(--pen-sand)}
.sheet svg .mist{stroke-width:3;stroke:var(--pen-sand)}
.sheet svg .star{stroke-width:3.4}
/* words inside a drawing are written a little ahead of the lines around them, so a title is never left half-written mid-screen */
.sheet svg text{--d:clamp(0,(var(--e,1) - .5*var(--s,0))/.45,1);fill:currentColor;stroke:none;font-family:"Shihan Hand";clip-path:inset(-40% calc((1 - var(--d))*104%) -40% -4%)}
.sheet svg text.wr{font-size:30px}
.sheet svg text.gr{font-size:21px;fill:var(--graphite)}
.sheet svg text.big{font-size:118px}
.sheet svg text.ttl{font-size:20px}
.sheet .nw{white-space:nowrap}
.sheet svg text.ttl-y{font-size:18px}
.sheet svg text.sand{fill:var(--pen-sand)}
.sheet svg .strike{--d:clamp(0,(var(--e,1) - .45)/.25,1);stroke-width:3}
.sheet svg text.late{--d:clamp(0,(var(--e,1) - .65)/.3,1)}
.sheet svg text.gr.late{--d:clamp(0,(var(--e,1) - .7)/.25,1)}

/* fiction: two titles, underlined twice, gathered by a brace */
.titles{display:grid;grid-template-columns:auto 40px minmax(0,16em);column-gap:calc(var(--P)*.4);align-items:center;margin-top:var(--P)}
.titles .title{position:relative;width:fit-content}
.titles .tt p{--n:2;--fs:calc(1.3*var(--P));letter-spacing:-.01em}
.titles .ul{position:absolute;left:-2%;width:104%;height:24px;top:calc(1.6*var(--P) + 4px);overflow:visible}
.titles .ul path{stroke-width:2;vector-effect:non-scaling-stroke}
.titles .brace{height:calc(4*var(--P))}
.titles .brace svg{width:40px;height:100%}
.titles .brace path{stroke-width:1.8;vector-effect:non-scaling-stroke}
.titles figcaption{align-self:start;margin-top:var(--P)}   /* one pitch down, not centred, so it keeps to the ruling however many lines it takes */

/* perfume */
.fig-perfume svg{height:calc(5*var(--P));width:auto}
.fig-perfume .haze{fill:var(--pen-sand);stroke:none;opacity:calc(var(--p,1)*.16);transform-box:fill-box;transform-origin:30% 80%;transform:scale(calc(.3 + var(--p,1)*.9));filter:url(#soft)}
.fig-perfume .sil{stroke-width:1.2}
.fig-perfume .s1{opacity:.7}.fig-perfume .s2{opacity:.5}.fig-perfume .s3{opacity:.3}
html[data-theme="light"] .fig-perfume .sil{stroke-width:1.4}
html[data-theme="light"] .fig-perfume .s1{opacity:.85}html[data-theme="light"] .fig-perfume .s2{opacity:.6}html[data-theme="light"] .fig-perfume .s3{opacity:.4}
.fig-perfume .stain{fill:var(--pen-sand);stroke:none;opacity:calc(var(--d)*.24);--d:clamp(0,(var(--e,1) - .3)/.4,1);stroke-dasharray:none}

/* the Prophet on perfume, peace be upon him: quoted lines in his hand, each source in pencil beneath */
.hadith{margin-top:var(--P)}
.hadith blockquote{margin:0;padding:0 0 0 1.4em}
.hadith > * + *{margin-top:var(--P)}
.hadith .q{max-width:26em;text-indent:-.45em}
.hadith .note{max-width:34em}
@media (max-width:860px){.hadith blockquote{padding-left:.9em}}

/* documentaries: a strip of film that drifts along as you read */
.fig-film{position:relative;height:calc(4*var(--P));margin-inline:calc(-1*var(--pad));overflow:hidden}
.fig-film .reel{position:absolute;left:50%;top:0;height:100%;transform:translateX(calc(-50% + (.5 - var(--p,.5))*26%*var(--done,1)));will-change:transform}
.fig-film .sp{stroke-dasharray:none;opacity:var(--d)}
.fig-film svg{height:100%;width:auto}

/* books */
.fig-books{height:calc(4*var(--P));display:flex;align-items:center}
.fig-books svg{height:100%;width:auto;max-width:96%;margin-left:4%}   /* on a narrow desk it scales down inside its four pitches rather than run past the sheet */

/* AI */
.fig-doors svg{height:calc(5*var(--P));width:auto}

/* four of every letter */
.sheet .specimen{--n:2;--fs:calc(1.3*var(--P));word-spacing:.45em;max-width:none}

/* borrow my hand: the input is a ruled line of the sheet, written at twice the size */
.line{position:relative;height:calc(2*var(--P));max-width:16em}
.hand-in{position:absolute;inset:0;width:100%;height:calc(2*var(--P));margin:0;padding:0;border:0;border-radius:0;background:transparent;color:var(--pen);
  font:400 var(--P)/calc(2*var(--P)) var(--ruled);top:calc(.4*var(--P));caret-color:var(--pen-sand);outline:none;-webkit-appearance:none;appearance:none}
.hand-in::placeholder{color:var(--graphite);opacity:.8}
.line::after{content:"";position:absolute;left:0;right:0;top:calc(1.6*var(--P));height:1px;background:var(--pen);opacity:.45;transition:background var(--d-2),opacity var(--d-2),height var(--d-2)}
.line:focus-within::after{height:2px;background:var(--pen-sand);opacity:1}
.hand-in:focus-visible{outline:none}

/* below the torn foot: the visitor's word, in sand, with nothing over it */
.flow.sand-word{height:44vh;height:44svh;padding:0;pointer-events:none}
/* the word streams straight into the dunes: they rise to meet the band, with no formless beat between */
.personal .flow.enddunes{margin-top:-18vh;margin-top:-18svh}
html:not(.gl) .flow.sand-word{display:none}

/* below a wide desk the figure goes under its text, centred, so the line of text keeps its length */
@media (max-width:1366px){.fig-perfume .sil,html[data-theme="light"] .fig-perfume .sil{stroke-width:1.8}}
@media (max-width:1366px) and (min-width:861px){.pair{grid-template-columns:minmax(0,1fr)}.pair>figure{order:0;margin-top:var(--P);justify-self:center}.fig-perfume svg,.fig-doors svg{height:calc(5*var(--P))}}

/* ---------- phones ---------- */
@media (max-width:860px){
  .personal .h1{font-size:clamp(44px,calc((100vw - 48px)/4.7),124px)}
  .personal .hero .lede{font-size:clamp(25px,7vw,32px)}
  .personal .hero{min-height:74vh;min-height:74svh}
  .personal .mark{font-size:20px}
  .sheet{--P:52px;--pad:16px;width:100%;padding-top:calc(1*var(--P));margin-top:-14vh;margin-top:-14svh}
  .paper{border-radius:0}
  .sheet h2{--n:1;--fs:min(calc(.92*var(--P)),calc((100vw - 32px)/8.4))}
  .plate{width:100%;padding:0 18px}
  .index{max-width:none}
  .entry{margin-top:calc(2*var(--P))}
  .pair{grid-template-columns:minmax(0,1fr)}
  .pair > figure{order:-1;margin-bottom:var(--P);justify-content:center}
  .fig-perfume svg{height:calc(5*var(--P));max-width:100%}
  .fig-books svg{height:auto;width:100%;max-height:calc(3*var(--P));margin:0}
  .fig-books{height:calc(3*var(--P));display:flex;align-items:center}
  .fig-doors svg{height:calc(6*var(--P));max-width:100%}
  .titles{grid-template-columns:auto 30px;column-gap:14px}
  .titles figcaption{grid-column:1/-1;margin-top:var(--P)}
  .titles .tt p{--fs:calc(.86*var(--P))}
  .titles .brace svg{width:30px}
  .sheet .specimen{--fs:calc(.9*var(--P));word-spacing:.35em}
  .line{max-width:none}
  .flow.sand-word{height:50vh;height:50svh}
}

/* reduced motion: everything is drawn and written */
@media (prefers-reduced-motion:reduce){.personal .h1{animation:none}.sheet{--p:1}.fig-film .reel{transform:translateX(-50%)}}
/* the closing wordmark, in his hand, sized to fit the line it sits on */
/* his name runs 8.3em at no tracking; at 1/8.5 of the line, plus a little room on the right, the last z is painted whole and stays inside the gutter */
.personal .foot-mark{font-size-adjust:none;font-size:min(15rem,calc((100vw - 2*var(--gut)) / 8.5));line-height:1.05;margin-left:0;width:max-content;padding-right:.1em}
.personal .foot>*{min-width:0;max-width:100%}
/* the footer links, in his wider hand: one row while all eight fit; on a narrow desk two rows of four; on a phone three rows of 3/3/2
   at a size the hand can be read at. Zero-height flex items break the lines, and the site's order is kept */
.personal .foot ul{column-gap:16px}
@media (min-width:900px) and (max-width:980px){
  .personal .foot ul{display:flex;flex-wrap:wrap;column-gap:22px}
  .personal .foot ul::before{content:"";order:1;flex-basis:100%;height:0}
  .personal .foot li{margin-right:0}
  .personal .foot li:nth-child(n+5){order:2}}
@media (max-width:899px){
  .personal .foot ul{display:flex;flex-wrap:wrap;column-gap:14px;row-gap:0;font-size:clamp(15px,calc(15px + (100vw - 360px)/30),16px)}
  .personal .foot li{margin:0}
  .personal .foot li a{display:inline-flex;align-items:center;min-height:44px}
  .personal .foot ul::before,.personal .foot ul::after{content:"";flex-basis:100%;height:0}
  .personal .foot li:nth-child(-n+3){order:0}
  .personal .foot ul::before{order:1}
  .personal .foot li:nth-child(n+4):nth-child(-n+6){order:2}
  .personal .foot ul::after{order:3}
  .personal .foot li:nth-child(n+7){order:4}
  .personal .foot ul a::after{inset:0 -6px}   /* each link's 44px target stays inside the 14px gaps */
  .personal .foot-line{font-size:14px;color:var(--ink-3)}}   /* one step under the links */
@media print{.paper{clip-path:none;background:none}.sheet{width:auto;padding:0}.flow.sand-word{display:none}}

/* 861–1199: the caption under the two titles needs the full measure, and the handwritten name's ink runs past its box */
@media (min-width:861px) and (max-width:1199px){
  .titles{grid-template-columns:auto 40px}
  .titles figcaption{grid-column:1/-1;margin-top:var(--P)}
}
@media (min-width:481px){.personal .mark-full{display:inline-block;width:max-content;padding-right:.2em}}
@media (min-width:861px) and (max-width:1023px){.personal .top:not(.scrolled) .mark-full{opacity:0}.personal .top:not(.scrolled) .mark-short{opacity:1;transform:none}}
