/* Khadeeja Salehbhai
   A paper page in brown ink, with a folio of letters, lace, stamps and jasmine. One typeface. */

@property --open { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  --paper: #f4eee2;
  --paper-2: #ece3d1;
  --ink: #3f2614;          /* brown ink */
  --ink-2: #6a4d35;
  --ink-3: #977b62;
  --rust: #9a3b26;
  --green: #2c3a22;
  --oxblood: #4f1820;
  --cream: #f6efe2;
  --gold: #c9a45c;
  --gold-light: #e8d29a;

  --serif: "EB Garamond", Georgia, "Times New Roman", serif;
  --urdu: "Noto Nastaliq Urdu", serif;
  --ease: cubic-bezier(.22,.68,.2,1);
  --shadow: 0 1px 2px rgba(50,30,15,.18), 0 10px 22px -8px rgba(50,30,15,.4), 0 28px 50px -26px rgba(50,30,15,.5);

  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .25 0 0 0 0 .15 0 0 0 0 .05 0 0 0 .16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1000' height='1000'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.004 .007' numOctaves='3' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .38 0 0 0 0 .2 0 0 0 .2 -.06'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  --weave: repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(0,0,0,.05) 0 1px, transparent 1px 3px);
  --arch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0 100 V40 C0 19 32 10 50 0 C68 10 100 19 100 40 V100Z'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font-family: var(--serif); font-size: clamp(17px, .5vw + 14px, 20px); line-height: 1.6;
  background-color: var(--paper); background-image: var(--mottle), var(--noise); background-size: 1000px, 260px;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
img, video { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: var(--gold-light); color: var(--ink); }
.skip { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--cream); padding: .5rem 1rem; }
.skip:focus { left: 8px; }
:focus-visible { outline: 1px solid var(--rust); outline-offset: 4px; }

.wrap { width: min(1100px, 100% - 3rem); margin-inline: auto; }
.label { font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; margin: 0 0 1.6rem; color: var(--ink-2); }
.label--gold { color: var(--gold); }
.rule { width: 260px; height: 14px; color: var(--ink-3); margin: 0 auto; }

.torn { -webkit-mask: url(/assets/edge-a.svg) center / 100% 100% no-repeat; mask: url(/assets/edge-a.svg) center / 100% 100% no-repeat; }

/* Jasmine watermark printed faintly into the paper; main.js drifts it a little slower than the page */
.about, .work, .contact { position: relative; overflow: hidden; }
.about > .wrap, .work > .wrap, .contact > .envelope { position: relative; z-index: 1; }
.watermark {
  position: absolute; left: var(--wx); top: var(--wy); z-index: 0; pointer-events: none;
  width: clamp(380px, 52vw, 760px); aspect-ratio: 960 / 1227;
  background: var(--ink); opacity: .055;
  transform: translateY(var(--drift, 0px)) rotate(var(--wr));
  -webkit-mask: url(/assets/img/vintage/mask-jasmine-1787.jpg) center / contain no-repeat;
  mask: url(/assets/img/vintage/mask-jasmine-1787.jpg) center / contain no-repeat luminance;
}

/* MASTHEAD */
.masthead { text-align: center; padding: 2rem 1rem 0; }
.masthead__name { text-decoration: none; letter-spacing: .32em; text-transform: uppercase; font-size: .85rem; color: var(--ink); }
.masthead__links { display: flex; justify-content: center; gap: clamp(1.2rem, 3vw, 2.6rem); list-style: none; margin: 1rem 0 0; padding: 1rem 0 0; border-top: 1px solid rgba(63,38,20,.18); width: min(560px, 100%); margin-inline: auto; }
.masthead__links a { text-decoration: none; letter-spacing: .22em; text-transform: uppercase; font-size: .7rem; color: var(--ink-2); transition: color .3s; }
.masthead__links a:hover { color: var(--rust); }

/* HERO */
.hero { padding: clamp(3rem, 7vw, 5.5rem) 1rem clamp(4rem, 8vw, 6rem); }
.hero__text { text-align: center; }
.hero__name { font-weight: 400; font-size: clamp(2.8rem, 7vw, 5.6rem); line-height: 1; letter-spacing: -.01em; margin: 0; color: var(--ink); }
.hero__urdu { font-family: var(--urdu); font-size: clamp(1.1rem, 1.8vw, 1.4rem); color: var(--ink-3); margin: .6rem 0 0; line-height: 2.2; }

.folio { position: relative; width: min(1000px, 100%); height: clamp(420px, 42vw, 560px); margin: clamp(1.5rem, 4vw, 3rem) auto 0; transition: --open .9s var(--ease); }
.folio:hover { --open: 1; }
.piece {
  position: absolute; margin: 0;
  transform: translate(calc(var(--fx) * var(--open)), calc(var(--depth) * var(--scroll, 0) * -50px)) rotate(calc(var(--r) + var(--fan) * var(--open)));
  will-change: transform;
  animation: lay-down .9s var(--ease) both; animation-delay: calc(var(--i, 0) * 130ms + 250ms);
}
/* each piece is placed on the table in turn; uses translate/scale so it composes with the transform above */
@keyframes lay-down {
  0% { opacity: 0; translate: 0 -34px; scale: 1.07; }
  60% { opacity: 1; }
  80% { scale: .985; }
  100% { opacity: 1; translate: 0 0; scale: 1; }
}
.piece--letter { left: 11%; top: 12%; width: 27%; z-index: 1; filter: drop-shadow(0 12px 16px rgba(50,30,15,.3)); }
.piece--album { right: 10%; top: 5%; width: 26%; z-index: 1; }
.piece--album img { box-shadow: var(--shadow); }.piece--jasmine { left: 22%; top: 24%; width: 22%; z-index: 2; filter: drop-shadow(0 6px 8px rgba(50,30,15,.25)); }
.piece--portrait { left: 35%; top: 0; width: 30%; z-index: 4; filter: drop-shadow(0 16px 22px rgba(50,30,15,.4)); }
.portrait__arch { background: var(--cream); padding: 12px; -webkit-mask: var(--arch) center / 100% 100% no-repeat; mask: var(--arch) center / 100% 100% no-repeat; }
.portrait__arch img { width: 100%; aspect-ratio: 3 / 4.3; object-fit: cover; object-position: 50% 22%; -webkit-mask: var(--arch) center / 100% 100% no-repeat; mask: var(--arch) center / 100% 100% no-repeat; }
.piece--lace { left: 24%; top: 66%; width: 52%; height: 17%; object-fit: cover; object-position: 50% 100%; z-index: 5; filter: drop-shadow(0 3px 3px rgba(50,30,15,.25)); }
.piece--stamp { left: 58%; top: 5%; width: 10%; z-index: 6; filter: drop-shadow(0 4px 5px rgba(50,30,15,.3)); }
.piece--chintz { right: 15%; top: 60%; width: 19%; z-index: 3; filter: drop-shadow(0 8px 10px rgba(50,30,15,.3)); }

/* ABOUT */
.about { padding: clamp(4rem, 9vw, 7rem) 0; border-top: 1px solid rgba(63,38,20,.15); }
.about__grid { display: grid; grid-template-columns: 6fr 5fr; gap: clamp(2.5rem, 7vw, 6rem); align-items: center; }
.lead { font-size: clamp(1.4rem, 2.3vw, 1.9rem); line-height: 1.35; margin: 0 0 1.8rem; max-width: 30ch; }
.prose p { margin: 0 0 1.1rem; color: var(--ink-2); max-width: 58ch; }
.index { margin: 2.2rem 0 0; }
.index > div { display: grid; grid-template-columns: 7rem 1fr; gap: 1rem; padding: .9rem 0; border-top: 1px solid rgba(63,38,20,.18); }
.index dt { font-size: .68rem; letter-spacing: .24em; text-transform: uppercase; color: var(--ink-3); padding-top: .3rem; }
.index dd { margin: 0; color: var(--ink-2); font-size: .95rem; }

.snaps { position: relative; height: clamp(380px, 40vw, 500px); }
.snap {
  position: absolute; left: 50%; top: 50%; width: 52%; margin: 0; padding: 10px 10px 26px; background: var(--cream); box-shadow: var(--shadow);
  transform: translate(-50%, -50%) translate(var(--sx), var(--sy)) rotate(var(--r)); transition: transform .8s var(--ease);
}
.snap img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; filter: sepia(.15) saturate(.9); }
.snaps:hover .snap { transform: translate(-50%, -50%) translate(calc(var(--sx) * 1.5), calc(var(--sy) * 1.4)) rotate(calc(var(--r) * 1.5)); }
.snap:hover { z-index: 3; }
.corners {
  position: absolute; inset: 4px 4px 20px; pointer-events: none; z-index: 1;
  background:
    linear-gradient(135deg, #3a2414 0 13px, transparent 13px) top left / 24px 24px no-repeat,
    linear-gradient(225deg, #3a2414 0 13px, transparent 13px) top right / 24px 24px no-repeat,
    linear-gradient(45deg, #3a2414 0 13px, transparent 13px) bottom left / 24px 24px no-repeat,
    linear-gradient(315deg, #3a2414 0 13px, transparent 13px) bottom right / 24px 24px no-repeat;
  opacity: .82;
}
/* RESULTS */
.results {
  position: relative; padding: clamp(6rem, 11vw, 8rem) 0 clamp(4.5rem, 8vw, 6rem); text-align: center; color: var(--cream); overflow: hidden;
  background-color: var(--green); background-image: var(--noise), var(--weave);
}
.lace-edge { position: absolute; left: 0; right: 0; top: -2px; height: 74px; background: url(/assets/img/scrap/lace.png) 0 100% / auto 150px repeat-x; filter: drop-shadow(0 3px 3px rgba(0,0,0,.3)); }
.spark { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); pointer-events: none; }
.results__grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.result { padding: 0 1.2rem; border-left: 1px solid rgba(201,164,92,.3); }
.result:first-child { border-left: 0; }
.result__num { font-size: clamp(2.6rem, 4.6vw, 3.8rem); line-height: 1; margin: 0 0 .8rem; font-variant-numeric: lining-nums; }
.result__label { margin: 0 auto; font-size: .92rem; line-height: 1.45; color: rgba(246,239,226,.72); max-width: 17ch; }

/* WORK */
.work { padding: clamp(5rem, 10vw, 8rem) 0; }
.section-head { text-align: center; margin-bottom: 2.6rem; }
.section-head .label { margin-bottom: .8rem; }
.entries { list-style: none; margin: 0; padding: 0; border-top: 1px solid rgba(63,38,20,.25); }
.entry { border-bottom: 1px solid rgba(63,38,20,.25); }
.entry__row {
  width: 100%; display: grid; grid-template-columns: 5rem 1fr minmax(0, 17rem) 3.5rem; gap: 1.2rem; align-items: baseline;
  padding: 1.5rem 0; background: none; border: 0; text-align: left; cursor: pointer; transition: padding .45s var(--ease), background .45s;
}
.entry__row:hover { padding-left: .8rem; background: rgba(255,255,255,.25); }
.entry__no { font-size: .68rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); }
.entry__main { display: flex; flex-direction: column; }
.entry__title { font-size: clamp(1.35rem, 2.2vw, 1.7rem); line-height: 1.2; color: var(--ink); }
.entry__meta { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); margin-top: .3rem; }
.entry__stat { font-size: .95rem; color: var(--ink-2); font-style: italic; }
.entry__open { justify-self: end; font-size: .68rem; letter-spacing: .22em; text-transform: uppercase; color: var(--rust); border-bottom: 1px solid currentColor; line-height: 1.4; }

/* Detail dialog */
.detail { border: 0; padding: 0; background: transparent; width: min(760px, 94vw); max-height: 92vh; }
.detail::backdrop { background: rgba(40,26,14,.78); }
.detail[open] { animation: rise .45s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } }
.detail__inner { position: relative; max-height: 92vh; overflow: auto; padding: clamp(2rem, 5vw, 3.4rem); background-color: var(--paper); background-image: var(--noise); }
.detail__inner::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(63,38,20,.2); pointer-events: none; }
.detail__close { position: absolute; top: 1.4rem; right: 1.4rem; width: 2.4rem; height: 2.4rem; border: 1px solid rgba(63,38,20,.3); border-radius: 50%; background: none; cursor: pointer; font-size: 1.3rem; line-height: 1; z-index: 1; }
.detail__close:hover { background: var(--ink); color: var(--paper); }
.detail .label { margin-bottom: .8rem; }
.detail h3 { font-weight: 400; font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.1; margin: 0 0 1.4rem; }
.detail p { color: var(--ink-2); }
.detail__media { margin: 0 0 1.6rem; padding: 1.4rem; background: var(--green); display: grid; place-items: center; }
.detail__media video { max-height: 58vh; width: auto; border-radius: 16px; border: 4px solid #141a10; background: #fff; }
.detail__list { list-style: none; margin: 1.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 1.6rem; }
.detail__list li { padding: .8rem 0; border-top: 1px solid rgba(63,38,20,.2); font-size: .95rem; line-height: 1.45; color: var(--ink-2); }
.detail__list strong { display: block; font-weight: 400; font-size: 1.7rem; color: var(--rust); line-height: 1.15; }

/* EXPERIENCE */
.experience { position: relative; overflow: hidden; padding: clamp(5rem, 10vw, 8rem) 0; background-color: var(--paper-2); background-image: var(--mottle), var(--noise); background-size: 1000px, 260px; }
.experience__jasmine { position: absolute; right: -6%; bottom: -8%; width: clamp(220px, 26vw, 380px); transform: rotate(-24deg); opacity: .95; pointer-events: none; filter: drop-shadow(0 8px 10px rgba(50,30,15,.2)); }
.experience__grid { position: relative; display: grid; grid-template-columns: 3fr 8fr; gap: clamp(2rem, 6vw, 5rem); }
.section-head--side { text-align: left; }
.ledger { list-style: none; margin: 0; padding: 0; max-width: 680px; }
.ledger li { display: grid; grid-template-columns: 8rem 1fr; gap: 1.2rem; padding: 1.2rem 0; border-top: 1px solid rgba(63,38,20,.2); }
.ledger li:first-child { border-top: 0; padding-top: 0; }
.ledger__years { font-style: italic; color: var(--ink-3); }
.ledger h3 { font-weight: 400; font-size: 1.28rem; line-height: 1.25; margin: 0 0 .15rem; }
.ledger p { margin: 0; color: var(--ink-2); font-size: .95rem; }

/* CONTACT: an old airmail envelope */
.contact { padding: clamp(5rem, 10vw, 8rem) 1rem; }
.envelope {
  position: relative; width: min(760px, 100%); min-height: 360px; margin: 0 auto; padding: clamp(2rem, 5vw, 3.2rem);
  background-color: #efe4cc; background-image: var(--mottle), var(--noise); background-size: 1000px, 260px;
  border: 10px solid transparent;
  border-image: repeating-linear-gradient(-45deg, #9a2f25 0 14px, #f3ead8 14px 22px, #2b4570 22px 36px, #f3ead8 36px 44px) 10;
  box-shadow: var(--shadow); transform: rotate(-1deg);
}
.envelope__stamps { position: absolute; top: 1.4rem; right: 1.4rem; width: min(300px, 46%); height: 150px; }
.envelope__stamp { position: absolute; z-index: 1; top: 0; width: 34%; filter: drop-shadow(0 3px 4px rgba(50,30,15,.25)); }
.envelope__stamp--a { right: 0; transform: rotate(4deg); width: 44%; }
.envelope__stamp--b { right: 40%; top: 10px; transform: rotate(-3deg); width: 40%; }
.postmark {
  position: absolute; left: -12%; top: 18px; width: 92%; color: rgba(63,38,20,.55); z-index: 3;
  transform: rotate(-8deg) scale(1.35); opacity: 0;
  transition: opacity .3s ease-out .75s, transform .45s cubic-bezier(.3,1.35,.5,1) .75s;
}
/* pressed onto the stamps once the envelope has arrived */
.envelope.is-in .postmark { transform: rotate(-8deg) scale(1); opacity: 1; }
.envelope__body { position: absolute; left: clamp(2rem, 6vw, 3.6rem); bottom: clamp(2rem, 5vw, 3rem); right: 2rem; }
.contact__links { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; }
.contact__links a { font-size: clamp(1.4rem, 3vw, 2rem); text-decoration: none; border-bottom: 1px solid rgba(154,59,38,.45); line-height: 1.3; transition: color .3s, border-color .3s; }
.contact__links a:hover { color: var(--rust); border-color: var(--rust); }
.contact__email { opacity: 0; transition: opacity .8s var(--ease); }
.contact__email.is-shown { opacity: 1; }

/* FOOTER */
.footer { background: var(--oxblood); color: rgba(246,239,226,.7); font-size: .85rem; }
.footer__inner { padding: 2rem 0 2.4rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .6rem 2rem; }
.footer p { margin: 0; }
.credits summary { cursor: pointer; letter-spacing: .2em; text-transform: uppercase; font-size: .66rem; }
.credits p { max-width: 62ch; margin-top: .6rem; }

/* Reveal */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.envelope.reveal.is-in { transform: rotate(-1deg); }

/* Responsive */
@media (max-width: 900px) {
  .about__grid, .experience__grid { grid-template-columns: 1fr; }
  .results__grid { grid-template-columns: 1fr 1fr; row-gap: 2.6rem; }
  .result:nth-child(3) { border-left: 0; }
  .entry__row { grid-template-columns: 1fr auto; }
  .entry__no { grid-column: 1 / -1; }
  .entry__stat { grid-column: 1; }
  .entry__open { grid-row: 2; grid-column: 2; }
  .experience__jasmine { opacity: .35; }
  .folio { height: 120vw; max-height: 640px; }
  .piece--letter { left: 0; top: 30%; width: 44%; }
  .piece--album { right: 0; top: 34%; width: 40%; }
  .piece--portrait { left: 22%; width: 56%; }
  .piece--jasmine { left: 2%; top: 4%; width: 36%; }
  .piece--lace { left: 8%; width: 84%; top: auto; bottom: 10%; height: 12%; }
  .piece--stamp { left: 70%; top: 2%; width: 17%; }
  .piece--chintz { right: 2%; top: auto; bottom: 0; width: 34%; }
}
@media (max-width: 600px) {
  .masthead__links li:nth-child(3) { display: none; }
  .ledger li, .index > div { grid-template-columns: 1fr; gap: .2rem; }
  .envelope { min-height: 420px; }
  .envelope__stamps { width: 60%; }}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
  .postmark { opacity: 1; transform: rotate(-8deg); }
}
