/* ==========================================================================
   RestMarker
   --------------------------------------------------------------------------
   The whole design rests on three decisions:

   1. Paper, not screen. A warm ivory ground and a high-contrast serif, set
      with a lot of air. It should feel like fine stationery from a good
      funeral home, not like a web app.

   2. Brass is an accent, never a surface. Gold-on-gold reads cheap instantly.
      The metal shows up in hairlines, small caps, and one ornament -- the same
      restraint the physical marker is supposed to have.

   3. Light only. These pages get read outdoors, in sun, at a graveside, on a
      phone at arm's length. A dark theme loses that fight.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Ground */
  --paper:        #f8f5ef;
  --paper-deep:   #f1ece2;
  --paper-card:   #fffdf9;

  /* Ink */
  --ink:          #1b1916;
  --ink-soft:     #4a453d;
  --ink-muted:    #7a7263;

  /* Metal */
  --brass:        #a4813f;
  --brass-light:  #d2b071;
  --brass-deep:   #6f5423;

  /* Structure */
  --rule:         #e0d8c9;
  --rule-strong:  #c9bfab;

  /* State */
  --ok:           #38684a;
  --ok-bg:        #eef4ee;
  --warn:         #8a4a20;
  --warn-bg:      #faf0e7;
  --wait:         #5a5647;
  --wait-bg:      #f2efe6;

  /* Type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           "URW Palladio L", Georgia, "Times New Roman", serif;
  --sans:  ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
           Arial, sans-serif;

  --measure: 34rem;
  --gutter:  clamp(1.25rem, 5vw, 3rem);
  --radius:  2px;   /* almost square. rounded corners read as software. */
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.1875rem);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--brass-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 48rem; }
.wrap--reading { max-width: 40rem; }

.section { padding-block: clamp(3.5rem, 9vw, 7rem); }
.section--tight { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section--deep { background: var(--paper-deep); }

.stack > * + * { margin-top: 1.1em; }
.stack-lg > * + * { margin-top: 2rem; }

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */

h1, h2, h3, h4 {
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.25rem, 1.6rem + 3.2vw, 4rem); }
h2 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.6rem); }
h3 { font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.6rem); }
h4 { font-size: 1.0625rem; }

p { margin: 0 0 1.1em; max-width: var(--measure); }
.lede {
  font-size: clamp(1.1875rem, 1.1rem + 0.6vw, 1.5rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 36rem;
}

/* The small-caps eyebrow. Used sparingly -- it is the site's signature. */
.eyebrow {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brass);
  margin: 0 0 1.25rem;
  display: block;
}

.muted { color: var(--ink-muted); }
.small { font-size: 0.875rem; line-height: 1.6; }
.center { text-align: center; }
.center p, .center .lede { margin-inline: auto; }

/* Hairline with a brass diamond at the centre. The one ornament. */
.ornament {
  border: 0;
  height: 1px;
  background: var(--rule);
  margin: clamp(2.5rem, 6vw, 4rem) auto;
  max-width: 22rem;
  position: relative;
  overflow: visible;
}
.ornament::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--brass);
  transform: translate(-50%, -50%) rotate(45deg);
}

/* --------------------------------------------------------------------------
   Site chrome
   -------------------------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 20;
}
.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.5rem;
  flex-wrap: wrap;
}

.wordmark {
  font-size: 1.3125rem;
  letter-spacing: 0.04em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark em {
  font-style: normal;
  color: var(--brass);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.nav a { color: var(--ink-soft); text-decoration: none; }
.nav a:hover { color: var(--brass-deep); }

.footer {
  border-top: 1px solid var(--rule);
  padding-block: 3rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
  background: var(--paper-deep);
}
.footer__cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 2rem;
}
.footer a { color: var(--ink-soft); text-decoration: none; display: block; padding-block: 0.2rem; }
.footer a:hover { color: var(--brass-deep); text-decoration: underline; }
.footer h4 {
  font-family: var(--sans);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1em 2.1em;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--paper);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.btn:hover {
  background: var(--brass-deep);
  border-color: var(--brass-deep);
  color: #fff;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule-strong);
}
.btn--ghost:hover {
  background: transparent;
  color: var(--brass-deep);
  border-color: var(--brass);
}

.btn--small { padding: 0.65em 1.3em; font-size: 0.6875rem; }
.btn--block { width: 100%; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  padding-block: clamp(4rem, 11vw, 8.5rem);
  /* A very slight vertical wash, like the grain of laid paper. */
  background:
    radial-gradient(120% 80% at 50% 0%, #fffdf8 0%, rgba(255,253,248,0) 60%),
    var(--paper);
  border-bottom: 1px solid var(--rule);
}
.hero__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 6vw, 4.5rem);
  align-items: center;
}
@media (min-width: 60rem) {
  .hero__grid { grid-template-columns: 1.05fr 0.95fr; }
}
.hero h1 { margin-bottom: 0.4em; }
.hero .price-note {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin-top: 1.25rem;
}

/* The marker, drawn in CSS -- no image asset to go stale. */
.marker-plate {
  aspect-ratio: 1;
  width: min(22rem, 100%);
  margin-inline: auto;
  border-radius: var(--radius);
  padding: 1.6rem;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, #e8cf9e 0%, #c9a566 22%, #a4813f 48%,
                            #d7b87d 66%, #8f6d31 88%, #b8955a 100%);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.55) inset,
    0 24px 48px -20px rgba(60,44,15,0.45),
    0 2px 6px rgba(60,44,15,0.2);
  position: relative;
}
.marker-plate::after {
  /* The bevelled inner edge. */
  content: "";
  position: absolute;
  inset: 0.55rem;
  border: 1px solid rgba(255,255,255,0.35);
  border-radius: 1px;
  pointer-events: none;
}
.marker-plate img,
.marker-plate svg {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.4));
}

.marker-caption {
  font-family: var(--sans);
  font-size: 0.6875rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 1.25rem;
}

/* --------------------------------------------------------------------------
   Cards, panels, grids
   -------------------------------------------------------------------------- */

.panel {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.panel + .panel { margin-top: 1.5rem; }
.panel__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.panel__head h2, .panel__head h3 { margin: 0; }

.grid {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.step { max-width: 22rem; }
.step__num {
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--brass);
  display: block;
  margin-bottom: 0.9rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--rule);
}
.step h3 { font-size: 1.25rem; margin-bottom: 0.35em; }
.step p { font-size: 0.9375rem; color: var(--ink-soft); margin: 0; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */

.field { margin-bottom: 1.5rem; }
.field--half { flex: 1 1 12rem; }

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

label, .label {
  display: block;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}

.hint {
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
  color: var(--ink-muted);
  margin: 0.4rem 0 0;
  max-width: var(--measure);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="tel"], input[type="url"],
select, textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brass);
  box-shadow: 0 0 0 3px rgba(164,129,63,0.14);
}
textarea { min-height: 16rem; resize: vertical; }
textarea.tall { min-height: 26rem; }

input[type="file"] {
  font-family: var(--sans);
  font-size: 0.875rem;
  padding: 0.6rem 0;
}

.checkline {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  font-family: var(--sans);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.checkline input { margin-top: 0.25rem; flex: none; }

.charcount {
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-align: right;
  margin-top: 0.35rem;
}

/* --------------------------------------------------------------------------
   Notices and status
   -------------------------------------------------------------------------- */

.notice {
  border-left: 3px solid var(--rule-strong);
  background: var(--paper-deep);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  border-radius: 0 var(--radius) var(--radius) 0;
}
.notice p:last-child { margin-bottom: 0; }
.notice--ok   { border-color: var(--ok);   background: var(--ok-bg); }
.notice--warn { border-color: var(--warn); background: var(--warn-bg); }
.notice--wait { border-color: var(--wait); background: var(--wait-bg); }
.notice--info { border-color: var(--brass); background: #faf6ee; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.3em 0.7em;
  border-radius: var(--radius);
  border: 1px solid currentColor;
  white-space: nowrap;
}
.badge--ok   { color: var(--ok); }
.badge--warn { color: var(--warn); }
.badge--wait { color: var(--wait); }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li {
  position: relative;
  padding-left: 1.9rem;
  margin-bottom: 0.7rem;
  font-size: 0.9375rem;
  line-height: 1.55;
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0.35rem;
  top: 0.55em;
  width: 6px;
  height: 6px;
  background: var(--brass);
  transform: rotate(45deg);
}
.checklist--done li::before { background: var(--ok); }

/* --------------------------------------------------------------------------
   Photo management
   -------------------------------------------------------------------------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.photo-tile {
  border: 1px solid var(--rule);
  background: var(--paper-card);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo-tile img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  background: var(--paper-deep);
}
.photo-tile__body {
  padding: 0.75rem;
  font-family: var(--sans);
  font-size: 0.8125rem;
}
.photo-tile__body input[type="text"] {
  font-family: var(--sans);
  font-size: 0.8125rem;
  padding: 0.4rem 0.5rem;
  margin-top: 0.5rem;
}
.photo-tile--flagged { border-color: var(--warn); }
.photo-tile--flagged img { opacity: 0.45; filter: grayscale(1); }

/* --------------------------------------------------------------------------
   The memorial page itself
   -------------------------------------------------------------------------- */

.memorial {
  background: var(--paper);
  padding-block: clamp(2.5rem, 7vw, 5rem);
}

/* The portrait keeps its own proportions rather than being cropped to a fixed
   frame. Memorial photographs are wedding shots, service portraits, snapshots
   from a shoebox -- forcing them all to one ratio crops heads off. The mat and
   the shadow supply the consistency instead. */
.memorial__portrait {
  width: fit-content;
  max-width: min(22rem, 76vw);
  margin: 0 auto 2.5rem;
  padding: 0.75rem;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  box-shadow: 0 18px 40px -24px rgba(60,44,15,0.4);
}
.memorial__portrait img {
  width: 100%;
  height: auto;
  max-height: 62vh;
  object-fit: contain;
}

.memorial__name {
  font-size: clamp(2.125rem, 1.5rem + 3vw, 3.75rem);
  text-align: center;
  margin-bottom: 0.25em;
}
.memorial__maiden {
  display: block;
  font-size: 0.5em;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  margin-top: 0.35em;
}
.memorial__dates {
  text-align: center;
  font-family: var(--sans);
  font-size: 0.875rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--brass);
  margin-bottom: 1.5rem;
}
.memorial__epitaph {
  text-align: center;
  font-size: clamp(1.1875rem, 1.05rem + 0.7vw, 1.5rem);
  font-style: italic;
  color: var(--ink-soft);
  max-width: 32rem;
  margin: 0 auto;
  text-wrap: balance;
}

.memorial__story {
  max-width: 33rem;
  margin-inline: auto;
  font-size: 1.125rem;
  line-height: 1.8;
  hyphens: auto;
}
.memorial__story p { max-width: none; margin-bottom: 1.35em; }

/* Drop cap. Three lines tall, optically aligned to the cap height rather than
   the em box -- a serif capital sits low in its box and looks sunken without
   the negative top margin. */
.memorial__story p:first-of-type::first-letter {
  float: left;
  font-size: 3.15em;
  line-height: 0.78;
  margin: 0.06em 0.07em -0.06em 0;
  color: var(--brass);
}

/* The vital record, set quietly between the epitaph and the story. */
.memorial__vitals {
  text-align: center;
  font-family: var(--sans);
  font-size: 0.8125rem;
  line-height: 1.9;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  margin-bottom: clamp(2.5rem, 6vw, 3.5rem);
}
/* Stacked, not inline. An inline row with dividers orphans a separator onto
   the wrapped line, and these three facts are quiet enough to want their own
   lines anyway. */
.memorial__vitals span { display: block; }

/* Photographs hang at their own proportions, like frames on a wall, rather
   than being cropped into a tidy grid. align-items:start keeps the tops in
   line so the varied heights read as intentional. */
.memorial__gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  align-items: start;
  gap: clamp(1.25rem, 3vw, 2rem);
  max-width: 56rem;
  margin-inline: auto;
}
.memorial__gallery figure {
  margin: 0;
  background: var(--paper-card);
  padding: 0.6rem;
  border: 1px solid var(--rule);
  box-shadow: 0 10px 26px -18px rgba(60,44,15,0.4);
}
.memorial__gallery img {
  width: 100%;
  height: auto;
}
.memorial__gallery figcaption {
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--ink-muted);
  padding: 0.6rem 0.2rem 0.1rem;
  text-align: center;
}

/* The second person on a shared stone. The brass diamond sits astride the
   rule -- the same ornament used elsewhere on the site, marking a turn of the
   page rather than the end of one memorial and the start of another. */
.memorial__companion {
  position: relative;
  border-top: 1px solid var(--rule);
  margin-top: clamp(3.5rem, 9vw, 6rem);
  padding-top: clamp(3.5rem, 9vw, 6rem);
}
.memorial__companion::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 9px;
  height: 9px;
  background: var(--brass);
  transform: translate(-50%, -50%) rotate(45deg);
  /* A ring of page colour, so the rule appears to pass behind the diamond. */
  box-shadow: 0 0 0 7px var(--paper);
}

.memorial__foot {
  border-top: 1px solid var(--rule);
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-top: 2rem;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
}
.memorial__foot a { color: var(--ink-muted); }

/* --------------------------------------------------------------------------
   Tables (admin)
   -------------------------------------------------------------------------- */

.table-scroll { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 0.875rem;
}
table.data th, table.data td {
  text-align: left;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.data th {
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
}
table.data tr:hover td { background: var(--paper-deep); }

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999px;
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.25rem;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9em;
  letter-spacing: 0.02em;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   Print — people do print these
   -------------------------------------------------------------------------- */

@media print {
  .masthead, .footer, .memorial__foot, .btn, .no-print { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .memorial__portrait { box-shadow: none; }
  .memorial__gallery figure { box-shadow: none; break-inside: avoid; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 8pt; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
