/* ewdhq page layout. House primitives come from ui/ui.css; this file only arranges them. */

.home {
  padding-block: var(--ds-space-9) 0;
}

.home-section {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-5);
}

.home-section > h2 {
  margin: 0;
}

/* Home page previews: a small framed image of each page or prototype. Prototypes keep
   their own look; the frame and caption are what tie them to the house style. */
.previews {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--ds-space-7) var(--ds-space-6);
}

.preview {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
  color: var(--ds-color-ink);
  text-decoration: none;
}

.preview__frame {
  display: block;
  padding: var(--ds-space-1);
  border: var(--ds-rule-hairline) solid var(--ds-color-rule);
  margin-bottom: var(--ds-space-2);
  transition: border-color var(--ds-duration-fast) var(--ds-ease);
}

.preview__frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
}

.preview__dark {
  display: none !important;
}

:root[data-theme="dark"] .preview__light {
  display: none !important;
}

:root[data-theme="dark"] .preview__dark {
  display: block !important;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .preview__light {
    display: none !important;
  }

  :root:not([data-theme="light"]) .preview__dark {
    display: block !important;
  }
}

.preview__title {
  font-family: var(--ds-font-text);
  font-style: italic;
  font-size: var(--ds-text-xl);
  line-height: var(--ds-leading-snug);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--ds-color-gold);
  text-underline-offset: 0.25em;
}

.preview__desc {
  color: var(--ds-color-muted);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-snug);
}

.preview__meta {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-xs);
  color: var(--ds-color-muted);
}

a.preview:hover .preview__frame {
  border-color: var(--ds-color-gold);
}

a.preview:hover .preview__title {
  color: var(--ds-color-accent);
}

/* The Family page: the trees sit below the masthead. */
.masthead + .previews {
  margin-top: var(--ds-space-7);
}

@media (max-width: 560px) {
  .previews {
    grid-template-columns: 1fr;
  }
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ds-space-2) var(--ds-space-5);
}

.cv-section {
  display: grid;
  grid-template-columns: 11rem minmax(0, 1fr);
  gap: var(--ds-space-3) var(--ds-space-6);
  padding-block: var(--ds-space-6);
  border-top: var(--ds-rule-hairline) solid var(--ds-color-rule);
}

.cv-section > h2 {
  margin: 0;
  padding-top: 0.35em;
}

.cv-body {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-5);
  min-width: 0;
}

.entry {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
}

.entry__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--ds-space-1) var(--ds-space-4);
}

.entry__title {
  margin: 0;
  font-family: var(--ds-font-text);
  font-weight: var(--ds-weight-bold);
  font-size: var(--ds-text-md);
  line-height: var(--ds-leading-snug);
}

.entry__date {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-sm);
  color: var(--ds-color-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.entry__sub {
  color: var(--ds-color-muted);
}

.entry ul {
  margin: var(--ds-space-1) 0 0;
  padding-left: 1.1em;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
}

.entry p {
  margin: 0;
}

.pubs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-4);
}

.pubs li {
  overflow-wrap: anywhere;
}

.pubs cite {
  font-style: normal;
  color: var(--ds-color-ink);
}

.pubs .venue {
  color: var(--ds-color-muted);
}

.skills {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-3);
}

.skills dt {
  font-weight: var(--ds-weight-semibold);
}

.skills dd {
  margin: 0;
  color: var(--ds-color-muted);
}

@media (max-width: 720px) {
  .cv-section {
    grid-template-columns: 1fr;
  }
}

/* ---------- Travels ---------- */

.travels {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-8);
}

.world {
  margin: 0;
}

.world__scroll {
  overflow-x: auto;
}

.map {
  display: block;
  width: 100%;
  height: auto;
}

/* Engraving */
.m-hatch {
  stroke: var(--ds-color-muted);
  stroke-width: 0.5;
  opacity: 0.7;
}

.m-hatch-gold {
  stroke: var(--ds-color-gold);
  stroke-width: 0.55;
  opacity: 0.8;
}

.m-engraved use,
.m-engraved path {
  fill: none;
  stroke-linejoin: round;
}

.m-wl {
  stroke: var(--ds-color-muted);
}

.m-wl-gap {
  stroke: var(--ds-color-bg);
}

.m-engraved .m-land {
  stroke: none;
}

.m-coast {
  stroke: var(--ds-color-ink);
  stroke-width: 0.7;
}

.m-visited {
  stroke: var(--ds-color-gold);
  stroke-width: 0.9;
}

.m-border {
  fill: none;
  stroke: var(--ds-color-ink);
  stroke-width: 0.6;
  stroke-dasharray: 3 2;
  opacity: 0.6;
}

.m-grat {
  fill: none;
  stroke: var(--ds-color-rule);
  stroke-width: 0.6;
}

.m-sea {
  font-family: var(--ds-font-text);
  font-style: italic;
  fill: var(--ds-color-muted);
}

.m-route {
  fill: none;
  stroke: var(--ds-color-gold);
  stroke-width: 1.4;
  stroke-dasharray: 0.1 4.2;
  stroke-linecap: round;
}

.m-home-dot {
  fill: var(--ds-color-ink);
}

.m-home-ring {
  fill: none;
  stroke: var(--ds-color-gold);
  stroke-width: 1;
}

.m-place,
.m-deg {
  font-family: var(--ds-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  fill: var(--ds-color-ink);
  paint-order: stroke;
  stroke: var(--ds-color-bg);
  stroke-width: 3px;
}

.m-place {
  font-size: 11px;
  text-transform: uppercase;
}

.m-deg {
  font-size: 8.5px;
  fill: var(--ds-color-muted);
  stroke: none;
}

.m-place-serif {
  font-family: var(--ds-font-text);
  font-style: italic;
  font-size: 15px;
  fill: var(--ds-color-ink);
  paint-order: stroke;
  stroke: var(--ds-color-bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.m-pin {
  fill: var(--ds-color-gold);
  stroke: var(--ds-color-bg);
  stroke-width: 1.2;
}

.m-frame,
.m-frame-outer {
  fill: none;
  stroke: var(--ds-color-ink);
  stroke-width: 0.7;
}

.m-frame-outer {
  stroke-width: 1.6;
}

.m-bar {
  fill: var(--ds-color-ink);
}

.m-rose-dark {
  fill: var(--ds-color-gold);
}

.m-rose-light {
  fill: var(--ds-color-bg);
  stroke: var(--ds-color-gold);
  stroke-width: 0.6;
}

.m-rose-ring {
  fill: none;
  stroke: var(--ds-color-gold);
  stroke-width: 0.6;
}

.m-rose-n {
  font-family: var(--ds-font-display);
  font-size: 15px;
  fill: var(--ds-color-gold-text);
}

.m-leader {
  stroke: var(--ds-color-gold);
  stroke-width: 0.9;
}

.m-medal-ring {
  fill: none;
  stroke: var(--ds-color-gold);
  stroke-width: 2;
}

.m-medal-ring2 {
  fill: none;
  stroke: var(--ds-color-gold);
  stroke-width: 0.8;
}

.m-medal-num {
  font-family: var(--ds-font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  fill: var(--ds-color-gold-text);
  paint-order: stroke;
  stroke: var(--ds-color-bg);
  stroke-width: 3px;
}

.m-medal-name {
  font-family: var(--ds-font-text);
  font-style: italic;
  font-size: 15px;
  fill: var(--ds-color-ink);
  paint-order: stroke;
  stroke: var(--ds-color-bg);
  stroke-width: 4px;
  stroke-linejoin: round;
}

.m-medal,
.m-medal text {
  text-decoration: none;
}

.m-medal:hover .m-medal-ring,
.m-medal:focus-visible .m-medal-ring {
  stroke-width: 3.5;
}

.m-medal:hover .m-medal-name {
  fill: var(--ds-color-accent);
}

/* Contents strip under the world plate */
.plate-index {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-block: var(--ds-rule-hairline) solid var(--ds-color-rule);
}

.plate-index a {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-1);
  padding: var(--ds-space-4);
  color: var(--ds-color-ink);
  text-decoration: none;
  border-left: var(--ds-rule-hairline) solid var(--ds-color-rule);
}

.plate-index a:first-child {
  border-left: 0;
}

.plate-index a:hover .plate-index__title {
  color: var(--ds-color-accent);
  text-decoration: underline;
  text-decoration-color: var(--ds-color-gold);
  text-underline-offset: 0.25em;
}

.plate-index__num,
.plate-index__when {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-xs);
  letter-spacing: var(--ds-tracking-tag);
  text-transform: uppercase;
  color: var(--ds-color-gold-text);
}

.plate-index__when {
  color: var(--ds-color-muted);
  text-transform: none;
}

.plate-index__title {
  font-family: var(--ds-font-text);
  font-style: italic;
  font-size: var(--ds-text-lg);
}

/* Plates */
.plate {
  scroll-margin-top: var(--ds-space-6);
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-6);
  padding-top: var(--ds-space-5);
  border-top: var(--ds-rule-double) double var(--ds-color-gold);
}

.plate__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--ds-space-1) var(--ds-space-5);
}

.plate__num {
  grid-column: 1 / -1;
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-xs);
  letter-spacing: var(--ds-tracking-eyebrow);
  text-transform: uppercase;
  color: var(--ds-color-gold-text);
}

.plate__title {
  margin: 0;
  font-family: var(--ds-font-display);
  font-weight: var(--ds-weight-regular);
  font-size: var(--ds-text-3xl);
  line-height: var(--ds-leading-tight);
}

.plate__when {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-sm);
  color: var(--ds-color-muted);
}

.plate__rows {
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-6);
}

/* Justified rows: each figure grows by its aspect ratio (--a), so a row shares one height. */
.plate__row {
  display: flex;
  gap: var(--ds-space-4);
}

.plate__fig {
  flex: var(--a) 1 0;
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--ds-space-2);
}

.plate__fig--inset {
  justify-content: center;
}

.plate__open {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.plate__open img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--a);
  object-fit: cover;
  transition: filter var(--ds-duration-base) var(--ds-ease);
}

.plate__open:hover img {
  filter: brightness(1.04) contrast(1.03);
}

.plate__fig figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0 var(--ds-space-3);
  font-size: var(--ds-text-sm);
  line-height: var(--ds-leading-snug);
}

.plate__n,
.plate__coord {
  font-family: var(--ds-font-mono);
  font-size: var(--ds-text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ds-color-gold-text);
}

.plate__coord {
  margin-left: auto;
  color: var(--ds-color-muted);
}

.plate__place {
  font-family: var(--ds-font-text);
  font-style: italic;
}

/* Photo viewer */
.viewer {
  max-width: min(96vw, 1600px);
  max-height: 96vh;
  padding: var(--ds-space-4);
  border: var(--ds-rule-double) double var(--ds-color-gold);
  background: var(--ds-color-bg);
  color: var(--ds-color-ink);
}

.viewer::backdrop {
  background: var(--ds-color-ink);
  opacity: 0.82;
}

.viewer img {
  display: block;
  max-width: 100%;
  max-height: calc(96vh - 7rem);
  margin-inline: auto;
}

.viewer__caption {
  margin: var(--ds-space-3) 0 0;
  font-family: var(--ds-font-text);
  font-style: italic;
  text-align: center;
}

.viewer form {
  display: flex;
  justify-content: flex-end;
  margin-bottom: var(--ds-space-2);
}

.viewer__close {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ds-color-ink);
  font: inherit;
  font-size: var(--ds-text-sm);
  text-decoration: underline;
  text-decoration-color: var(--ds-color-gold);
  text-underline-offset: 0.3em;
  cursor: pointer;
}

@media (max-width: 720px) {
  .plate-index {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .plate-index a:nth-child(3) {
    border-left: 0;
  }

  .plate-index a:nth-child(n + 3) {
    border-top: var(--ds-rule-hairline) solid var(--ds-color-rule);
  }

  .plate__row {
    flex-wrap: wrap;
    row-gap: var(--ds-space-5);
  }

  .plate__fig {
    flex-basis: 100%;
  }
}
