:root {
  color-scheme: light;
  --page: #f4f2ee;
  --surface: #ffffff;
  --ink: #1d1d1b;
  --muted: #5f5e5a;
  --line: #dfdcd5;
  --brand: #0b7a71;
  --brand-dark: #085f58;
  --tile: #e7e4dd;
  --error: #b3261e;
  --radius: 8px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, p, ul, blockquote { margin: 0; padding: 0; }
ul { list-style: none; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
  max-width: 1128px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}
.col-main, .col-side { display: grid; gap: 12px; min-width: 0; }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px 24px;
}
.card.is-empty { display: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; margin-bottom: 8px; }
.card-head h2 { font-size: 20px; font-weight: 600; line-height: 1.25; }

/* Intro */
.intro { padding: 0; overflow: hidden; }
.cover { position: relative; aspect-ratio: 4 / 1; min-height: 110px; background: #10161f; }
.cover > img:first-child { width: 100%; height: 100%; object-fit: cover; }
.cover-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .8s ease; }
.cover-logo { position: absolute; right: 4.4%; top: 50%; width: 9%; min-width: 44px; max-width: 110px; height: auto; transform: translateY(-50%); opacity: 0; transition: opacity .8s ease; }
.cover.is-live .cover-video, .cover.is-live .cover-logo { opacity: 1; }
.intro-body { position: relative; display: flow-root; padding: 0 24px 24px; }
.avatar-wrap { position: relative; width: 152px; height: 152px; margin-top: -92px; margin-bottom: 12px; }
.avatar { width: 100%; height: 100%; border-radius: 50%; border: 4px solid var(--surface); object-fit: cover; background: var(--surface); }
h1 { font-size: 28px; font-weight: 600; line-height: 1.2; }
.headline { font-size: 17px; margin-top: 4px; }
.meta { color: var(--muted); font-size: 14px; margin-top: 8px; }
.meta a { color: var(--brand-dark); font-weight: 600; text-decoration: none; }
.meta a:hover { text-decoration: underline; }
.meta.strong { color: var(--brand-dark); font-weight: 600; margin-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Buttons */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 6px 18px;
  border: 1px solid var(--brand);
  border-radius: 999px;
  background: var(--surface);
  color: var(--brand-dark);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: #e9f4f2; border-width: 1px; box-shadow: inset 0 0 0 1px var(--brand); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: none; }
.btn-small { min-height: 32px; padding: 2px 14px; font-size: 14px; }
.btn-text { border-color: transparent; background: none; padding-inline: 8px; }
.btn:disabled { opacity: .6; cursor: default; }

/* Sections */
.prose { max-width: 70ch; }
.rows { display: grid; gap: 0; }
.row { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); font-size: 14px; }
.row:first-child { border-top: 0; padding-top: 4px; }
.row:last-child { padding-bottom: 0; }
.plain .row { grid-template-columns: minmax(0, 1fr); }
.row h3 { font-size: 16px; font-weight: 600; line-height: 1.3; }
.row h3 a { color: var(--brand-dark); }
.muted { color: var(--muted); }
.row-text { margin-top: 8px; max-width: 65ch; }
.row blockquote { margin-top: 8px; max-width: 65ch; }
.tile {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  background: var(--tile);
  color: var(--muted);
  font-size: 20px; font-weight: 600;
}
.tile.round { border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; }

/* Side rail */
.contact { display: grid; gap: 2px; margin: 0 -8px; }
.contact a {
  display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 12px; align-items: center;
  min-height: 44px; padding: 6px 8px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 14px; font-weight: 600;
  text-decoration: none;
}
.contact a:hover { background: var(--page); }
.contact svg { color: var(--muted); }
.contact span { overflow-wrap: anywhere; }
#contactReveal { margin: 0 8px 6px; }

.stick { display: none; }

/* Editing. Pencils only exist on screen for a signed-in editor. */
.pencil {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.pencil:hover { background: var(--page); color: var(--ink); }
.pencil.on-image { position: absolute; right: 12px; top: 12px; background: var(--surface); color: var(--brand-dark); box-shadow: 0 0 0 1px var(--line); }
.avatar-wrap .pencil.on-image { right: 4px; top: auto; bottom: 4px; }
.intro-body > .pencil { position: absolute; right: 16px; top: 12px; }
body.editing .pencil { display: inline-flex; }
body.editing .card.is-empty { display: block; }
.edit-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.edit-bar-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 24px;
  border: 0;
  border-radius: var(--radius);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(0, 0, 0, .55); }
.dialog h2 { font-size: 20px; font-weight: 600; margin-bottom: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.share { width: min(360px, calc(100vw - 32px)); text-align: center; }
.share img { margin: 0 auto 8px; }
.share .dialog-actions { justify-content: center; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 14px; }
.field input, .field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #8f8d87;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.field textarea { min-height: 96px; resize: vertical; }
.group { padding: 14px 0 2px; border-top: 1px solid var(--line); }
.group:first-child { border-top: 0; padding-top: 0; }
.group-tools { display: flex; justify-content: flex-end; gap: 4px; margin-bottom: 14px; }
.form-error { margin-top: 12px; color: var(--error); font-size: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 10;
  padding: 10px 18px;
  background: #1b1b1b; color: #fff;
  border-radius: 6px;
  font-size: 14px;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 0 0 96px; }
  /* Phone order: intro, contact and links, then the rest of the profile. */
  .col-main { display: contents; }
  .intro { order: 1; }
  .col-side { order: 2; }
  .col-main > .card:not(.intro) { order: 3; }
  .card { border-radius: 0; border-width: 1px 0; padding: 16px; }
  .card.intro { padding: 0; }
  .intro-body { padding: 0 16px 20px; }
  .cover { min-height: 0; }
  .avatar-wrap { width: 128px; height: 128px; margin-top: -64px; }
  h1 { font-size: 24px; }
  .stick {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .actions .btn-primary, .actions .js-save { display: none; }
  .actions { margin-top: 12px; }
}
