:root {
  --orange: #f68d28;
  --orange-deep: #e0760f;
  --cyan: #51c9e9;
  --cyan-deep: #2ba9cb;
  --ink: #20160c;
  --ink-soft: #6a5b4d;
  --paper: #fbf5ec;
  --paper-2: #f4ead9;
  --card: #ffffff;
  --line: #ecdfca;
  --green: #2f9e44;
  --shadow: 0 1px 2px rgba(60,40,16,.04), 0 10px 30px -16px rgba(60,40,16,.28);
  --radius: 16px;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body {
  margin: 0;
  font-family: var(--body);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(81,201,233,.16), transparent 60%),
    radial-gradient(1000px 600px at -10% 0%, rgba(246,141,40,.14), transparent 55%),
    var(--paper);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 48px;
}

/* ---------- Name gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(32,22,12,.55);
  backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
}
.gate-card {
  background: var(--card); border-radius: 22px; padding: 38px 34px;
  max-width: 460px; width: 100%; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: pop .4s cubic-bezier(.2,.8,.2,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.gate-badge {
  display: inline-block; font-family: var(--display); font-weight: 700;
  font-size: 13px; letter-spacing: .04em; color: #fff;
  background: var(--orange); padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.gate-card h2 { font-family: var(--display); font-size: 26px; margin: 0 0 8px; letter-spacing: -.02em; }
.gate-card p { color: var(--ink-soft); margin: 0 0 20px; line-height: 1.5; }
.gate-form, #gate-form { display: flex; flex-direction: column; gap: 10px; }
#gate-name {
  font-family: var(--body); font-size: 17px; padding: 14px 16px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--paper);
  transition: border-color .2s;
}
#gate-name:focus { outline: none; border-color: var(--cyan); }
#gate-form button {
  font-family: var(--display); font-weight: 700; font-size: 16px; color: var(--ink);
  background: var(--orange); border: none; padding: 14px; border-radius: 12px; cursor: pointer;
  transition: transform .15s, background .2s;
}
#gate-form button:hover { background: var(--cyan); transform: translateY(-1px); }

/* ---------- Masthead ---------- */
.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.5), transparent);
}
.masthead-inner { max-width: 1180px; margin: 0 auto; padding: 40px 24px 30px; }
.brand-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.brand-pill {
  font-family: var(--display); font-weight: 800; letter-spacing: -.01em; color: #fff;
  background: linear-gradient(120deg, var(--orange), var(--orange-deep)); font-size: 15px;
  padding: 7px 15px; border-radius: 999px; box-shadow: 0 6px 16px -8px rgba(224,118,15,.8);
}
.who { font-size: 14px; color: var(--ink-soft); }
.who strong { color: var(--ink); }
.linkbtn { background: none; border: none; color: var(--cyan-deep); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.masthead h1 {
  font-family: var(--display); font-weight: 800; font-size: clamp(34px, 6vw, 58px);
  line-height: .98; letter-spacing: -.035em; margin: 0 0 6px;
  background: linear-gradient(110deg, var(--ink) 30%, var(--orange-deep));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.m-sub { font-family: var(--display); font-weight: 600; font-size: clamp(16px,2.4vw,21px); color: var(--orange-deep); margin: 0 0 18px; }
.m-blurb { max-width: 760px; font-size: 16.5px; line-height: 1.6; color: var(--ink); margin: 0 0 12px; }
.m-legend { max-width: 760px; font-size: 14px; line-height: 1.5; color: var(--ink-soft); margin: 0; font-style: italic; }
.m-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; font-size: 14px; box-shadow: var(--shadow);
}
.stat b { font-family: var(--display); font-size: 20px; margin-right: 6px; color: var(--orange-deep); }

/* ---------- Layout ---------- */
.layout { max-width: 1180px; margin: 0 auto; padding: 28px 24px; display: grid; grid-template-columns: 220px 1fr; gap: 36px; align-items: start; }
.sidenav { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.sidenav a {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  text-decoration: none; color: var(--ink-soft); font-size: 14px; font-weight: 500;
  padding: 9px 12px; border-radius: 9px; border-left: 3px solid transparent; transition: all .15s;
}
.sidenav a:hover { background: var(--paper-2); color: var(--ink); }
.sidenav a.active { background: #fff; color: var(--ink); border-left-color: var(--orange); box-shadow: var(--shadow); }
.sidenav a .navcount { font-size: 11px; background: var(--paper-2); color: var(--ink-soft); padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.sidenav a .navcount.has { background: var(--cyan); color: #08323d; }

/* ---------- Page sections ---------- */
.pagesec { margin-bottom: 48px; scroll-margin-top: 16px; }
.pagesec-head { margin-bottom: 18px; }
.pagesec-head h2 {
  font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.025em;
  margin: 0 0 4px; display: flex; align-items: baseline; gap: 12px;
}
.pagesec-head h2 .pcount { font-family: var(--body); font-size: 14px; font-weight: 600; color: var(--ink-soft); }
.pageshot {
  width: 100%; border-radius: 14px; border: 1px solid var(--line); margin: 14px 0 20px;
  box-shadow: var(--shadow); max-height: 280px; object-fit: cover; object-position: top; display: block;
}

/* ---------- Change card ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 22px 18px; margin-bottom: 18px; box-shadow: var(--shadow); position: relative;
  transition: box-shadow .2s;
}
.card:hover { box-shadow: 0 1px 2px rgba(60,40,16,.04), 0 18px 40px -20px rgba(60,40,16,.35); }
.card.has-notes { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan), var(--shadow); }
.card.is-decision { background: linear-gradient(180deg, #fff, #fffaf2); border-color: var(--orange); }

.card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.badge { font-family: var(--display); font-weight: 700; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 4px 9px; border-radius: 6px; }
.badge.reword { background: #fde8cf; color: #9a560a; }
.badge.rename { background: #e2f5fb; color: #1d7e98; }
.badge.add { background: #dcf3e1; color: #1f7a32; }
.badge.decision { background: var(--orange); color: #fff; }
.card-where { font-size: 13.5px; color: var(--ink-soft); font-weight: 500; }

.copyblock { border-radius: 11px; padding: 13px 15px; margin: 8px 0; position: relative; }
.copyblock .lbl { font-family: var(--display); font-weight: 700; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; display: block; margin-bottom: 5px; }
.copyblock .txt { font-size: 16px; line-height: 1.5; }
.copyblock .txt strong { font-weight: 700; }
.copy-current { background: #f7f1e8; border: 1px solid var(--line); }
.copy-current .lbl { color: var(--ink-soft); }
.copy-current .txt { color: #8b7a68; }
.copy-proposed { background: linear-gradient(180deg, #fffdf8, #fff7ea); border: 1.5px solid var(--orange); }
.copy-proposed .lbl { color: var(--orange-deep); }
.copy-proposed .txt { color: var(--ink); }
.arrow { text-align: center; color: var(--orange); font-size: 18px; line-height: 0; margin: 2px 0; }
.wc { position: absolute; top: 11px; right: 13px; font-size: 11.5px; font-weight: 600; color: var(--ink-soft); background: rgba(255,255,255,.7); padding: 2px 8px; border-radius: 999px; }
.wc.match { color: var(--green); }
.wc.diff { color: var(--orange-deep); }

.why { font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin: 12px 2px 4px; }
.why::before { content: "Why "; font-weight: 700; color: var(--orange-deep); }
.cardnote { font-size: 13px; line-height: 1.5; color: var(--cyan-deep); background: #effbfe; border-left: 3px solid var(--cyan); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 10px 2px 2px; }

/* decision options */
.dec-opts { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 2px 4px; }
.dec-opt { font-family: var(--body); font-size: 13.5px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; transition: all .15s; }
.dec-opt:hover { border-color: var(--orange); }
.dec-opt.picked { background: var(--orange); border-color: var(--orange); color: #fff; }

/* notes */
.notes { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.note {
  display: flex; gap: 10px; padding: 9px 0; font-size: 14.5px; line-height: 1.45;
  animation: fadein .3s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.note-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cyan); color: #06323d; font-family: var(--display); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.note-body { flex: 1; }
.note-meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 1px; }
.note-meta b { color: var(--ink); font-weight: 700; }
.note-del { color: #c0392b; font-size: 12px; margin-left: 8px; opacity: 0; }
.note:hover .note-del { opacity: 1; }
.noteform { display: flex; gap: 8px; margin-top: 10px; }
.noteform input {
  flex: 1; font-family: var(--body); font-size: 16px; padding: 10px 13px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); transition: border-color .2s;
}
.noteform input:focus { outline: none; border-color: var(--cyan); background: #fff; }
.noteform button { font-family: var(--display); font-weight: 700; font-size: 14px; background: var(--ink); color: #fff; border: none; padding: 0 16px; border-radius: 10px; cursor: pointer; transition: background .2s; }
.noteform button:hover { background: var(--orange-deep); }
.addnote-toggle { font-size: 13.5px; font-weight: 600; color: var(--cyan-deep); background: none; border: none; cursor: pointer; padding: 6px 0; margin-top: 6px; }

/* ---------- Approve bar ---------- */
.approvebar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  background: rgba(255,255,255,.82); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); box-shadow: 0 -8px 30px -18px rgba(60,40,16,.4);
}
.approvebar-inner { max-width: 1180px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.approve-status { font-size: 14px; color: var(--ink-soft); }
.approve-status.done { color: var(--green); font-weight: 600; }
.approve-btn {
  font-family: var(--display); font-weight: 800; font-size: 16px; color: var(--ink);
  background: linear-gradient(120deg, var(--orange), #ffb053); border: none; padding: 13px 26px;
  border-radius: 12px; cursor: pointer; white-space: nowrap; box-shadow: 0 8px 20px -8px rgba(224,118,15,.7);
  transition: transform .15s, filter .2s;
}
.approve-btn:hover { transform: translateY(-1px); filter: brightness(1.04); }
.approve-btn.approved { background: var(--green); color: #fff; cursor: default; box-shadow: none; }
.approve-btn:disabled { opacity: .6; }

.foot { max-width: 1180px; margin: 0 auto; padding: 20px 24px 0; font-size: 13px; color: var(--ink-soft); display: flex; align-items: center; gap: 10px; }
.foot-dot { opacity: .5; }

.toast { position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; transition: all .3s; z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding-top: 0; }
  /* jump-nav: a single swipeable row that sticks to the top while you scroll */
  .sidenav {
    position: sticky; top: 0; z-index: 30;
    flex-direction: row; flex-wrap: nowrap; gap: 7px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    margin: 0 -24px 20px; padding: 11px 24px;
    background: rgba(251,245,236,.94); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .sidenav::-webkit-scrollbar { display: none; }
  .sidenav a { flex: 0 0 auto; white-space: nowrap; border-left: none; padding: 9px 14px; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
  .sidenav a.active { border-color: var(--orange); box-shadow: none; }
  .masthead-inner { padding-top: 30px; }
  /* touch ergonomics */
  .addnote-toggle { min-height: 44px; }
  .noteform input, .noteform button { min-height: 46px; }
  .note-del { opacity: 1; margin-left: 10px; } /* no hover on phones — keep delete reachable */
  .copyblock .txt { font-size: 16.5px; }
  body { padding-bottom: 56px; }
}
