/* v4 subpages: page frame and shared parts (paper, stamps, screens, tape). Header, keys, drawers, footer: wall.css. */

:root {
  --paper: #EFE8DA;
  --paper-2: #E6DDCB;
  --paper-ink: #1F1C17;
  --paper-muted: #5E574B;
  --paper-line: rgba(31, 28, 23, .18);
  --carbon-yellow: #F1E2A6;
  --carbon-pink: #F0D3CC;
  --ink-red: #B3261E;
  --ink-blue: #1D3B8F;
  --ink-green: #2F6B3A;
  --blueprint: #173A63;
  --blueprint-line: rgba(220, 235, 255, .55);
  --pg-max: 75rem;
}

.pg-skip {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
  z-index: 100;
  padding: var(--s-2) var(--s-3);
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--f-display);
  font-weight: 700;
  text-transform: uppercase;
  transform: translateY(-200%);
}

.pg-skip:focus {
  transform: none;
}

.pg-home {
  color: inherit;
  text-decoration: none;
}

.pg-home:hover {
  color: var(--accent);
}

.pg {
  position: relative;
  flex: 1;
  display: block;
  width: 100%;
  max-width: var(--pg-max);
  margin-inline: auto;
  padding: var(--s-5) var(--gutter) var(--s-7);
  outline: none;
}

.room--page {
  --label-muted: #ADA594;
}

.room--page > .keys--dock {
  margin: 0;
}

/* the header plate scrolls away on long pages, so the toast stays in view */
.room--page .toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + .75rem);
  max-width: calc(100vw - 2 * var(--gutter));
  white-space: normal;
  text-align: center;
}

/* keep focused elements clear of the sticky dock */
@media (max-width: 63.99em), (orientation: portrait) {
  html:has(.room--page) {
    scroll-padding-bottom: 5.5rem;
  }
}

/* page head */

.pg-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--s-2);
  margin: 0 0 var(--s-3);
  padding: 0;
  list-style: none;
  font-family: var(--f-mono);
  font-size: var(--t-osd);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--label-muted);
}

.pg-crumbs li + li::before {
  content: '/';
  margin-right: var(--s-2);
  opacity: .6;
}

.pg-crumbs a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 1.5rem;
  color: var(--label);
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

/* the row stays compact; an invisible pad gives each crumb a 44 px touch area */
.pg-crumbs a::after {
  content: '';
  position: absolute;
  inset: -.625rem -.25rem;
}

/* header plate on narrow phones: one line under the name on every page ("Site office" is in the crumbs) */
@media (max-width: 29.99em) {
  .room--page .plate__sub {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .room--page .plate__pre {
    display: none;
  }
}

/* the narrowest phones: two lines reserved, so the plate is the same height on every page */
@media (max-width: 22.49em) {
  .room--page .plate__sub {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    min-height: 2.4em;
    white-space: normal;
  }
}

.pg-head {
  margin-bottom: var(--s-6);
}

.pg-kicker {
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: var(--t-data);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
}

.pg-title {
  margin-top: var(--s-2);
  text-wrap: balance;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(2.25rem, 9vw, 4rem);
  line-height: .95;
  letter-spacing: .02em;
  text-transform: uppercase;
  color: #EDE6D7;
}

.pg-lede {
  max-width: 40rem;
  text-wrap: pretty;
  margin-top: var(--s-3);
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--label);
}

.pg-lede.voice {
  font-size: 1.125rem;
}

.pg-h2 {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-7) 0 var(--s-4);
  text-wrap: balance;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.05;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #EDE6D7;
}

.pg-h2::after {
  content: '';
  flex: 1;
  height: 2px;
  background: linear-gradient(to right, var(--bezel-hi), transparent);
}

.pg-text {
  max-width: 42rem;
  text-wrap: pretty;
}

.pg-text p + p {
  margin-top: var(--s-3);
}

.pg-text a,
.pg-link {
  color: var(--label);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.pg-text a:hover,
.pg-link:hover {
  color: var(--accent);
}

/* layout helpers */

.pg-cols {
  display: grid;
  gap: var(--s-5);
}

@media (min-width: 64em) {
  .pg-cols {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--s-6);
    align-items: start;
  }

  .pg-cols--wide-left {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

/* paper: forms, files, orders */

.pg-paper {
  position: relative;
  padding: var(--s-5) var(--s-4);
  color: var(--paper-ink);
  background:
    linear-gradient(rgba(255, 255, 255, .25), rgba(0, 0, 0, .03)),
    var(--paper);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 14px 30px rgba(0, 0, 0, .45), 0 2px 4px rgba(0, 0, 0, .35);
}

.pg-paper::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--noise);
  opacity: .07;
  mix-blend-mode: multiply;
}

.pg-paper--yellow {
  background: var(--carbon-yellow);
}

.pg-paper--pink {
  background: var(--carbon-pink);
}

.pg-paper a:where(:not(.pg-btn)) {
  color: var(--paper-ink);
  text-decoration-color: var(--ink-red);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

@media (min-width: 37.5em) {
  .pg-paper {
    padding: var(--s-6);
  }
}

.pg-formhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-1) var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--paper-ink);
  font-family: var(--f-mono);
  font-size: var(--t-data);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pg-formhead strong {
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.375rem;
  letter-spacing: .04em;
}

.pg-fields {
  display: grid;
  margin: 0;
}

.pg-fields > div {
  display: grid;
  grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr);
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--paper-line);
}

.pg-fields dt {
  font-family: var(--f-mono);
  font-size: var(--t-osd);
  line-height: 1.6;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--paper-muted);
}

.pg-fields dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.4;
}

@media (max-width: 29.99em) {
  .pg-fields > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

.pg-hand {
  font-family: var(--f-serif);
  font-style: italic;
  color: var(--ink-blue);
}

/* stamps */

.pg-stamp {
  display: inline-block;
  padding: .2em .55em .15em;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-red);
  border: 3px solid currentColor;
  border-radius: 4px;
  transform: rotate(-6deg);
  opacity: .85;
  mix-blend-mode: multiply;
}

.pg-stamp--green {
  color: var(--ink-green);
}

.pg-stamp--blue {
  color: var(--ink-blue);
}

.pg-stamp--black {
  color: var(--paper-ink);
}

/* instruments on dark */

.pg-screen {
  position: relative;
  padding: var(--s-4);
  color: var(--amber);
  background: var(--amber-bg);
  border: var(--b) solid var(--bezel);
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px #000, inset 0 0 24px rgba(0, 0, 0, .8), 0 0 0 1px var(--bezel-hi);
  font-family: var(--f-mono);
  font-size: .875rem;
  line-height: 1.5;
}

.pg-screen--green {
  color: var(--green);
  background: var(--green-bg);
}

.pg-screen--lcd {
  color: var(--lcd);
  background: var(--lcd-bg);
}

.pg-plate {
  position: relative;
  padding: var(--s-4);
  background: var(--brushed), linear-gradient(to bottom, var(--metal-hi), var(--metal) 40%, var(--metal-lo));
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 8px 18px rgba(0, 0, 0, .45);
}

.pg-plate::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--screws);
}

/* hazard tape */

.pg-hazard {
  display: block;
  height: .75rem;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 .75rem, #141210 .75rem 1.5rem);
  border-radius: 1px;
}

/* buttons */

.pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: var(--hit);
  padding: 0 var(--s-4);
  font-family: var(--f-display);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--on-accent);
  background: linear-gradient(to bottom, #F0BC45, var(--accent));
  border: 0;
  border-radius: 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 3px 0 #8A6416, 0 6px 14px rgba(0, 0, 0, .35);
  cursor: pointer;
}

.pg-btn:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 1px 0 #8A6416;
}

.pg-btn .ic {
  width: 1.125rem;
  height: 1.125rem;
}

.pg-btn--dark {
  color: var(--label);
  background: linear-gradient(to bottom, #3A3732, #2A2824);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 3px 0 #0D0C0B;
}

.pg-btn:disabled,
.pg-btn[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}

.pg-more {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: var(--hit);
  font-family: var(--f-display);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--label);
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.pg-more .ic {
  width: 1.125rem;
  height: 1.125rem;
}

.pg-more:hover {
  color: var(--accent);
}

/* honest notes */

.pg-proto {
  display: flex;
  gap: var(--s-2);
  max-width: 42rem;
  margin-top: var(--s-4);
  padding: var(--s-2) var(--s-3);
  font-family: var(--f-mono);
  font-size: .75rem;
  line-height: 1.5;
  color: var(--label-muted);
  border: 1px dashed var(--amber-dim);
  border-radius: 4px;
}

.pg-proto::before {
  content: 'Note';
  flex: none;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--amber);
}

.pg-paper .pg-proto {
  color: var(--paper-muted);
  border-color: var(--paper-muted);
}

.pg-paper .pg-proto::before {
  color: var(--ink-red);
}

/* image frames */

.pg-photo {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #000;
  border-radius: 3px;
}

.pg-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  .pg-btn:active {
    transform: none;
  }
}
