/* ============================================================
   James D. Price — jamesdprice.com
   Design system: "Klaf" — aged vellum, iron-gall ink,
   rubrication red, gold-leaf hairlines.
   Type: Cormorant Garamond (display) · Gentium Book Plus (body)
   Hebrew: Frank Ruhl Libre
   ============================================================ */

:root {
  --klaf:        #efe7d3;   /* vellum ground        */
  --klaf-deep:   #e7dbc0;   /* darker sheet         */
  --klaf-light:  #f6f0e1;   /* raised sheet         */
  --ink:         #241c12;   /* iron-gall ink        */
  --ink-soft:    #4d4232;
  --rubric:      #7e2a1c;   /* rubrication red      */
  --gilt:        #96793d;   /* gold-leaf hairline   */
  --tekhelet:    #2e4a5e;   /* muted lapis (links)  */
  --nav-h: 0px;
  --serif-body: "Gentium Book Plus", "Gentium Plus", Georgia, "Times New Roman", serif;
  --serif-display: "Cormorant Garamond", "Cormorant", Garamond, Georgia, serif;
  --hebrew: "Frank Ruhl Libre", "SBL Hebrew", "David", serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--serif-body);
  font-size: 1.075rem;
  line-height: 1.75;
  background-color: var(--klaf);
  /* Subtle animal-skin / scroll texture: fibrous noise + soft mottling + vignette */
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255,252,240,.55), rgba(255,252,240,0) 60%),
    radial-gradient(ellipse at 18% 85%, rgba(160,130,80,.10), rgba(160,130,80,0) 55%),
    radial-gradient(ellipse at 85% 70%, rgba(150,120,70,.09), rgba(150,120,70,0) 50%),
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.012 0.05' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.34 0 0 0 0 0.20 0 0 0 0.055 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23p)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='11'/%3E%3CfeColorMatrix values='0 0 0 0 0.30 0 0 0 0 0.24 0 0 0 0 0.14 0 0 0 0.04 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23g)'/%3E%3C/svg%3E");
  background-attachment: fixed, fixed, fixed, local, local;
}

/* ------------------------------------------------ masthead */
.masthead {
  text-align: center;
  padding: 3.2rem 1.25rem 1.4rem;
}
.masthead .rule {
  width: min(560px, 78%);
  margin: 0 auto;
  border: 0;
  border-top: 1px solid var(--gilt);
  position: relative;
}
.masthead .rule::after {
  content: "";
  position: absolute; left: 0; right: 0; top: 3px;
  border-top: 1px solid rgba(150,121,61,.45);
}
.masthead h1 {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(2.3rem, 5.5vw, 3.4rem);
  letter-spacing: .12em;
  margin: 1.1rem 0 .2rem;
  text-transform: uppercase;
}
.masthead h1 a { color: inherit; text-decoration: none; }
.masthead .subtitle {
  font-family: var(--serif-display);
  font-style: italic;
  font-size: 1.15rem;
  letter-spacing: .06em;
  color: var(--ink-soft);
  margin: 0 0 1.2rem;
}

/* ------------------------------------------------ nav */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(239, 231, 211, .92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-top: 1px solid rgba(150,121,61,.5);
  border-bottom: 1px solid rgba(150,121,61,.5);
  padding: .7rem 1rem;
}
.site-nav ul {
  list-style: none;
  margin: 0 auto;
  padding: 0 5.2rem;   /* keeps links clear of the JDP seal */
  max-width: 1080px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 1.35rem;
  row-gap: .15rem;
}
.site-nav a {
  font-family: var(--serif-display);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
  padding: .2rem 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--rubric); }
.site-nav a[aria-current="page"] {
  color: var(--rubric);
  border-bottom-color: var(--rubric);
}
.site-nav .subpage a { font-weight: 400; }

/* ------------------------------------------------ layout */
main {
  max-width: 900px;
  margin: 0 auto;
  padding: 3rem 1.4rem 4.5rem;
}
main.wide { max-width: 1060px; }

.page-title {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4.2vw, 2.7rem);
  letter-spacing: .04em;
  margin: 0 0 .4rem;
  color: var(--ink);
}
.page-lede {
  font-size: 1.12rem;
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0 0 2.4rem;
}
.page-lede em { color: var(--ink); }

.flourish {
  display: block;
  width: 120px;
  margin: .9rem 0 1.4rem;
  border: 0;
  border-top: 2px solid var(--rubric);
}
.centered .flourish { margin-left: auto; margin-right: auto; }

a { color: var(--tekhelet); text-decoration-color: rgba(46,74,94,.4); text-underline-offset: 3px; }
a:hover { color: var(--rubric); text-decoration-color: currentColor; }

h2.section-head {
  font-family: var(--serif-display);
  font-weight: 600;
  font-size: 1.45rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--rubric);
  margin: 2.8rem 0 1rem;
}
h2.section-head::after {
  content: "";
  display: block;
  width: 64px;
  border-top: 1px solid var(--gilt);
  margin-top: .45rem;
}

/* ------------------------------------------------ document cards */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.1rem;
  margin: 1.6rem 0;
}
.doc-card {
  position: relative;
  background: linear-gradient(160deg, var(--klaf-light), #f1e8d2);
  border: 1px solid rgba(150,121,61,.45);
  border-radius: 4px;
  padding: 1.25rem 1.35rem 1.15rem;
  box-shadow: 0 1px 2px rgba(36,28,18,.08), 0 8px 22px -14px rgba(36,28,18,.35);
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}
.doc-card::before {          /* gilt tick in the corner */
  content: "";
  position: absolute; top: 8px; left: 8px;
  width: 14px; height: 14px;
  border-top: 1px solid var(--gilt);
  border-left: 1px solid var(--gilt);
  opacity: .8;
}
.doc-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 2px 4px rgba(36,28,18,.1), 0 16px 30px -14px rgba(36,28,18,.4);
}
.doc-card h3 {
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 1.22rem;
  margin: 0 0 .45rem;
  line-height: 1.3;
}
.doc-card h3 a { color: var(--ink); text-decoration: none; }
.doc-card h3 a:hover { color: var(--rubric); }
.doc-card p { margin: 0 0 1rem; font-size: .98rem; color: var(--ink-soft); }
.doc-card .doc-link {
  margin-top: auto;
  align-self: flex-start;
  font-family: var(--serif-display);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rubric);
  text-decoration: none;
  border-bottom: 1px solid rgba(126,42,28,.4);
  padding-bottom: 2px;
}
.doc-card .doc-link:hover { border-bottom-color: var(--rubric); }

/* single-column list variant for pages with long descriptions */
.doc-list .doc-card { margin: 0 0 1.1rem; }

/* ------------------------------------------------ home directory */
.dir-entry {
  border-top: 1px solid rgba(150,121,61,.4);
  padding: 1.5rem 0 1.4rem;
}
.dir-entry:last-of-type { border-bottom: 1px solid rgba(150,121,61,.4); }
.dir-entry h3 {
  font-family: var(--serif-display);
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0 0 .35rem;
}
.dir-entry h3 a { color: var(--ink); text-decoration: none; }
.dir-entry h3 a:hover { color: var(--rubric); }
.dir-entry p { margin: 0; color: var(--ink-soft); }
.badge {
  display: inline-block;
  font-family: var(--serif-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--klaf-light);
  background: var(--rubric);
  border-radius: 3px;
  padding: .18rem .5rem .12rem;
  margin-left: .55rem;
  vertical-align: middle;
}

/* ------------------------------------------------ CV & prose pages */
.prose h2 {
  font-family: var(--serif-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: .06em;
  margin: 2.2rem 0 .7rem;
  color: var(--rubric);
}
.prose ol { padding-left: 1.4rem; }
.prose ol li { margin-bottom: .55rem; }
.prose ul { padding-left: 1.3rem; }
.address-card {
  background: var(--klaf-light);
  border: 1px solid rgba(150,121,61,.45);
  border-radius: 4px;
  padding: 1.1rem 1.4rem;
  margin: 1.4rem 0 2rem;
  font-style: normal;
  box-shadow: 0 1px 2px rgba(36,28,18,.07);
}
.address-card strong { font-family: var(--serif-display); letter-spacing: .04em; }

/* ------------------------------------------------ stacked scroll cards (Pointers pages) */
.stack-intro { margin-bottom: 1.6rem; }

.jump-index {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .55rem;
  margin: 0 0 3rem;
}
.jump-index a {
  font-family: var(--serif-display);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid rgba(150,121,61,.5);
  border-radius: 999px;
  padding: .25rem .7rem .18rem;
  background: rgba(246,240,225,.6);
}
.jump-index a:hover { color: var(--rubric); border-color: var(--rubric); }

.card-stack {
  display: block;
  padding-bottom: 8vh;
}
.scroll-card {
  position: -webkit-sticky;
  position: sticky;
  top: calc(64px + 2.2rem);
  margin: 0 auto 12vh;
  max-width: 980px;
  min-height: min(66vh, 620px);
  border-radius: 6px;
  border: 1px solid rgba(150,121,61,.55);
  background-color: #f3ecda;  /* opaque fallback under the gradient */
  box-shadow:
    0 1px 0 rgba(255,252,240,.6) inset,
    0 2px 6px rgba(36,28,18,.12),
    0 26px 44px -28px rgba(36,28,18,.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(1.4rem, 4vw, 3rem) clamp(1.3rem, 5vw, 3.6rem);
  transform-origin: 50% 0%;
  will-change: transform;
}
.scroll-card:nth-child(3n+1) { background: linear-gradient(165deg, #f6f0e1 0%, #ece1c6 100%); }
.scroll-card:nth-child(3n+2) { background: linear-gradient(165deg, #f3ecda 0%, #e7dabb 100%); }
.scroll-card:nth-child(3n)   { background: linear-gradient(165deg, #f7f1e4 0%, #eee4cc 100%); }
.scroll-card::after {         /* faint skin mottling per card */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 80% 15%, rgba(150,121,61,.10), transparent 55%),
    radial-gradient(ellipse at 12% 90%, rgba(150,121,61,.08), transparent 50%);
}
.scroll-card .backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  opacity: .07;
  user-select: none;
  pointer-events: none;
  white-space: nowrap;
  z-index: 0;
}
.he .backdrop { font-family: var(--hebrew); font-size: clamp(4.5rem, 17vw, 12.5rem); }
.gr .backdrop { font-family: var(--serif-display); font-size: clamp(3rem, 11vw, 8.2rem); letter-spacing: .04em; }
.gr .backdrop.long { font-size: clamp(2.2rem, 8vw, 6rem); }
.he .backdrop.long { font-size: clamp(3rem, 11vw, 8.5rem); }

.scroll-card .card-kicker {
  position: relative; z-index: 1;
  font-family: var(--serif-display);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gilt);
  margin: 0 0 .3rem;
}
.scroll-card h3.card-title {
  position: relative; z-index: 1;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: clamp(2rem, 5.4vw, 3.3rem);
  line-height: 1.05;
  letter-spacing: .02em;
  margin: 0 0 .4rem;
  color: var(--ink);
}
.scroll-card .card-native {
  position: relative; z-index: 1;
  font-size: 1.25rem;
  color: var(--rubric);
  margin: 0 0 1.3rem;
}
.he .card-native { font-family: var(--hebrew); }
.gr .card-native { font-family: var(--serif-display); font-style: italic; }
.scroll-card .card-rule {
  position: relative; z-index: 1;
  width: 84px;
  border: 0;
  border-top: 2px solid var(--rubric);
  margin: 0 0 1.3rem;
}
.scroll-card .card-summary {
  position: relative; z-index: 1;
  max-width: 56ch;
  font-size: clamp(1rem, 2vw, 1.14rem);
  margin: 0 0 1.8rem;
  color: var(--ink-soft);
}
.scroll-card .card-summary strong { color: var(--ink); }
.scroll-card .card-cta {
  position: relative; z-index: 1;
  align-self: flex-start;
  margin-top: auto;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: .85rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--klaf-light);
  background: var(--rubric);
  border-radius: 3px;
  padding: .65rem 1.15rem .55rem;
  box-shadow: 0 2px 8px -2px rgba(126,42,28,.5);
  transition: background .2s ease, transform .2s ease;
}
.scroll-card .card-cta:hover { background: #93382a; transform: translateY(-2px); }
.scroll-card .card-index {
  position: absolute;
  top: clamp(1rem, 3vw, 1.8rem);
  right: clamp(1.1rem, 3.4vw, 2rem);
  z-index: 1;
  font-family: var(--serif-display);
  font-size: .85rem;
  letter-spacing: .12em;
  color: var(--gilt);
}

/* ------------------------------------------------ notice (missing content) */
.notice {
  background: rgba(126,42,28,.08);
  border: 1px dashed var(--rubric);
  border-radius: 4px;
  padding: 1.1rem 1.3rem;
  color: var(--ink);
}

/* ------------------------------------------------ footer */
.site-footer {
  border-top: 1px solid rgba(150,121,61,.5);
  margin-top: 2rem;
  padding: 1.6rem 1rem 2.4rem;
  text-align: center;
  font-family: var(--serif-display);
  font-size: .9rem;
  letter-spacing: .12em;
  color: var(--ink-soft);
}

/* ------------------------------------------------ responsive */
@media (max-width: 640px) {
  .site-nav ul { column-gap: .9rem; }
  .site-nav a { font-size: .72rem; letter-spacing: .1em; }
  .scroll-card { top: calc(96px + 1rem); min-height: 72vh; margin-bottom: 10vh; }
  .doc-grid { grid-template-columns: 1fr; }
}

/* visible keyboard focus */
a:focus-visible, .card-cta:focus-visible {
  outline: 2px solid var(--tekhelet);
  outline-offset: 3px;
}

/* ------------------------------------------------ tilting portrait */
.portrait-frame {
  float: right;
  margin: .3rem 0 1.2rem 1.8rem;
  width: min(215px, 36vw);   /* narrower so the tall portrait sits lower-key */
  perspective: 900px;
}
.portrait-frame img {
  display: block;
  width: 100%;
  border: 1px solid rgba(150,121,61,.55);
  border-radius: 4px;
  box-shadow: 0 10px 28px -14px rgba(36,28,18,.55), 0 1px 3px rgba(36,28,18,.15);
  transform: rotateY(0deg) rotateX(0deg);
  transform-style: preserve-3d;
  will-change: transform;
  transition: box-shadow .3s ease;
  background: #fff;
}
.portrait-frame figcaption {
  font-family: var(--serif-display);
  font-size: .9rem;
  letter-spacing: .04em;
  color: var(--ink-soft);
  text-align: center;
  margin-top: .5rem;
}
@media (max-width: 560px) {
  .portrait-frame { float: none; margin: 0 auto 1.6rem; width: min(240px, 64vw); }
}

/* ------------------------------------------------ gaussian splat viewer */
.portrait-frame .splat-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 610 / 780;
  border: 1px solid rgba(150,121,61,.55);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 28px -14px rgba(36,28,18,.55), 0 1px 3px rgba(36,28,18,.15);
  background: #1c1610;
  display: none;              /* shown by script only when the splat loads */
}
.portrait-frame .splat-stage canvas { width: 100% !important; height: 100% !important; display: block; }
.portrait-frame.splat-active img { display: none; }
.portrait-frame.splat-active .splat-stage { display: block; }

/* ------------------------------------------------ JDP monogram seal */
.nav-brand {
  position: absolute;
  left: .8rem;
  top: 50%;
  width: 66px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: .1em;
  text-decoration: none;
  color: var(--rubric);
  background: radial-gradient(circle at 35% 30%, #faf5e8, #efe6d0);
  border: 1px solid var(--gilt);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(150,121,61,.18), 0 2px 6px -2px rgba(36,28,18,.35);
  opacity: 0;
  transform: translateY(-50%) scale(.8);
  pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}
.nav-brand:hover { color: var(--ink); border-color: var(--rubric); }
.site-nav.show-brand .nav-brand {
  opacity: 1;
  transform: translateY(-50%) scale(1);
  pointer-events: auto;
}
.nav-brand { z-index: 60; }
.site-nav { position: sticky; }
@media (max-width: 640px) {
  .nav-brand { width: 50px; height: 50px; font-size: .95rem; left: .5rem; }
  .site-nav ul { padding: 0 3.6rem; }
}

/* ------------------------------------------------ mobile menu */
.nav-toggle {
  display: none;
  font-family: var(--serif-display);
  font-weight: 700;
  font-size: .95rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--rubric);
  background: rgba(246,240,225,.7);
  border: 1px solid var(--gilt);
  border-radius: 4px;
  padding: .4rem .95rem .32rem;
  cursor: pointer;
}
.nav-toggle .bars { font-size: 1rem; margin-right: .35rem; }

@media (max-width: 900px) {
  .site-nav { padding: .5rem .8rem; }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    margin: 0 auto;              /* centered in the slim bar */
  }
  .site-nav { display: flex; justify-content: center; align-items: center; min-height: 46px; }
  .site-nav .nav-brand { top: 50%; }

  /* the link list becomes a slide-down vellum panel */
  .site-nav ul#site-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    padding: .4rem 1.1rem 1rem;
    display: block;
    background: #f2ead7;
    border-bottom: 1px solid var(--gilt);
    box-shadow: 0 18px 30px -18px rgba(36,28,18,.55);
    max-height: 0;
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    transition: max-height .3s ease, opacity .25s ease, visibility 0s linear .3s;
  }
  .site-nav.menu-open ul#site-menu {
    max-height: min(70vh, 560px);
    visibility: visible;
    opacity: 1;
    transition: max-height .3s ease, opacity .25s ease;
  }
  .site-nav ul#site-menu li { display: block; }
  .site-nav ul#site-menu a {
    display: block;
    padding: .55rem .2rem;
    font-size: .92rem;
    letter-spacing: .12em;
    border-bottom: 1px solid rgba(150,121,61,.25);
    white-space: normal;
  }
  .site-nav ul#site-menu li:last-child a { border-bottom: 0; }
  .site-nav ul#site-menu li.subpage a { padding-left: 1.2rem; }
  .site-nav a[aria-current="page"] { border-bottom-color: var(--rubric); }

  /* slim bar means sticky cards can sit higher */
  .scroll-card { top: calc(62px + .9rem); }
}
