/* base.css: page chrome (toolbar, stage, edit affordances, print plumbing).
   Themes own everything inside .resume. Themes may set --stage-bg on :root. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--stage-bg, #e7e3dd);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: background .5s ease;
}

/* ---------- toolbar ---------- */
.tb {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: rgba(16, 17, 20, .86);
  -webkit-backdrop-filter: saturate(160%) blur(18px); backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
}
.tb-row {
  max-width: 1320px; margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 14px;
}
.tb-title { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; font-size: 15px; letter-spacing: .01em; }
.tb-title strong { font-weight: 650; }
.tb-title span { color: rgba(255,255,255,.5); font-size: 13px; }
.tb-designs {
  margin: 0 auto; display: flex; gap: 2px; padding: 3px;
  background: rgba(255,255,255,.07); border-radius: 999px;
  min-width: 0; overflow-x: auto; scrollbar-width: none; overscroll-behavior-x: contain;
}
.tb-designs::-webkit-scrollbar { display: none; }
.tb-chip { flex: none; }
.tb-chip {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-size: 13px; font-weight: 550;
  color: rgba(255,255,255,.62); background: transparent;
  padding: 7px 15px; border-radius: 999px; white-space: nowrap;
  transition: color .2s, background .25s, box-shadow .25s;
}
.tb-chip:hover { color: #fff; }
.tb-chip[aria-selected="true"] { color: #111; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.tb-actions { display: flex; gap: 8px; }
.tb-btn {
  appearance: none; cursor: pointer; font: inherit; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  border: 1px solid transparent;
  transition: background .2s, border-color .2s, transform .15s, color .2s;
}
.tb-btn[hidden] { display: none; }
.tb-btn:active { transform: scale(.97); }
.tb-btn svg, .ed-ctl svg, .r-contact svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex: none;
}
.tb-ghost { color: rgba(255,255,255,.85); background: transparent; border-color: rgba(255,255,255,.18); }
.tb-ghost:hover { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.3); }
.tb-primary { color: #111; background: #fff; }
.tb-primary:hover { background: #f1ede4; }
#btn-edit .i-done { display: none; }
#btn-edit[aria-pressed="true"] { background: #fff; color: #111; border-color: #fff; }
#btn-edit[aria-pressed="true"] .i-done { display: block; }
#btn-edit[aria-pressed="true"] .i-edit { display: none; }

/* download menu */
.dl { position: relative; }
.dl-caret { width: 13px !important; height: 13px !important; opacity: .6; transition: transform .2s; }
#btn-download[aria-expanded="true"] .dl-caret { transform: rotate(180deg); }
.dl-menu {
  position: absolute; right: 0; top: calc(100% + 10px); width: 290px; padding: 6px;
  background: #fff; color: #14161a; border-radius: 16px;
  box-shadow: 0 24px 60px -10px rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.06);
  transform-origin: top right; animation: dl-in .16s ease;
}
.dl-menu[hidden] { display: none; }
@keyframes dl-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.dl-menu button {
  appearance: none; border: 0; background: transparent; cursor: pointer; font: inherit; color: inherit;
  width: 100%; text-align: left; display: flex; gap: 12px; align-items: flex-start;
  padding: 11px 12px; border-radius: 11px; transition: background .15s;
}
.dl-menu button:hover, .dl-menu button:focus-visible { background: #f2efe9; outline: none; }
.dl-menu svg { width: 20px; height: 20px; margin-top: 2px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.dl-menu strong { display: block; font-size: 14px; font-weight: 650; }
.dl-menu em { display: block; font-style: normal; font-size: 12px; color: #6b7078; margin-top: 2px; }

.edit-hint {
  position: fixed; top: 58px; left: 0; right: 0; z-index: 49;
  background: #fff7dc; color: #4a3b06; font-size: 13px; text-align: center;
  padding: 8px 16px; border-bottom: 1px solid #ecd98f;
}
.edit-hint[hidden] { display: none; }

/* ---------- stage and sheet ---------- */
.stage { padding: 92px 12px 72px; display: flex; justify-content: center; }
body.editing .stage { padding-top: 128px; }
.sheet {
  width: 816px;            /* US Letter at 96dpi. Themes design for this fixed width. */
  flex: none;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 18px 60px -12px rgba(0,0,0,.28);
  /* zoom is set inline by app.js so the sheet fits small screens */
}
.resume { min-height: 1056px; }
.resume ul { list-style: none; margin: 0; padding: 0; }
.resume h1, .resume h2, .resume h3, .resume p { margin: 0; }

/* ---------- edit mode ---------- */
body.editing .resume [contenteditable="true"] {
  outline: 1px dashed transparent; outline-offset: 3px; border-radius: 2px;
  transition: outline-color .15s, background .15s; cursor: text;
}
body.editing .resume [contenteditable="true"]:hover { outline-color: rgba(120,120,120,.55); }
body.editing .resume [contenteditable="true"]:focus { outline: 1.5px solid #3b82f6; background: rgba(59,130,246,.06); }
body.editing .r-job, body.editing .r-edu { position: relative; }
.ed-ctl {
  position: absolute; top: -6px; right: -6px; z-index: 5;
  display: flex; gap: 2px; padding: 3px;
  background: #16181d; border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  opacity: 0; transform: translateY(2px); transition: opacity .15s, transform .15s;
  -webkit-user-select: none; user-select: none;
}
.r-job:hover > .ed-ctl, .r-edu:hover > .ed-ctl, .ed-ctl:focus-within { opacity: 1; transform: none; }
@media (hover: none) { .ed-ctl { opacity: 1; transform: none; } }
.ed-ctl button {
  appearance: none; border: 0; background: transparent; color: #fff; cursor: pointer;
  width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; padding: 0;
}
.ed-ctl button:hover { background: rgba(255,255,255,.16); }
.ed-ctl button[data-act="del"]:hover { background: #c0392b; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #16181d; color: #fff; font-size: 13px; padding: 10px 16px; border-radius: 999px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); transition: opacity .25s, transform .25s;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .tb-row { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .tb-title span { display: none; }
  .tb-actions { margin-left: auto; }
  .tb-designs { order: 3; width: 100%; margin: 0; }
  .tb-chip { padding: 7px 13px; }
  .tb-btn { padding: 8px 11px; }
  #btn-reset span { display: none; }
  .stage { padding-top: 116px; }
  .edit-hint { top: 97px; font-size: 12px; }
  body.editing .stage { padding-top: 172px; }
}

/* ---------- print (this is also how the PDF is made) ---------- */
@page { size: letter; margin: 0; }
@media print {
  html, body { background: #fff !important; }
  .tb, .edit-hint, .toast, .ed-ctl { display: none !important; }
  .stage { padding: 0 !important; display: block; }
  .sheet { zoom: 1 !important; width: 8.5in; box-shadow: none !important; }
  .resume { min-height: 0; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
