:root {
  --bg: #e9eef5;
  --text: #1a2332;
  --muted: #6b7585;
  --surface: #ffffff;
  --accent: #1c3352;
  --accent-dark: #152a44;
  --border: #e2e8f0;
  --card-shadow: 0 18px 48px rgba(30, 45, 68, 0.12);

  /* Anum's Resume.pdf — A4 595×842pt @ 96dpi */
  --resume-width: 793.33px;
  --resume-page-height: 1122.67px;
  --resume-margin-x: 32px;
  --resume-col-gap: 47px; /* gutter between equal columns (PDF ~35.4pt) */

  /* pt → px (× 96/72) — multiplied by --fs-scale for live font-size control */
  --fs-scale: 1;
  --fs-name: calc(30.78px * var(--fs-scale));
  --fs-headline: calc(16.15px * var(--fs-scale));
  --fs-summary: calc(11.88px * var(--fs-scale));
  --fs-contact: calc(11.88px * var(--fs-scale));
  --fs-section: calc(18.59px * var(--fs-scale));
  --fs-entry-title: calc(16.15px * var(--fs-scale));
  --fs-entry-company: calc(16.15px * var(--fs-scale));
  --fs-body: calc(11.88px * var(--fs-scale));
  --fs-project: calc(13.41px * var(--fs-scale));
  --fs-achievement-title: calc(13.41px * var(--fs-scale));
  --fs-meta: calc(10.66px * var(--fs-scale));
  --fs-cert: calc(11.88px * var(--fs-scale));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Ubuntu, "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(180deg, #f4f8fc 0%, var(--bg) 100%);
  color: var(--text);
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 28px;
  max-width: 920px;
  margin: 28px auto;
  padding: 0 20px 48px;
}

.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
}

.preview-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.preview-frame {
  position: relative;
  width: var(--resume-width);
  max-width: 100%;
}

.page-overflow-warning {
  width: var(--resume-width);
  max-width: 100%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #f3a7a7;
  background: #fef2f2;
  color: #bf2b2b;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.page-overflow-warning[hidden] {
  display: none !important;
}

.page-break-guide {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--resume-page-height);
  border-top: 2px dashed #cbd5e1;
  pointer-events: none;
  z-index: 2;
}

.page-break-guide::before {
  content: "page 1 end";
  position: absolute;
  right: 0;
  top: -18px;
  padding: 2px 8px;
  border-radius: 4px;
  background: #94a3b8;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.resume-page.is-overflowing ~ #page-break-guide,
.preview-frame:has(.resume-page.is-overflowing) .page-break-guide {
  border-top-color: #dc2626;
}

.resume-page.is-overflowing ~ #page-break-guide::before,
.preview-frame:has(.resume-page.is-overflowing) .page-break-guide::before {
  background: #dc2626;
  content: "1 page limit — content below will be cut";
}

.resume-page.is-overflowing {
  box-shadow: 0 0 0 2px #fca5a5, var(--card-shadow);
}

.resume-page {
  width: var(--resume-width);
  max-width: 100%;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--card-shadow);
}

.resume-intro {
  padding: 28px var(--resume-margin-x) 12px;
}

.resume-intro h1 {
  margin: 0;
  font-size: var(--fs-name);
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-transform: uppercase;
  color: var(--text);
}

#headline {
  margin: 6px 0 0;
  font-size: var(--fs-headline);
  font-weight: 400;
  line-height: 1.35;
  color: var(--text);
}

#summary {
  margin: 6px 0 0;
  font-size: var(--fs-summary);
  line-height: 1.4;
  color: var(--text);
}

.contact-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 24px 36px;
  padding: 9px var(--resume-margin-x);
  background: var(--accent-dark);
  color: #f8fbff;
}

.contact-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-contact);
  font-weight: 400;
}

.contact-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.95;
}

.contact-item a {
  color: inherit;
  text-decoration: none;
}

.resume-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--col-split, 58%) 1fr;
  column-gap: var(--resume-col-gap);
  align-items: start;
  padding: 14px var(--resume-margin-x) 22px;
}

.col-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--col-split, 58%);
  transform: translateX(-50%);
  width: 20px;
  cursor: col-resize;
  z-index: 20;
}

.col-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}

.col-resizer:hover::after,
.col-resizer.is-dragging::after {
  opacity: 0.25;
}

@media print {
  .col-resizer { display: none; }
}

.resume-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.main-column {
  gap: 14px;
}

.side-column {
  gap: 10px;
}

.section-block {
  display: grid;
  gap: 6px;
  width: 100%;
}

.side-column .section-block {
  gap: 8px;
}

.side-column .section-block:has(.certification-item) {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}

.section-block h2 {
  margin: 0;
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-transform: uppercase;
  color: var(--accent);
}

.main-column .section-block h2 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-column .section-block h2::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--accent);
  flex-shrink: 0;
}

.experience-item,
.education-item,
.project-item,
.achievement-item,
.language-item {
  display: grid;
  gap: 2px;
}

.main-column .experience-item + .experience-item,
.main-column .education-item + .education-item {
  margin-top: 10px;
}

.project-item + .project-item,
.achievement-item + .achievement-item,
.language-item + .language-item {
  margin-top: 8px;
}

.entry-title {
  margin: 0;
  font-size: var(--fs-entry-title);
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.entry-company,
.entry-institution {
  margin: 0;
  font-size: var(--fs-entry-company);
  font-weight: 400;
  line-height: 1.3;
  color: var(--text);
}

.entry-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
  font-size: var(--fs-meta);
  font-style: italic;
  color: var(--muted);
}

.entry-subtitle-label {
  margin: 3px 0 0;
  font-size: var(--fs-meta);
  font-style: italic;
  color: var(--muted);
}

.entry-list {
  margin: 2px 0 0;
  padding-left: 12px;
  color: var(--text);
}

.entry-list li {
  padding: 1px 0;
  font-size: var(--fs-body);
  line-height: 1.38;
  list-style-type: circle;
}

.education-detail {
  margin: 2px 0 0;
  font-size: var(--fs-meta);
  font-style: italic;
  line-height: 1.38;
  color: var(--muted);
  word-break: keep-all;
  min-height: 1em;
}

.education-item:hover .education-detail:empty:not(:focus)::before {
  content: attr(data-placeholder);
  color: #c8cdd7;
  pointer-events: none;
}

.entry-list li strong {
  font-weight: 700;
}

.project-text {
  margin: 0;
  font-size: var(--fs-project);
  line-height: 1.3;
  color: var(--text);
}

.project-detail {
  margin: 2px 0 0;
  font-size: var(--fs-meta);
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  color: var(--muted);
}

/* Collapse when empty and not focused */
.project-detail:empty:not(:focus) {
  margin: 0;
  height: 0;
  overflow: hidden;
}

/* Reveal on parent hover so the user knows it's clickable */
.project-item:hover .project-detail:empty:not(:focus) {
  height: auto;
  overflow: visible;
  margin: 2px 0 0;
  min-height: 1em;
}

.project-item:hover .project-detail:empty:not(:focus)::before {
  content: attr(data-placeholder);
  color: #c8cdd7;
  pointer-events: none;
}

/* Always visible when focused */
.project-detail:empty:focus {
  margin: 2px 0 0;
  height: auto;
  min-height: 1em;
  overflow: visible;
}

.achievement-summary {
  margin: 0;
  font-size: var(--fs-achievement-title);
  font-weight: 400;
  font-style: normal;
  line-height: 1.3;
  color: var(--text);
}

.achievement-detail {
  margin: 2px 0 0;
  font-size: var(--fs-meta);
  font-weight: 400;
  font-style: italic;
  line-height: 1.35;
  color: var(--muted);
}

.language-name {
  margin: 0;
  font-size: var(--fs-body);
  font-weight: 400;
  color: var(--text);
}

.language-level {
  font-size: var(--fs-meta);
  font-style: italic;
  color: var(--muted);
}

.skill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.skill-pill {
  padding: 3px 8px;
  border-radius: 3px;
  background: var(--accent-dark);
  color: #f8fbff;
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.2;
}

.certification-item {
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid #d5dde8;
  background: #fafbfd;
}

.certification-item + .certification-item {
  margin-top: 6px;
}

.certification-item p {
  margin: 0;
  font-size: var(--fs-cert);
  line-height: 1.3;
  color: var(--text);
  white-space: normal;
  word-break: break-word;
}

.certification-item p::before {
  content: "•";
  margin-right: 2px;
  font-weight: 400;
}

.editor-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--card-shadow);
}

.editor-card h2 {
  margin-top: 0;
}


.editor-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

button {
  border: none;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  color: #ffffff;
  background: var(--accent);
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

#resume-json {
  width: 100%;
  min-height: 480px;
  border-radius: 14px;
  border: 1px solid #dfe5ef;
  padding: 16px;
  margin-top: 12px;
  font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text);
  resize: vertical;
  box-sizing: border-box;
}

.error-message {
  margin-top: 10px;
  color: #bf2b2b;
  font-size: 0.95rem;
}

.empty-hint {
  margin: 0;
  font-size: var(--fs-body);
  color: var(--muted);
  font-style: italic;
}

/* ── Inline Editing ──────────────────────────────────────────────────────── */

#summary {
  white-space: pre-wrap;
}

.resume-page [contenteditable] {
  cursor: text;
  border-radius: 3px;
  outline: none;
  transition: background 0.1s, box-shadow 0.1s;
}

.resume-page [contenteditable]:hover {
  background: rgba(28, 51, 82, 0.05);
}

.resume-page [contenteditable]:focus {
  background: rgba(28, 51, 82, 0.07);
  box-shadow: 0 0 0 1.5px rgba(28, 51, 82, 0.3);
}

.edit-hint {
  width: var(--resume-width);
  max-width: 100%;
  margin: 0 0 6px;
  padding: 6px 14px;
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

/* ── Item delete (×) and section add (+) buttons ──────────────────────── */

.resume-page article {
  position: relative;
}

.item-delete-btn {
  position: absolute;
  top: 1px;
  right: -16px;
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 2px;
  padding: 0;
  background: none;
  color: transparent;
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s;
  z-index: 5;
}

.item-delete-btn:hover,
.item-delete-btn:focus-visible {
  background: none !important;
  transform: none !important;
  filter: none !important;
}

.resume-page article:hover > .item-delete-btn {
  color: #c4c9d4;
}

.resume-page article:hover > .item-delete-btn:hover {
  color: #e53e3e !important;
}

.section-add-btn {
  display: none;
  border: none;
  border-radius: 3px;
  padding: 0 2px;
  margin-left: 4px;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  opacity: 0.55;
}

.section-add-btn:hover,
.section-add-btn:focus-visible {
  color: var(--accent) !important;
  background: none !important;
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}

.section-block:hover .section-add-btn {
  display: inline-flex;
}

.skill-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.skill-wrap .item-delete-btn {
  position: static;
  width: 10px;
  height: 10px;
  font-size: 9px;
  margin-left: 1px;
  display: none;
  color: transparent;
}

.skill-wrap:hover .item-delete-btn {
  display: flex;
  color: rgba(255, 255, 255, 0.6);
}

.skill-wrap:hover .item-delete-btn:hover {
  color: #fff !important;
}

/* ── Style controls (font size + accent colour) ──────────────────────────── */

.style-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.style-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.style-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
}

.style-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.style-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.style-btn {
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 700;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: none;
}

.style-btn:hover {
  background: var(--bg);
  transform: none;
  filter: none;
}

#font-size-val {
  min-width: 36px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text);
}

.color-swatches {
  display: flex;
  gap: 6px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  padding: 0;
  border: 2.5px solid transparent;
  cursor: pointer;
  /* inline style= sets the background */
}

.color-swatch:hover,
.color-swatch.active {
  border-color: rgba(0,0,0,0.35) !important;
  transform: none !important;
  filter: none !important;
}

/* ── Bullet-level add (+) / delete (×) ───────────────────────────────────── */

.entry-list li {
  position: relative;
}

.bullet-text {
  display: block;
  min-height: 1.2em;
}

.bullet-delete-btn {
  position: absolute;
  top: 1px;
  right: -15px;
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 2px;
  padding: 0;
  background: none;
  color: transparent;
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.1s;
}

.bullet-delete-btn:hover,
.bullet-delete-btn:focus-visible {
  background: none !important;
  transform: none !important;
  filter: none !important;
}

.entry-list li:hover > .bullet-delete-btn {
  color: #c4c9d4;
}

.entry-list li:hover > .bullet-delete-btn:hover {
  color: #e53e3e !important;
}

.bullet-add-btn {
  display: none;
  margin-top: 3px;
  padding: 0;
  border: none;
  background: none;
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.5;
  text-align: left;
}

.bullet-add-btn:hover,
.bullet-add-btn:focus-visible {
  opacity: 1;
  color: var(--accent) !important;
  background: none !important;
  transform: none !important;
  filter: none !important;
}

.experience-item:hover .bullet-add-btn,
.project-item:hover .bullet-add-btn {
  display: block;
}

/* ── Section move / hide buttons ────────────────────────────────────────── */

.section-heading-text:hover {
  cursor: text;
}

.section-move-btn,
.section-hide-btn {
  display: none;
  border: none;
  border-radius: 3px;
  padding: 0 2px;
  margin-left: 2px;
  background: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  opacity: 0.5;
}

.section-move-btn:hover,
.section-move-btn:focus-visible,
.section-hide-btn:hover,
.section-hide-btn:focus-visible {
  color: var(--accent) !important;
  opacity: 1 !important;
  background: none !important;
  transform: none !important;
  filter: none !important;
}

.section-block:hover .section-move-btn,
.section-block:hover .section-hide-btn {
  display: inline-flex;
}

.section-block[data-hidden="true"] {
  opacity: 0.25;
  pointer-events: none;
}

.section-block[data-hidden="true"] > :not(h2) {
  display: none;
}

.section-block[data-hidden="true"] h2 {
  pointer-events: all;
}

.section-block[data-hidden="true"] .section-hide-btn {
  display: inline-flex;
  opacity: 1;
  color: var(--accent);
}

@media print {
  .section-block[data-hidden="true"] { display: none; }
}

/* ── Advanced JSON section ───────────────────────────────────────────────── */

.fe-section {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}

.fe-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #f4f7fb;
  border: none;
  border-radius: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}

.fe-toggle:hover {
  background: #eaf0f8;
  transform: none;
  filter: none;
}

.fe-chevron::after {
  content: "▼";
  font-size: 0.7rem;
  color: var(--muted);
}

.fe-toggle[aria-expanded="true"] .fe-chevron::after {
  content: "▲";
}

.fe-body {
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
}

.fe-hint {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

@media (max-width: 860px) {
  .resume-body {
    grid-template-columns: 1fr;
    column-gap: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app {
    margin: 0;
    padding: 0;
    max-width: none;
  }

  .editor-panel {
    display: none;
  }

  .resume-page {
    box-shadow: none;
  }
}
