/* Reading surfaces use the platform's regular text face and a book face for titles. */
:root {
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --reading-ink: #303329;
  --reading-muted: #585e50;
  --note-size: .8125rem;
  --control-size: .875rem;
}

body { font-size: 1rem; }
.research-review { margin-top: 1rem; border-top: 1px solid #ccc9b9; }
.research-review summary { cursor: pointer; padding: .8rem 0; font-weight: 650; }
.research-review a { color: #254e42; text-decoration: underline; text-underline-offset: .15em; }
.profile-head h3, .dialog-top h3, .plot-card h3, .event h3, .section-title h2 {
  letter-spacing: -.025em;
  line-height: 1.14;
  overflow-wrap: anywhere;
}
.role, .family-tag, .small-label, .route-card small, .plot-place small, .source-card small {
  font-size: var(--note-size);
  line-height: 1.45;
}
.detail-body, .plot-card, .event, .coverage, .source-card {
  overflow-wrap: anywhere;
}
.detail-body .person-bio, .dock-prose, .grower-approach p,
.detail-body .holding p, .detail-body .family-entry p, .event p, .coverage p, .intro {
  font: 400 1rem/1.52 var(--sans);
  letter-spacing: normal;
  color: var(--reading-ink);
}
.detail-body .person-bio { font-size: 1.0625rem; }
.grower-approach { padding: .75rem .875rem; }
.grower-approach h4, .detail-heading, .holding h4 { line-height: 1.3; }
.grower-approach h4 { font-size: var(--control-size); }
.bio-heading { font-size: .75rem; }
.grower-approach a, .source-links a, .geo-place-detail > a, .geo-sources a, .geo-sources button {
  font-size: var(--note-size);
  line-height: 1.45;
  text-underline-offset: .17em;
}
.source-links { gap: .2rem .6rem; }
.source-card, .relation-row .name, .group-button, .plot-families,
.explore-actions button, .tabs button, .places-link { font-size: var(--control-size); }
.relation-row .rel, .people-line, .event-kind { font-size: var(--note-size); }
.relation-row { min-height: 2.5rem; }
.rel-evidence .evidence-btn { flex: none; }
.filters input, .field select, .source-filter input,
.estate-picker select, .geo-controls select, #find {
  font-size: 1rem;
  line-height: 1.35;
}
.source-filter:focus-within, .find:focus-within { outline: 2px solid #996731; outline-offset: 2px; }
.find .results button, .source-card { font-weight: 500; }
.find .results small { font-size: var(--note-size); }
.filters > *, .geo-controls > * { min-width: 0; max-width: 100%; }
.geo-intro { font-size: var(--control-size); line-height: 1.45; }
.geo-detail-links { max-height: none; overflow: visible; }
.geo-place-detail p, .geo-place-detail summary, .hill-records, .hill-records summary {
  font-size: var(--control-size); line-height: 1.45;
}
.geo-detail-links button { font-size: var(--control-size); }
.geo-detail-links small { font-size: .75rem; }
.geo-region-list button { text-align: start; }
.geo-region-list small { flex-shrink: 0; }
#geo-content, .dialog-top > div { min-width: 0; overflow-wrap: anywhere; }

@media (max-width: 760px) and (orientation: portrait) {
  .workspace { --map-height: clamp(255px, calc(100svh - 458px), 660px); }
}

@media (max-width: 760px) {
  .inspector.open .id-row { align-items: center; }
  .id-row > :last-child { min-width: 0; }
  .inspector.open .profile-head h3 { font: 400 1.5rem/1.12 var(--serif); letter-spacing: -.025em; }
  .inspector.open .detail-body { min-height: 0; }
  .inspector.open .tabs { flex-wrap: wrap; gap: 0 1rem; }
  .tabs button, .explore-actions button, #close-sheet, .dialog-top #close-dialog,
  .relation-row, .rel-evidence .evidence-btn, #peek-record, #peek-near,
  .bio-controls button, .bio-controls a, .places-link,
  .geo-region-list button, .geo-detail-links button, .geo-place-detail summary,
  .hill-records summary, .plot-card .group-button, .geo-controls select,
  .filters input, .source-filter, .geo-sources button { min-height: 44px; }
  #close-sheet, .dialog-top #close-dialog, .rel-evidence .evidence-btn,
  .explore-actions button + button { min-width: 44px; }
  .inspector.open #close-sheet, .dialog-top #close-dialog { height: 44px; }
  .bio-controls {
    flex-wrap: wrap; gap: 0 .18rem; align-items: center;
  }
  .bio-controls button, .bio-controls strong, .bio-controls a {
    display: inline-flex; align-items: center;
    font: 550 var(--note-size)/1.3 var(--sans); padding: .2rem .38rem;
  }
  .bio-controls button[aria-pressed="true"] {
    background: transparent; color: #234b37;
    text-decoration: underline; text-decoration-color: #627e61;
    text-decoration-thickness: 2px; text-underline-offset: .35em;
  }
  .bio-controls strong { padding-left: 0; }
  .bio-controls a { margin-inline-start: auto; min-width: 44px; justify-content: flex-end; }
  .mobile-bio { margin-top: .45rem; padding-top: 0; }
  .dock-prose { font-size: 1.0625rem; line-height: 1.48; margin: 0; max-height: none; overflow: visible; }
  #selection-peek { padding: .55rem .75rem .75rem; }
  .peek-name small { font: 450 var(--note-size)/1.3 var(--sans); white-space: normal; }
  .peek-name strong { font: 400 1.25rem/1.12 var(--serif); letter-spacing: -.023em; overflow-wrap: anywhere; }
  #peek-record {
    display: grid; column-gap: .55rem; row-gap: .2rem;
    grid-template-columns: auto minmax(0,1fr);
  }
  .peek-medal { grid-row: 1 / 3; }
  .peek-open-label {
    display: block; grid-column: 2; margin: 0;
    font: 500 .75rem/1.2 var(--sans); color: #42604c;
    text-decoration: underline; text-underline-offset: 2px;
  }
  .peek-chevron { display: none; }
  #peek-near { flex: none; font-size: var(--note-size); }
  .source-filter { height: auto; }
  #plot-search, #ledger-search, #source-search { font-size: 1rem; }
  #source-search { padding-block: .42rem; }
  .results button { min-height: 44px; }
  .source-links a, .geo-sources a, .grower-approach a, .geo-place-detail > a { display: inline-block; padding: .35rem 0; }
  .geo-controls { flex-wrap: wrap; }
  .geo-controls select {
    flex: 1 1 9.5rem; height: max(44px, 2.65rem); font-size: 1rem;
    appearance: none; padding: .35rem 1.75rem .35rem .6rem;
    background: #fffdf6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%235c6055' stroke-width='1.6'/%3E%3C/svg%3E") right .5rem center/.7rem auto no-repeat;
  }
  .geo-sources { align-items: center; }
  .geo-region-list button { flex-wrap: wrap; gap: 4px 8px; }
  .geo-detail-links button { padding: .35rem .55rem; }
  .workspace.fullscreen #selection-peek { max-height: 43dvh; overflow-y: auto; }
}

/* One scrolling sheet keeps a long name or larger type from squeezing the biography. */
@media (max-width: 760px) {
  .inspector.open, .workspace.fullscreen .inspector.open {
    display: block; overflow-y: auto; overscroll-behavior: contain;
  }
  .inspector.open .profile-head { display: contents; }
  .inspector.open .profile-head::before, .inspector.open .profile-head::after { display: none; }
  .inspector.open .profile-cap {
    position: sticky; top: 0; z-index: 2; padding: 4px 14px;
    background: #f5f1e5; border-bottom: 1px solid #ddd7c7;
  }
  .inspector.open .id-row {
    margin: 0; padding: .8rem 1rem;
    background: #f5f1e5;
    background-image: linear-gradient(90deg,#f5f1e5 35%,#f5f1e5d6),url('vineyard.jpg');
    background-position: center; background-size: cover;
  }
  .inspector.open .detail-body { overflow: visible; }
}
@media (max-width: 760px) and (max-height: 620px) {
  .inspector.open, .workspace.fullscreen .inspector.open { height: min(94dvh,42rem); }
}
@media (min-width: 761px) and (max-height: 540px) {
  .workspace:not(.fullscreen) .inspector { display: block; overflow-y: auto; }
  .workspace:not(.fullscreen) .detail-body { overflow: visible; }
}

.record-controls { display: flex; align-items: center; gap: .4rem; flex: none; }
#record-back { display: none; }
#record-back span {display:none}
#record-back.to-navigator:not([hidden]) {display:inline-flex;align-items:center;justify-content:center;gap:4px;border-radius:20px;padding:0 10px;width:auto;height:44px;background:#eee8da;color:#4d493e;font:600 .8125rem/1 var(--sans)}
#record-back.to-navigator span {display:inline}
#record-back.to-navigator .icon {width:16px;height:16px}
@media (max-width: 760px) {
  #record-back {
    display: inline-grid; place-items: center;
    width: 44px; height: 44px;
    background: #eee8da; color: #544e42; border-radius: 50%;
  }
  #record-back .icon { width: 18px; height: 18px; }
}

.vineyard-head {
  display: flex; flex: none; align-items: center; justify-content: space-between;
  gap: .65rem; padding: .8rem 1.1rem;
  position: sticky; top: 0; z-index: 2;
  background: #f5f1e5; border-bottom: 1px solid var(--line);
}
.vineyard-title { min-width: 0; }
.vineyard-title .cru { display: inline-block; }
.vineyard-title h3 {
  margin: .25rem 0 0; font: 500 clamp(1.25rem,2vw,1.65rem)/1.1 var(--serif);
  color: var(--reading-ink); letter-spacing: -.025em; overflow-wrap: anywhere;
}
.detail-body .vineyard-location {
  display: flex; align-items: baseline; gap: .4rem; margin: 0 0 .85rem;
  color: var(--reading-muted); font: 450 .9rem/1.45 var(--sans);
}
.vineyard-location .icon, .vineyard-sources .icon { align-self: flex-start; width: 1rem; height: 1rem; margin-top: .17rem; flex: none; }
.vineyard-group + .vineyard-group { margin-top: 1.25rem; }
.vineyard-group h4 { margin: 0; font: 600 1.12rem/1.3 var(--serif); color: var(--reading-ink); }
.vineyard-entry { padding: .5rem 0 .35rem; border-bottom: 1px solid var(--line); }
.vineyard-entry h5 { margin: 0; }
.vineyard-entry .group-button { min-height: 44px; font: 650 1rem/1.35 var(--sans); text-align: left; }
.detail-body .vineyard-entry p { margin: 0; font: 400 1rem/1.48 var(--sans); color: var(--reading-ink); }
.parcel-location { display: block; font: 450 .875rem/1.4 var(--sans); margin-top: .35rem; color: var(--reading-muted); }
.vineyard-sources { display: flex; align-items: baseline; gap: 0 .55rem; margin: 0; }
.vineyard-sources .icon { width: .85rem; height: .85rem; margin-top: .95rem; color: var(--reading-muted); }
.vineyard-sources a { display: inline-block; align-content: center; min-height: 44px; padding: .6rem 0; }
.vineyard-body .record-feedback { border-top: 0; margin-top: .4rem; }
.plot-card h3 button { min-height: 44px; color: var(--wine); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .13em; }
@media (max-width: 760px) {
  .vineyard-head { padding: .55rem 1rem; }
  .vineyard-head .record-controls button:not([hidden]) { width: 44px; min-width: 44px; height: 44px; }
  .vineyard-head #record-back.to-navigator span { display: none; }
}
