/* Page chrome for the personal journal. Load after styles.css and cabinet.css. */
:root {
  --journal-header-height: 78px;
  --journal-footer-height: 58px;
  --journal-page-height: calc(100svh - var(--journal-header-height) - var(--journal-footer-height));
  view-transition-name: none;
}

html { scroll-padding-top: calc(var(--journal-header-height) + 20px); }
body[data-page] { min-width: 280px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 90;
  width: 100%;
  max-width: none;
  height: var(--journal-header-height);
  margin: 0;
  padding: 0 var(--gutter);
  gap: clamp(22px, 3vw, 48px);
  border-bottom: 1px solid var(--line);
  background: var(--paper);
}

.site-header .brand { flex: 0 0 auto; gap: 13px; }
.site-header .brand-mark { font-size: 30px; }
.site-header .brand > span:last-child { font-size: 9px; letter-spacing: .07em; }
.site-header .top-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: clamp(17px, 1.8vw, 30px);
  min-width: 0;
  height: 100%;
  margin-left: auto;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.site-header .top-nav::-webkit-scrollbar { display: none; }
.site-header .top-nav a:nth-child(n) {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  min-height: 44px;
  padding: 1px 1px 0;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--muted);
  transition: color .18s ease;
}
.site-header .top-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 17px;
  height: 2px;
  background: var(--orange);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s ease;
}
.site-header .top-nav a:hover { color: var(--ink); }
.site-header .top-nav a[aria-current="page"] { color: var(--ink); }
.site-header .top-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-header .top-nav a:focus-visible { outline-offset: -4px; }
.site-header .header-end { flex: 0 0 auto; gap: 16px; }
.site-header .live-label { display: flex; gap: 5px; font-size: 8px; white-space: nowrap; }
.site-header .live-label i { display: none; }
.site-header .icon-btn { display: grid; place-items: center; width: 36px; height: 42px; padding: 8px; }
.site-header .icon-btn:hover .menu-lines { border-color: var(--orange); }
.index-panel { z-index: 100; top: calc(var(--journal-header-height) - 1px); }
#index-links a[aria-current="page"] { color: var(--orange); }

main#page-content {
  position: relative;
  min-height: var(--journal-page-height);
  outline: none;
  overflow: clip;
  view-transition-name: journal-page;
}
#page-content section[hidden] { display: none !important; }
#page-content > section:not([hidden]) { min-height: var(--journal-page-height); }
#page-content > .section-pad { padding-top: 43px; padding-bottom: 58px; }
#page-content > .section-pad > .section-kicker { padding-top: 0; margin-bottom: 35px; border-top: 0; }
#page-content > .section-pad > .section-heading { margin-bottom: 32px; }

/* Keep all portrait layers on the original shared positioning system. */
body[data-page="me"] .hero { padding-top: 18px; }
body[data-page="me"] .hero-eyebrow { margin-bottom: 19px; }
body[data-page="me"] .hero h1 { font-size: clamp(80px, 14.9vw, 238px); }
body[data-page="me"] .hero-stage { height: clamp(390px, 31vw, 500px); }
body[data-page="me"] .hero-copy { padding-top: 32px; padding-bottom: 28px; }
body[data-page="me"] .hero-aside { padding-top: 28px; padding-bottom: 28px; }
body[data-page="me"] .hero-bottom { padding-top: 13px; padding-bottom: 13px; }

.profile-links { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.profile-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 35px;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 30px;
  font-size: 10px;
  line-height: 1.3;
  white-space: nowrap;
  transition: border-color .18s ease, background-color .18s ease;
}
.profile-links a:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

#page-content > .route-room {
  min-height: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
}
.route-room-shell {
  position: relative;
  width: 100%;
  height: var(--journal-page-height);
  min-height: 440px;
  overflow: hidden;
  background: var(--paper);
}
.route-room-shell iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--paper); }
.route-room-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: 13px;
  padding: 28px;
  background: var(--paper);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  line-height: 1.8;
  pointer-events: none;
  transition: opacity .2s ease, visibility .2s ease;
}
.route-room-loading::before {
  content: "";
  display: block;
  width: 28px;
  height: 2px;
  margin: 0 auto;
  background: var(--orange);
  transform-origin: left;
  animation: journal-room-loading 1.1s ease-in-out infinite alternate;
}
.route-room-shell.is-loaded .route-room-loading,
.route-room.is-loaded .route-room-loading { opacity: 0; visibility: hidden; }
.route-room-loading[hidden],
.route-room-status[hidden] { display: none !important; }
.route-room-status {
  position: absolute;
  z-index: 3;
  right: 20px;
  bottom: 18px;
  left: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  width: fit-content;
  max-width: calc(100% - 40px);
  margin: 0 auto;
  padding: 12px 18px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
  box-shadow: 0 5px 20px #24241f0a;
}
.route-room-status a,
.route-room-status button { padding: 2px 0; color: var(--ink); font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
@keyframes journal-room-loading { from { transform: scaleX(.35); opacity: .5; } to { transform: scaleX(1); opacity: 1; } }

.site-footer {
  min-height: var(--journal-footer-height);
  max-width: none;
  margin: 0;
  padding: 0 var(--gutter);
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.site-footer .footer-bottom {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  min-height: var(--journal-footer-height);
  padding: 12px 0;
  border: 0;
  gap: 14px 24px;
  color: var(--muted);
  font-size: 8px;
  line-height: 1.8;
  letter-spacing: .04em;
}
.site-footer .footer-bottom > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 21px; }
.site-footer .footer-bottom button,
.site-footer .footer-bottom a { font-size: 9px; white-space: nowrap; }
.site-footer a:hover,
.site-footer button:hover { color: var(--orange); }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Only the sheet changes; navigation remains live. */
::view-transition { pointer-events: none; }
::view-transition-group(journal-page) {
  perspective: 1400px;
  perspective-origin: 50% 35%;
  isolation: isolate;
  animation-name: none;
  animation-duration: 650ms;
  animation-timing-function: cubic-bezier(.22, .68, .21, 1);
}
::view-transition-image-pair(journal-page) { isolation: isolate; transform-style: preserve-3d; }
::view-transition-old(journal-page),
::view-transition-new(journal-page) {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: top left;
  mix-blend-mode: normal;
  backface-visibility: hidden;
  animation-duration: 650ms;
  animation-timing-function: cubic-bezier(.22, .68, .21, 1);
  animation-fill-mode: both;
}
::view-transition-old(journal-page) {
  z-index: 2;
  transform-origin: left center;
  box-shadow: 20px 0 34px -24px #24241f60;
  animation-name: journal-page-turn-forward;
}
::view-transition-new(journal-page) { z-index: 1; animation-name: journal-page-reveal-forward; }
html[data-turn="back"]::view-transition-old(journal-page) { transform-origin: right center; animation-name: journal-page-turn-back; box-shadow: -20px 0 34px -24px #24241f60; }
html[data-turn="back"]::view-transition-new(journal-page) { animation-name: journal-page-reveal-back; }
@keyframes journal-page-turn-forward {
  0% { transform: rotateY(0deg); opacity: 1; }
  72% { opacity: 1; }
  100% { transform: rotateY(-85deg); opacity: 0; }
}
@keyframes journal-page-turn-back {
  0% { transform: rotateY(0deg); opacity: 1; }
  72% { opacity: 1; }
  100% { transform: rotateY(85deg); opacity: 0; }
}
@keyframes journal-page-reveal-forward { from { transform: translateX(3%); opacity: .45; } to { transform: translateX(0); opacity: 1; } }
@keyframes journal-page-reveal-back { from { transform: translateX(-3%); opacity: .45; } to { transform: translateX(0); opacity: 1; } }

/* Keep long archives inside the sheet on wide screens, without constraining mobile reading. */
@media (min-width: 1100px) {
  body[data-page="works"] #page-content > .works,
  body[data-page="life"] #page-content > .life,
  body[data-page="journal"] #page-content > .journal,
  body[data-page="collection"] #page-content > .collection,
  body[data-page="honors"] #page-content > .honors { padding-top: 28px; padding-bottom: 32px; }
  body[data-page="works"] #page-content .works > .section-kicker,
  body[data-page="life"] #page-content .life > .section-kicker,
  body[data-page="journal"] #page-content .journal > .section-kicker,
  body[data-page="collection"] #page-content .collection > .section-kicker,
  body[data-page="honors"] #page-content .honors > .section-kicker { margin-bottom: 23px; }
  body[data-page="works"] #page-content .works > .section-heading,
  body[data-page="life"] #page-content .life > .section-heading,
  body[data-page="journal"] #page-content .journal > .section-heading,
  body[data-page="collection"] #page-content .collection > .section-heading,
  body[data-page="honors"] #page-content .honors > .section-heading { margin-bottom: 24px; }
  body[data-page="works"] .works > .section-heading h2 { font-size: clamp(36px, 3.3vw, 50px); }
  body[data-page="works"] #works-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 23px;
    margin-top: 18px;
  }
  body[data-page="works"] .work-visual { aspect-ratio: 1.88; }
  body[data-page="works"] .work-info { gap: 12px; margin-top: 11px; }
  body[data-page="works"] .work-info h3 { font-size: clamp(18px, 1.5vw, 24px); }
  body[data-page="works"] .work-info > span { font-size: 8px; }
  body[data-page="works"] .work-card > p { margin-top: 6px; font-size: 10px; line-height: 1.7; }

}

@media (min-width: 1600px) {
  .site-header,
  .site-footer { padding-inline: max(var(--gutter), calc((100vw - 1760px) / 2)); }
}

@media (max-width: 1000px) {
  :root { --journal-header-height: 110px; }
  .site-header { display: grid; grid-template-columns: 1fr auto; grid-template-rows: 61px 49px; gap: 0 20px; }
  .site-header .brand { grid-column: 1; grid-row: 1; justify-self: start; }
  .site-header .header-end { grid-column: 2; grid-row: 1; gap: 14px; }
  .site-header .top-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    width: 100%;
    height: 49px;
    margin: 0;
    gap: 29px;
  }
  .site-header .top-nav a:nth-child(n) { font-size: 11px; }
  .site-header .top-nav a::after { bottom: 5px; }
  body[data-page="me"] .hero h1 { font-size: 15.1vw; }
  body[data-page="me"] .hero-stage { height: 390px; }
  
}

@media (max-width: 700px) {
  :root { --journal-header-height: 106px; --journal-footer-height: 88px; }
  .site-header { grid-template-rows: 59px 47px; gap: 0 15px; }
  .site-header .brand { gap: 12px; }
  .site-header .brand > span:last-child { display: block; font-size: 8px; line-height: 1.45; }
  .site-header .brand-mark { font-size: 27px; }
  .site-header .header-end { gap: 12px; }
  .site-header .live-label { display: flex; font-size: 7px; letter-spacing: .08em; }
  .site-header .icon-btn { width: 32px; height: 40px; }
  .site-header .top-nav { height: 47px; gap: 25px; padding: 0 1px; }
  .site-header .top-nav a:nth-child(n) { display: inline-flex; min-height: 44px; font-size: 11px; }
  .site-header .top-nav a::after { bottom: 5px; }

  #page-content > .section-pad { padding-top: 30px; padding-bottom: 42px; }
  #page-content > .section-pad > .section-kicker { margin-bottom: 27px; }
  #page-content > .section-pad > .section-heading { margin-bottom: 25px; }
  body[data-page="me"] .hero { padding-top: 17px; }
  body[data-page="me"] .hero-eyebrow { margin-bottom: 17px; }
  body[data-page="me"] .hero h1 { font-size: 15.2vw; }
  body[data-page="me"] .hero-stage { height: 470px; }
  body[data-page="me"] .hero-copy { padding: 27px 0 0; }
  body[data-page="me"] .hero-aside { padding: 0; }
  body[data-page="me"] .hero-bottom { padding-top: 12px; padding-bottom: 12px; }
  .profile-links { gap: 7px; margin-top: 24px; }
  .profile-links a { min-height: 34px; padding: 7px 13px; font-size: 10px; }
  .route-room-shell { min-height: 500px; }
  .route-room-loading { font-size: 11px; }
  .route-room-status { left: 14px; right: 14px; bottom: 14px; max-width: calc(100% - 28px); padding: 11px 14px; font-size: 10px; }
  .route-room-status a,
  .route-room-status button { font-size: 10px; }
  .site-footer .footer-bottom { flex-direction: column; align-items: flex-start; justify-content: center; gap: 9px; padding: 14px 0; font-size: 8px; }
  .site-footer .footer-bottom > div { width: 100%; justify-content: flex-start; gap: 8px 18px; }
  .site-footer .footer-bottom button,
  .site-footer .footer-bottom a { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .site-header .top-nav a,
  .site-header .top-nav a::after,
  .profile-links a,
  .route-room-loading{ transition: none; }
  .route-room-loading::before { animation: none; }
  ::view-transition-group(journal-page),
  ::view-transition-old(journal-page),
  ::view-transition-new(journal-page) { animation: none !important; }
  ::view-transition-old(journal-page) { display: none; }
}
