/* Holt & Grain Studio portal. Navy and antique gold, Fraunces + Inter. */
:root {
  --navy: #14233b;
  --navy-soft: #24385a;
  --gold: #a8843a;
  --gold-pale: #efe6d2;
  --logo-gold: #d4b680;
  --ink: #1b2430;
  --muted: #5d6878;
  --line: #d8dde6;
  --paper: #f5f6f8;
  --card: #ffffff;
  --ok: #2c6a4d;
  --ok-pale: #e3f0e8;
  --warn: #99502b;
  --warn-pale: #f6e7dd;
  --display: 'Fraunces', Georgia, serif;
  --body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--body);
}
h1, h2, h3 { font-family: var(--display); font-weight: 560; line-height: 1.15; margin: 0; color: var(--navy); }
h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); letter-spacing: -0.01em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--navy); }
.quiet { color: var(--muted); }
.small { font-size: 0.875rem; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }

/* top bar */
.bar {
  background: var(--navy);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  /* the top inset keeps the header clear of the phone's status bar when the portal runs from the home screen */
  padding: calc(14px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 14px max(16px, env(safe-area-inset-left));
  border-bottom: 3px solid var(--gold);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; font: 700 1.02rem/1 'Cinzel', 'Fraunces', Georgia, serif; color: var(--logo-gold); text-decoration: none; letter-spacing: 0.03em; }
.wordmark img { display: block; flex: none; }
.wordmark .llc { font-size: 0.5em; letter-spacing: 0.06em; }
@media (max-width: 370px) { .wordmark { font-size: 0.84rem; gap: 8px; letter-spacing: 0.02em; } .wordmark img { width: 26px; height: 26px; } }
.bar-right { display: flex; align-items: center; gap: 10px; font-size: 0.875rem; }
.bar-right .who { color: #c8d0dd; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .linkbtn { color: #fff; white-space: nowrap; }
@media (max-width: 520px) { .bar-right .who { display: none; } }

.install { background: var(--gold-pale); border-bottom: 1px solid #dccfae; }
.install-in { max-width: 720px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.install-text { flex: 1 1 220px; font-size: 0.9rem; line-height: 1.4; }
.install-text strong { display: block; color: var(--navy); }
.install-actions { display: flex; align-items: center; gap: 6px; }
.install-actions button:not(.linkbtn) { padding: 9px 14px; min-height: 38px; }
.signin .row { margin-top: 4px; }

.page { max-width: 720px; margin: 0 auto; padding: 28px 16px 96px; }

/* buttons and fields */
button, .btn {
  font: 500 0.95rem/1 var(--body);
  border-radius: 8px; border: 1px solid var(--navy);
  background: var(--navy); color: #fff;
  padding: 12px 16px; min-height: 44px; cursor: pointer;
}
button:hover { background: var(--navy-soft); }
button:disabled { opacity: 0.55; cursor: default; }
button.ghost, .btn.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
button.ghost:hover, .btn.ghost:hover { background: #eceff4; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
button.approve { background: var(--ok); border-color: var(--ok); }
button.danger { background: transparent; color: var(--warn); border-color: transparent; padding: 8px 10px; min-height: 36px; }
button.danger:hover { background: var(--warn-pale); }
.linkbtn { background: none; border: none; color: var(--navy); text-decoration: underline; padding: 6px 4px; min-height: 0; font-weight: 400; }
.linkbtn:hover { background: none; color: var(--gold); }

label { display: block; font-weight: 500; font-size: 0.9rem; margin: 0 0 6px; }
input[type=text], input[type=email], input[type=date], textarea, select {
  width: 100%; font: 400 16px/1.4 var(--body); color: var(--ink);
  border: 1px solid #b9c1ce; border-radius: 8px; background: #fff;
  padding: 11px 12px; min-height: 44px;
}
textarea { min-height: 96px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1 1 180px; }
.dropzone { border: 2px dashed #b9c1ce; border-radius: 10px; padding: 14px; background: #fff; }
.dropzone.over { border-color: var(--gold); background: var(--gold-pale); }
.dropzone input[type=file] { width: 100%; font: inherit; }
.dropzone .ready { margin: 8px 0 0; font-weight: 600; color: var(--ok); }
.dropzone .ready:empty { display: none; }
.page.dropping { outline: 3px dashed var(--gold); outline-offset: -6px; border-radius: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.checks label { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; margin: 0; min-height: 36px; }
.checks input { width: 20px; height: 20px; accent-color: var(--navy); }
.hint { color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }

/* panels */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.panel.compose { border-style: dashed; border-color: #b9c1ce; background: #fbfcfd; }
details.compose > summary { cursor: pointer; font-weight: 600; color: var(--navy); list-style: none; min-height: 28px; }
details.compose > summary::-webkit-details-marker { display: none; }
details.compose > summary::before { content: '+ '; color: var(--gold); font-weight: 600; }
details.compose[open] > summary { margin-bottom: 14px; }
details.compose[open] > summary::before { content: '− '; }

/* sign-in */
.signin { max-width: 420px; margin: 8vh auto 0; }
.signin h1 { margin-bottom: 10px; }
.signin .panel { margin-top: 22px; }

/* job list */
.joblist { list-style: none; margin: 18px 0; padding: 0; }
.joblist a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 16px 4px; border-bottom: 1px solid var(--line); text-decoration: none;
}
.joblist a:hover .jobname { color: var(--gold); }
.jobname { font-family: var(--display); font-size: 1.3rem; color: var(--navy); }
.status { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }

/* job header and tabs */
.jobhead { margin-bottom: 18px; }
.jobhead .addr { color: var(--muted); margin-top: 6px; }
.projscope { margin-top: 12px; max-width: 62ch; }
.projscope-label { font-size: 0.85rem; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.projscope .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.note { margin-top: 12px; padding: 10px 14px; border-radius: 0 8px 8px 0; max-width: 62ch; }
.note.crew { background: var(--gold-pale); border-left: 4px solid var(--gold); }
.note.private { background: #e9edf3; border-left: 4px solid var(--navy); }
.note-label { font-size: 0.85rem; font-weight: 600; color: var(--navy); margin-bottom: 2px; }
.note-who { font-weight: 400; color: var(--muted); }
.note .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.jobhead .editjob { display: block; padding: 6px 0; font-size: 0.875rem; margin-bottom: 8px; }
.jobhead form.panel { margin-top: 10px; }
.scope { background: var(--gold-pale); border-left: 4px solid var(--gold); padding: 10px 14px; border-radius: 0 8px 8px 0; margin-top: 14px; }
.preview-note { background: var(--navy); color: #fff; border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.preview-note .linkbtn { color: #fff; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 0 -16px 20px; padding: 0 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  background: none; border: none; border-bottom: 3px solid transparent; border-radius: 0;
  color: var(--muted); padding: 12px 12px; white-space: nowrap; font-weight: 500;
}
.tabs button:hover { background: none; color: var(--navy); }
.tabs button[aria-selected=true] { color: var(--navy); border-bottom-color: var(--gold); }
.count { font-weight: 400; color: var(--muted); }

/* feed items */
.item { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.item .meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 8px; }
.item .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.vis { font-size: 0.82rem; color: var(--muted); margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.vis.private strong { color: var(--navy); }
.vis.shared strong { color: var(--ok); }
.itemactions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.badge { display: inline-block; font-size: 0.8rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #e9edf3; color: var(--navy); }
.badge.approved { background: var(--ok-pale); color: var(--ok); }
.badge.changes_requested { background: var(--warn-pale); color: var(--warn); }
.selhead { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.history { list-style: none; padding: 0; margin: 12px 0 0; font-size: 0.875rem; color: var(--muted); }
.history li { padding: 6px 0; border-top: 1px solid var(--line); }
.history strong { color: var(--ink); font-weight: 600; }

/* photos */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin-top: 12px; }
.thumbs.big { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.thumb { position: relative; aspect-ratio: 1; background: #e6eaf0; border-radius: 8px; overflow: hidden; border: none; padding: 0; min-height: 0; display: block; width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(20, 35, 59, 0.85); color: #fff; font-size: 0.7rem; padding: 2px 7px; border-radius: 999px; }
.photocard { margin: 0; }
.photocard .vis { border-top: none; padding-top: 0; margin-top: 6px; }
.photocard .cap { margin-top: 6px; font-size: 0.9rem; line-height: 1.35; overflow-wrap: anywhere; }
.photocard .cap .linkbtn { display: block; padding: 4px 0; font-size: 0.82rem; }
.doc .docthumb { aspect-ratio: 3 / 2; margin-bottom: 14px; }
.doc .docthumb img { object-fit: contain; background: #eef1f5; }
.doctitle h3 { overflow-wrap: anywhere; }
.doctitle .linkbtn { padding: 4px 0; font-size: 0.82rem; }
.doc .meta { margin: 6px 0 12px; }
.doc .capform { margin-bottom: 10px; }
.capform { margin-top: 6px; }
.capform .row { margin-top: 6px; gap: 6px; }
.capform button { padding: 8px 12px; min-height: 36px; font-size: 0.85rem; }
.lightbox { position: fixed; inset: 0; background: rgba(12, 20, 34, 0.94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.lightbox img { max-width: 100%; max-height: 82vh; border-radius: 6px; }
.lightbox p { color: #fff; margin: 12px 0 0; text-align: center; }
.lightbox button { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: #fff; color: var(--navy); border-color: #fff; }

/* comments */
.comments { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.comment { margin-bottom: 10px; font-size: 0.93rem; }
.comment .who { font-weight: 600; }
.comment .when { color: var(--muted); font-size: 0.8rem; margin-left: 6px; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.commentform { display: flex; gap: 8px; align-items: flex-end; margin-top: 8px; }
textarea.short { min-height: 44px; height: 44px; }

/* timeline drawn as a story rod: the marked stick a finish carpenter
   uses to carry measurements around a room */
.rod { list-style: none; margin: 8px 0 0; padding: 0 0 0 34px; position: relative; }
.rod::before {
  content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 14px; border-radius: 3px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 11px, rgba(20, 35, 59, 0.35) 11px 12px),
    linear-gradient(to right, #d9bd7c, #c9a75e);
  border: 1px solid var(--gold);
}
.rod li { position: relative; padding: 0 0 26px; }
.rod li::before {
  content: ''; position: absolute; left: -31px; top: 11px; width: 22px; height: 2px; background: var(--navy);
}
.rod li.done::before { background: var(--ok); height: 4px; top: 10px; }
.rod .date { font-size: 0.85rem; color: var(--muted); }
.rod .title { font-family: var(--display); font-size: 1.15rem; color: var(--navy); }
.rod li.done .title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line); }
.rod .donemark { color: var(--ok); font-size: 0.85rem; font-weight: 600; }

/* people */
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.people .name { font-weight: 600; }
.people .sub { color: var(--muted); font-size: 0.875rem; overflow-wrap: anywhere; }

.empty { text-align: center; color: var(--muted); padding: 36px 12px; }
.empty h3 { margin-bottom: 6px; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 8px; max-width: calc(100vw - 32px); z-index: 30; box-shadow: 0 6px 24px rgba(20, 35, 59, 0.3); }
.toast.error { background: var(--warn); }

@media (min-width: 640px) {
  .page { padding-top: 40px; }
  .item, .panel { padding: 22px; }
}
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 180ms ease-out; }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
}
