/* morningside. website styles */

/*
  Brand typeface. Euclid Circular A is a licensed font. Once Morningside has web font files
  for it, put them in assets/fonts/ and uncomment this block. Until then, Figtree stands in.

@font-face { font-family: "Euclid Circular A"; src: url("../fonts/EuclidCircularA-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Euclid Circular A"; src: url("../fonts/EuclidCircularA-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
*/

:root {
  --ground: #F8EEEC;
  --paper: #FFFEFB;
  --text: #45188C;       /* text inside the books (RGB 69, 24, 140) */
  --text-soft: #7352A8;  /* lighter purple for small supporting text */
  --brand-font: "Euclid Circular A", "Figtree", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--brand-font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100vh; outline: none; }

.btn {
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; margin: 0; padding: 0;
  font: inherit; color: inherit; cursor: pointer; text-align: inherit;
}
.btn:focus-visible, a:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.brand { font-family: var(--brand-font); font-weight: 300; letter-spacing: -0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.screen { min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; overflow: clip; animation: ms-fade .35s ease both; }
@keyframes ms-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes ms-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes ms-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes ms-draw-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* text inside the books is purple; the logo, page numbers, and close button stay navy */
.who-main, .about-main, .bib-main, .black-main { color: var(--text); }

/* ---------- Landing ---------- */
.cover { width: 100%; min-height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.cover-mark { font-size: clamp(30px, 3vw, 44px); color: var(--text); transition: transform .14s cubic-bezier(.4,0,.2,1), opacity .14s ease; }
.cover.leaving .cover-mark { transform: translateY(-28px); opacity: 0; }

/* ---------- Book stack ---------- */
/* The stack fills one screen. On short screens (a phone on its side), each book keeps a comfortable minimum
   height and the page scrolls instead of squeezing the books. On narrow screens the stack starts below the logo. */
.stack-screen { position: relative; min-height: 100vh; min-height: 100svh; height: auto;
  --stack-pt: clamp(12px, 2.5vh, 28px); --stack-pb: clamp(12px, 2.5vh, 28px); --unit-min: .72px;
  padding: var(--stack-pt) 16px var(--stack-pb); align-items: center; overflow-x: clip; overflow-y: visible; animation: none; }
.home-link { position: absolute; top: 14px; left: clamp(16px, 4vw, 48px); z-index: 9; min-height: 44px; display: inline-flex; align-items: center; font-size: 22px; color: var(--text); text-decoration: none; }
.stack { width: 100%; max-width: 580px; display: flex; flex-direction: column;
  height: calc(100vh - var(--stack-pt) - var(--stack-pb)); height: calc(100svh - var(--stack-pt) - var(--stack-pb));
  min-height: calc(var(--stack-units, 800) * var(--unit-min)); }
@media (max-width: 960px) { .stack-screen { --stack-pt: 66px; } }
@media (max-height: 500px) { .stack-screen { --unit-min: 1px; } } /* phones on their side: full-size books, page scrolls */
.spine {
  flex-basis: 0; flex-shrink: 1; min-height: 16px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; line-height: 1; white-space: nowrap; padding: 0 14px; text-align: center;
}
.spine { transition: transform .28s cubic-bezier(.2,.7,.2,1); }
/* center spine titles on the letters themselves (capital height to baseline), whatever the font's built-in spacing */
.spine { text-box: trim-both cap alphabetic; }
.spine:focus-visible { position: relative; z-index: 2; transform: translateX(8px); }
/* a book eases slightly out of the stack under the cursor */
@media (hover: hover) { .spine:hover { transform: translateX(8px); } }
.k-sans { font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 700; }
.k-cond { font-family: "Archivo Narrow", "Arial Narrow", sans-serif; font-weight: 700; }
.k-brand { font-family: var(--brand-font); font-weight: 300; }

/* books fall in from the top with a small side-to-side sway */
@keyframes ms-fall {
  0% { transform: translate(0, -110vh); }
  20% { transform: translate(5px, -105.6vh); }
  40% { transform: translate(-5px, -92.4vh); }
  55% { transform: translate(4px, -76.7vh); }
  70% { transform: translate(-4px, -56.1vh); }
  82% { transform: translate(3px, -36vh); }
  92% { transform: translate(-2px, -16.9vh); }
  100% { transform: translate(0, 0); }
}
.fall { animation: ms-fall .9s linear backwards; }
@keyframes ms-pull { 0% { transform: translateX(8px); } 35% { transform: translateX(9%); } 100% { transform: translateX(70%); opacity: 0; } }
.pull-out { animation: ms-pull .4s cubic-bezier(.5,0,.75,0) forwards; }
@keyframes ms-slot { 0% { transform: translateX(60%); opacity: 0; } 70% { transform: translateX(-2%); opacity: 1; } 100% { transform: translateX(0); } }
.slot-in { animation: ms-slot .55s cubic-bezier(.2,.7,.2,1) .05s backwards; }

/* ---------- Shared top and bottom bars ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px clamp(16px, 4vw, 48px) 0; }
.mark-sm { font-size: 22px; color: var(--text); min-height: 44px; display: inline-flex; align-items: center; }
.bottombar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 4px clamp(16px, 4vw, 48px) 18px; min-height: 66px; }
.pager { display: flex; align-items: center; gap: 2px; }
.navbtn { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; color: var(--text); text-underline-offset: 5px; text-align: center; }
.navbtn:disabled { opacity: .35; cursor: default; }
.pg-sel { text-decoration: underline; text-decoration-thickness: 1px; }
.close { justify-self: end; }

/* ---------- Two-column pages (who we are, stories) ---------- */
.who-main { flex: 1; display: flex; justify-content: center; padding: 12px clamp(16px, 4vw, 48px); }
.who { width: 100%; max-width: 1160px; display: flex; flex-wrap: wrap; min-height: 540px; }
.who-col { flex: 1 1 360px; min-width: 0; padding: clamp(20px, 3vw, 40px) clamp(20px, 4vw, 64px); display: flex; flex-direction: column; font-size: clamp(17px, 1.4vw, 20px); line-height: 1.5; }
.who-col p { margin: 0 0 1em; max-width: 34ch; animation: ms-up .6s cubic-bezier(.2,.7,.2,1) backwards; }
.who-text { margin: auto 0; }
.who-text p:nth-child(1) { animation-delay: .2s; }
.who-text p:nth-child(2) { animation-delay: .32s; }
.who-right p:nth-child(1) { animation-delay: .44s; }
.who-right p:nth-child(2) { animation-delay: .56s; }
.who-right { position: relative; justify-content: center; }
.who-right::before, .st-col.pg-right::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--text);
  transform-origin: 50% 0; animation: ms-draw .9s cubic-bezier(.2,.7,.2,1) .15s backwards;
}
.who-title { font-size: 24px; margin: 0; font-weight: 300; }

/* stories: a white open book with text on both pages */
.st-who { background-color: var(--paper); box-shadow: 0 22px 44px -26px rgba(70,35,45,.35), 0 1px 3px rgba(0,0,0,.06); }
.st-col { font-size: clamp(15px, 1.15vw, 17px); line-height: 1.6; }
.st-col p { max-width: 42ch; animation: none; }
.st-col.pg-right { position: relative; }
.st-title { margin: 0 0 16px; font-size: clamp(22px, 2vw, 28px); font-weight: 600; line-height: 1.2; max-width: 24ch; }
.stf-sans .st-col { font-family: var(--brand-font); font-weight: 300; }
.st-dek { margin: 0 0 1em; font-size: clamp(19px, 1.6vw, 24px); font-weight: 600; line-height: 1.35; }
.st-quote { margin: 0 0 1.2em; max-width: 36ch; font-weight: 600; }
.st-company { color: var(--text); font-size: 14px; font-weight: 400; }
.st-hook { font-weight: 600; }
.st-sec { margin: 0 0 .6em; font-size: inherit; font-weight: 600; line-height: 1.4; }
.st-visit { margin: 0 0 .45em; }
.st-visit a { color: var(--text); text-underline-offset: 4px; }

/* who are we: one column of text on the left, like a page of a book */
.about-main { flex: 1; display: flex; align-items: center; padding: 24px clamp(16px, 4vw, 48px); }
.about-text { max-width: 36em; font-size: clamp(15px, 1.2vw, 17px); line-height: 1.4; }
.about-text p { margin: 0 0 1.3em; animation: ms-up .6s cubic-bezier(.2,.7,.2,1) backwards; }
.about-text p:last-child { margin-bottom: 0; }
.about-text p:nth-child(1) { animation-delay: .1s; }
.about-text p:nth-child(2) { animation-delay: .2s; }
.about-text p:nth-child(3) { animation-delay: .3s; }
.about-text p:nth-child(4) { animation-delay: .4s; }

/* open-book layout (matches the page-layout design): sizes come from the page script */
.st-book { flex: none; flex-wrap: nowrap; min-height: 0; max-width: none; box-shadow: none; }
.st-book .st-col { flex: 1 1 50%; min-width: 0; padding: var(--padt) var(--padx) var(--padb);
  font-family: var(--brand-font); font-size: var(--fs); font-weight: 300; line-height: 1.6;
  hyphens: auto; -webkit-hyphens: auto; }
.st-book .st-col p { max-width: none; margin: 0 0 1.6em; }
.st-book .st-col em { font-style: italic; }
.st-book .st-title { margin: 0 0 1.25em; max-width: none; font-size: var(--tfs); font-weight: 600; line-height: 1.25; }
.st-book .st-dek { margin: 0; font-size: var(--tfs); font-weight: 600; line-height: 1.25; hyphens: manual; }
.st-book .st-sign { margin-top: auto; }
.st-book .st-quote { margin: 0; max-width: none; font-style: normal; font-weight: 600; }
.st-book .st-col .st-company { margin: 0; font-size: inherit; font-weight: 400; color: var(--text); }
.st-book .st-hook { font-weight: 600; }
.st-book .st-hook, .st-book .st-sec, .st-book .st-quote, .st-book .st-company, .st-book .st-visit, .st-book .st-title { hyphens: manual; -webkit-hyphens: manual; }
.st-book .st-sec { margin: 0 0 1.6em; font-size: inherit; font-weight: 600; line-height: 1.6; }
.st-book .st-col .st-visit { margin: 0 0 .5em; font-weight: 400; }

/* phones on their side: slimmer bars above and below the open book (sizes match the page script) */
.st-short .topbar { padding-top: 4px; }
.st-short .mark-sm { font-size: 18px; min-height: 36px; }
.st-short .who-main { padding-top: 4px; padding-bottom: 4px; }
.st-short .bottombar { min-height: 0; padding-top: 0; padding-bottom: 4px; }

/* phones: one page at a time */
.st-book.st-single .st-col { flex: 1 1 100%; }
.pg-count { min-width: 72px; text-align: center; font-size: 15px; color: var(--text); font-variant-numeric: tabular-nums; }

/* video inside a story: poster with a play button, then the player */
.st-video { margin: .2em 0 1.2em; max-width: 42ch; }
.st-video-frame { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; padding: 0; background-color: #1E2552; background-size: cover; background-position: center; cursor: pointer; overflow: hidden; }
.st-video-frame.is-playing { cursor: default; background: #000; }
.st-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.st-video-play { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px 0 0 -29px; border-radius: 50%; background: rgba(255,255,255,.92); box-shadow: 0 4px 18px rgba(0,0,0,.25); transition: transform .2s ease; }
.st-video-play::after { content: ""; position: absolute; left: 23px; top: 18px; border-style: solid; border-width: 11px 0 11px 17px; border-color: transparent transparent transparent var(--text); }
.st-video-frame:hover .st-video-play { transform: scale(1.06); }
.st-video figcaption { margin-top: .55em; font-size: 13px; line-height: 1.45; color: var(--text-soft); }
.st-video figcaption a { color: var(--text); text-underline-offset: 3px; }

/* ---------- Portfolio (bibliography) ---------- */
.bib-main { flex: 1; padding: 4px clamp(16px, 4vw, 48px) 12px; }
.bib-cols { display: flex; flex-wrap: wrap; align-items: stretch; min-height: 480px; }
.col { flex: 0 0 auto; width: clamp(130px, 17vw, 210px); min-width: 0; padding: 0 22px 16px; }
.col:first-child { padding-left: 0; }
.col + .col { box-shadow: inset 1px 0 0 var(--text); }
.col-detail { flex: 1 1 320px; width: auto; }
/* narrow screens (a phone on its side, small windows): tighter list columns and a narrower description, same text size,
   so the description stays to the right of the lists even with Biotech's three columns */
@media (max-width: 960px) { .col { padding: 0 16px 16px; } .col-detail { flex-basis: 200px; } }
.col ul { list-style: none; margin: 0; padding: 0; }
.li { display: flex; align-items: center; min-height: 34px; width: 100%; font-size: 14.5px; line-height: 1.25; color: var(--text); }
.li .u { background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 100%; background-size: 0% 1px; padding-bottom: 2px; transition: background-size .3s cubic-bezier(.2,.7,.2,1); }
.li.is-sel .u { background-size: 100% 1px; }
@media (hover: hover) { .li:hover .u { background-size: 100% 1px; } } /* no sticky underline after a tap on touchscreens */
.fx-in { animation: ms-in .42s cubic-bezier(.2,.7,.2,1) both; }
@keyframes ms-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.d-name { font-size: 26px; margin: 0 0 10px; }
.d-sub { font-size: 16px; font-weight: 600; margin: 0 0 14px; line-height: 1.35; max-width: 44ch; }
.d-desc { font-size: 15px; line-height: 1.6; margin: 0 0 20px; max-width: 58ch; }
.d-links { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.d-links a { color: var(--text); }
.d-story { border: 1px solid var(--text); padding: 10px 16px; min-height: 44px; font-size: 14px; display: inline-flex; align-items: center; transition: background-color .2s ease, color .2s ease; }
.d-story:hover { background: var(--text); color: #FFFFFF; }
.d-empty { display: flex; align-items: center; min-height: 34px; margin: 0; font-size: 14.5px; line-height: 1.25; color: var(--text); }

/* ---------- Contact ---------- */
.black-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.black-mail { font-size: 22px; color: var(--text); text-decoration: none; animation: ms-up .6s cubic-bezier(.2,.7,.2,1) .15s backwards;
  background-image: linear-gradient(currentColor, currentColor); background-repeat: no-repeat; background-position: 0 100%;
  background-size: 0% 1px; padding-bottom: 3px; transition: background-size .3s cubic-bezier(.2,.7,.2,1); }
/* an underline draws in under the email address on hover, like the bibliography lists */
.black-mail:hover, .black-mail:focus-visible { background-size: 100% 1px; }

/* ---------- Not found ---------- */
.nf-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.nf-main a { color: var(--text); }

/* ---------- Phones ---------- */
@media (max-width: 640px) {
  .spine { font-size: clamp(11px, 3.4vw, 15px) !important; padding: 0 8px; }
  .stack-screen { --unit-min: .6px; }
  /* bibliography on phones: two columns side by side, description full width below */
  .bib-mobile { display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr); align-items: start; min-height: 0; }
  .bib-mobile .col.col { width: auto; padding: 0 0 12px; box-shadow: none; }
  .bib-mobile .col.col-next { align-self: stretch; padding: 0 0 12px 16px; box-shadow: inset 1px 0 0 var(--text); }
  .bib-mobile .col.col-detail { grid-column: 1 / -1; margin-top: 8px; padding: 20px 0 8px; box-shadow: inset 0 1px 0 var(--text); }
  .bib-back { display: flex; align-items: center; gap: 6px; min-height: 34px; margin-bottom: 2px; font-size: 14.5px; font-weight: 600; color: var(--text); }
  .who-right::before, .st-col.pg-right::before { right: 0; bottom: auto; width: auto; height: 1px; transform-origin: 0 50%; animation-name: ms-draw-x; }
  .col { width: 100%; padding-left: 0; }
  .col + .col { box-shadow: inset 0 1px 0 var(--text); padding-top: 12px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .screen, .fall, .pull-out, .slot-in, .fx-in, .who-col p, .about-text p, .who-right::before, .st-col.pg-right::before, .black-mail { animation: none !important; }
  .li .u, .cover-mark, .d-story, .st-video-play, .spine, .black-mail { transition: none; }
  .spine:hover, .spine:focus-visible { transform: none; filter: brightness(.95); }
}
