:root {
  --navy: #1a2744;
  --gold: #b8933f;
  --gold-light: #d4aa5a;
  --cream: #faf8f4;
  --gray-light: #f0ede8;
  --gray-mid: #c8c4bc;
  --text: #2c2c2c;
  --muted: #6b6560;
  --ink: #0f0e0d;
  --paper: #f5f2ee;
  --accent: #c8472b;
  --border: rgba(15, 14, 13, 0.12);
}

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Source Sans 3", sans-serif;
  background: #d8d4cf;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 80px 20px 80px;
}

/* ── BACK NAVBAR ── */
.back-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 3rem;
  background: rgba(245, 242, 238, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.back-nav-logo {
  font-family: "Playfair Display", serif;
  font-weight: 900;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.back-nav-logo span {
  color: var(--accent);
}

.back-nav-right {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.back-nav-label {
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.back-nav-btn {
  font-family: "DM Sans", sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  text-decoration: none;
  padding: 0.5rem 1.2rem;
  border-radius: 2px;
  transition: background 0.2s;
}

.back-nav-btn:hover {
  background: var(--accent);
}

/* ── EDIT HINTS ── */
[contenteditable="true"]:hover {
  outline: 1.5px dashed rgba(184, 147, 63, 0.5);
  border-radius: 2px;
  cursor: text;
}

[contenteditable="true"]:focus {
  outline: 2px solid var(--gold);
  border-radius: 2px;
  background: rgba(184, 147, 63, 0.07);
}

/* ── PAGE ── */
#cv {
  width: 210mm;
  height: 297mm;
  background: var(--cream);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── HEADER ── */
.cv-header {
  background: var(--navy);
  color: #fff;
  padding: 20px 34px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: center;
  flex-shrink: 0;
}

.cv-header h1 {
  font-family: "Playfair Display", serif;
  font-size: 27px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 3px;
}

.tagline {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-light);
  font-weight: 500;
}

.contacts {
  margin-top: 9px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contacts span,
.contacts a {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 6px;
}

.contacts a:hover {
  color: var(--gold-light);
}

.ci {
  width: 11px;
  height: 11px;
  fill: var(--gold-light);
  flex-shrink: 0;
}

/* ── PHOTO ── */
.photo-area {
  width: 84px;
  height: 100px;
  border: 2px solid var(--gold);
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.photo-area:hover {
  border-color: var(--gold-light);
}

.photo-area img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.photo-ph {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  color: rgba(255, 255, 255, 0.38);
  font-size: 9.5px;
  text-align: center;
  padding: 6px;
  pointer-events: none;
}

.photo-ph svg {
  width: 24px;
  height: 24px;
}

#photo-input {
  display: none;
}

/* ── STRIPE ── */
.stripe {
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--gold),
    var(--gold-light) 55%,
    transparent
  );
  flex-shrink: 0;
}

/* ── BODY ── */
.cv-body {
  display: grid;
  grid-template-columns: 196px 1fr;
  flex: 1;
  min-height: 0;
}

/* ── SIDEBAR ── */
.sidebar {
  background: var(--gray-light);
  border-right: 1px solid var(--gray-mid);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

/* ── MAIN ── */
.main {
  padding: 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
}

/* ── SECTION TITLE ── */
.stitle {
  font-family: "Playfair Display", serif;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--gold);
  padding-bottom: 4px;
  margin-bottom: 9px;
}

/* ── OBJECTIVE ── */
.obj {
  font-size: 12px;
  line-height: 1.65;
  color: var(--text);
}

/* ── EXPERIENCE ── */
.exp + .exp {
  margin-top: 13px;
}

.exp-role {
  font-family: "Playfair Display", serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1px;
}

.exp-co {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.04em;
  margin-bottom: 1px;
}

.exp-period {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 6px;
}

.exp-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.exp-list li {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  padding-left: 11px;
  padding-right: 18px;
  position: relative;
}

.exp-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 1px;
  background: var(--gold);
}

.badge {
  display: inline-block;
  background: var(--navy);
  color: var(--gold-light);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 2px;
  margin-top: 5px;
  text-transform: uppercase;
}

/* ── EDUCATION ── */
.edu + .edu {
  margin-top: 9px;
}

.edu-deg {
  font-family: "Playfair Display", serif;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
  margin-bottom: 2px;
}

.edu-school {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 1px;
}

.edu-year {
  font-size: 9.5px;
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.08em;
}

/* ── TAGS ── */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  background: #fff;
  border: 1px solid var(--gray-mid);
  color: var(--text);
  font-size: 9.5px;
  padding: 2px 20px 2px 6px;
  border-radius: 2px;
  line-height: 1.5;
  position: relative;
}

/* ── LANGUAGES ── */
.lang-item {
  position: relative;
}

.lang-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 3px;
}

.lang-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
}

.lang-lvl {
  font-size: 9.5px;
  color: var(--muted);
  font-style: italic;
}

.lang-bar {
  width: 100%;
  height: 3px;
  background: var(--gray-mid);
  border-radius: 2px;
  margin-bottom: 7px;
  overflow: hidden;
  cursor: pointer;
}

.lang-bar:hover {
  background: #b0aca4;
}

.lang-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--navy), var(--gold));
  border-radius: 2px;
}

/* ── COURSES ── */
.course {
  font-size: 10.5px;
  color: var(--text);
  padding: 3px 0;
  border-bottom: 1px dashed var(--gray-mid);
  line-height: 1.4;
  position: relative;
}

.course:last-of-type {
  border-bottom: none;
}

/* ── TOOLBAR ── */
.toolbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 20px;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.toolbar-hint {
  font-family: "Source Sans 3", sans-serif;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 1px;
  margin-right: 10px;
  text-transform: uppercase;
}

.btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 16px;
  border-radius: 3px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn:hover {
  opacity: 0.85;
}

.btn-print {
  background: var(--gold);
  color: #fff;
}

.btn-save {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-reset {
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 9px;
}

.saved-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1a5c3a;
  color: #fff;
  font-family: "Source Sans 3", sans-serif;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 8px 16px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.3s;
  z-index: 999;
  pointer-events: none;
}

.saved-toast.show {
  opacity: 1;
}

/* ══════════════════════════════════════
       DYNAMIC CONTROLS
    ══════════════════════════════════════ */

/* Section wrapper — reveals add row on hover */
.section-wrap {
  position: relative;
}

.section-wrap:hover .dyn-add-row {
  opacity: 1;
  pointer-events: all;
}

/* dyn-block — reveals remove button on hover */
.dyn-block {
  position: relative;
}

.dyn-block:hover > .dyn-remove {
  opacity: 1;
  pointer-events: all;
}

/* Remove button floating on right of block */
.dyn-remove {
  position: absolute;
  top: 1px;
  right: 0px;
  width: 15px;
  height: 15px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.15s,
    background 0.15s;
  z-index: 10;
}

.dyn-remove:hover {
  background: #b02020;
}

/* Add button row below a group */
.dyn-add-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}

/* Generic add / inline add button */
.dyn-add-btn {
  font-family: "Source Sans 3", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: transparent;
  border: 1px dashed var(--gold);
  border-radius: 2px;
  padding: 2px 7px;
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;
  white-space: nowrap;
}

.dyn-add-btn:hover {
  background: var(--gold);
  color: #fff;
}

/* Show inline add buttons (li, badge) on exp hover */
.exp:hover .exp-inline-controls {
  opacity: 1;
  pointer-events: all;
}

.exp-inline-controls {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  margin-top: 4px;
  display: flex;
  gap: 5px;
}

/* Tag remove button */
.tag-remove {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 11px;
  height: 11px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 8px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.tag:hover .tag-remove {
  display: flex;
}

/* Li remove button */
.li-remove {
  position: absolute;
  right: 0;
  top: 3px;
  width: 13px;
  height: 13px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.exp-list li:hover .li-remove {
  display: flex;
}

/* Badge wrapper */
.badge-wrap {
  position: relative;
  display: inline-block;
  margin-top: 5px;
}

.badge-remove {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 13px;
  height: 13px;
  background: #d94040;
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 9px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.badge-wrap:hover .badge-remove {
  display: flex;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: none;
    padding: 0;
  }

  #cv {
    box-shadow: none;
  }

  .toolbar,
  .back-nav,
  .saved-toast {
    display: none !important;
  }

  .dyn-add-row,
  .dyn-remove,
  .li-remove,
  .tag-remove,
  .badge-remove,
  .exp-inline-controls {
    display: none !important;
  }

  .photo-ph {
    display: none !important;
  }

  [contenteditable="true"]:hover,
  [contenteditable="true"]:focus {
    outline: none !important;
    background: transparent !important;
  }

  .cv-header,
  .sidebar,
  .stripe,
  .badge,
  .lang-bar-fill,
  .tag {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
