:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-soft: #eaf7ff;
  --panel: rgba(233, 248, 255, 0.78);
  --panel-solid: #ffffff;
  --text: #102033;
  --muted: #5f7187;
  --line: rgba(21, 154, 219, 0.18);
  --primary: #159adb;
  --primary-2: #5fd3f3;
  --accent: #23c58b;
  --warm: #ff9f43;
  --danger: #e94f64;
  --shadow: 0 24px 60px rgba(17, 90, 140, 0.14);
  --radius: 8px;
  --header-h: 74px;
}

/* Distinctive night theme: near-black grounded in a deep, mysterious blue. */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050810;
  --bg-soft: #0a1024;
  --panel: rgba(96, 140, 255, 0.06);
  --panel-solid: #0c1330;
  --text: #eef2ff;
  --muted: #93a4c9;
  --line: rgba(80, 130, 255, 0.22);
  --primary: #2b53ff;
  --primary-2: #5b8cff;
  --accent: #22d3ee;
  --warm: #fb923c;
  --danger: #fb7185;
  --shadow: 0 26px 65px rgba(0, 0, 0, 0.65);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, rgba(19, 185, 214, 0.16), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
  font-family: Cairo, Inter, system-ui, sans-serif;
  overflow-x: hidden;
  transition: color 0.45s ease, background 0.55s ease;
}

[data-theme="dark"] body {
  background:
    radial-gradient(circle at 8% 12%, rgba(43, 83, 255, 0.26), transparent 30%),
    radial-gradient(circle at 92% 88%, rgba(34, 211, 238, 0.12), transparent 32%),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
}

body.en { font-family: Inter, Cairo, system-ui, sans-serif; }

body.language-flip .page-shell {
  animation: languageFlip 0.58s cubic-bezier(.2,.9,.2,1) both;
}

a { color: inherit; text-decoration: none; }

button, input, textarea, select {
  font: inherit;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  gap: 22px;
  background: var(--bg);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.boot-screen.hide {
  opacity: 0;
  visibility: hidden;
}

.boot-hello {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
  font-size: clamp(1.15rem, 4vw, 1.5rem);
  font-weight: 800;
  box-shadow: 0 16px 34px rgba(8, 119, 217, 0.34);
  animation: stickerPop 0.6s cubic-bezier(.34, 1.56, .64, 1) both;
}

.boot-hello-emoji {
  display: inline-block;
  font-size: 1.3em;
  transform-origin: 70% 70%;
  animation: waveHand 0.8s ease-in-out 0.55s 2;
}

.boot-logo {
  animation: riseIn 0.6s cubic-bezier(.2,.9,.2,1) both;
  animation-delay: 0.45s;
}

.boot-mark {
  color: var(--primary);
  font-size: clamp(2.4rem, 8vw, 5rem);
  font-weight: 800;
  letter-spacing: 0;
  animation: riseIn 0.6s cubic-bezier(.2,.9,.2,1) both;
  animation-delay: 0.58s;
}

.boot-credit {
  margin-top: -14px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  animation: riseIn 0.6s cubic-bezier(.2,.9,.2,1) both;
  animation-delay: 0.72s;
}

.boot-line {
  width: min(280px, 60vw);
  height: 4px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--line);
}

.boot-line::after {
  content: "";
  display: block;
  width: 45%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-2), var(--accent));
  animation: loadLine 1.1s ease both;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel-solid) 72%, transparent);
  backdrop-filter: blur(18px);
  transition: background 0.45s ease, border-color 0.45s ease;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.25rem;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 12px 28px rgba(8, 119, 217, 0.22);
}

[data-theme="dark"] .brand-icon {
  box-shadow: 0 12px 28px rgba(43, 83, 255, 0.45);
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
  transition: transform 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  transform: translateY(-1px);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn, .menu-btn, .tool-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.icon-btn:active, .menu-btn:active, .btn:active, .tool-btn:active {
  transform: scale(0.94);
}

#themeToggle {
  position: relative;
  overflow: hidden;
}

#themeToggle svg {
  transition: transform 0.35s cubic-bezier(.2,.9,.2,1), opacity 0.25s ease;
}

#themeToggle:hover svg {
  transform: rotate(18deg) scale(1.08);
}

.theme-wipe {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  display: grid;
  place-items: center;
  clip-path: circle(0 at calc(100% - 86px) 36px);
  animation: themeWipe 0.9s cubic-bezier(.2,.9,.2,1) both;
}

[dir="rtl"] .theme-wipe {
  clip-path: circle(0 at 86px 36px);
  animation-name: themeWipeRtl;
}

.theme-wipe.to-night {
  background:
    radial-gradient(circle at 50% 50%, rgba(43, 83, 255, 0.55), transparent 0 12%),
    linear-gradient(135deg, rgba(5, 8, 16, 0.92), rgba(10, 16, 36, 0.86));
}

.theme-wipe.to-day {
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.9), transparent 0 12%),
    linear-gradient(135deg, rgba(8,119,217,0.38), rgba(19,185,214,0.36));
}

.theme-wipe span {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  border-radius: 999px;
  color: var(--primary);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  animation: themeIconPop 0.78s cubic-bezier(.2,.9,.2,1) both;
}

.menu-btn { display: none; }

.mobile-panel {
  position: fixed;
  inset: var(--header-h) 14px auto 14px;
  z-index: 11;
  display: none;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.mobile-panel.open { display: grid; }

.page-shell {
  min-height: calc(100vh - var(--header-h));
  animation: pageIn 0.5s cubic-bezier(.2,.9,.2,1) both;
}

.section {
  padding: clamp(48px, 7vw, 92px) clamp(18px, 5vw, 72px);
}

.inner {
  width: min(1180px, 100%);
  margin-inline: auto;
}

.hero {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  align-items: center;
  padding: 48px clamp(18px, 5vw, 72px) 34px;
}

.hero-grid {
  width: min(1180px, 100%);
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.9fr);
  gap: clamp(28px, 5vw, 68px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--panel);
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }

.hero h1 {
  margin: 18px 0 18px;
  font-size: clamp(2.8rem, 8vw, 6.8rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 660px;
  color: var(--muted);
  font-size: clamp(1.02rem, 2vw, 1.28rem);
  line-height: 1.8;
}

.hero-actions, .action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 16px 34px rgba(8, 119, 217, 0.22);
  cursor: pointer;
  font-weight: 800;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="dark"] .btn {
  box-shadow: 0 16px 34px rgba(43, 83, 255, 0.38);
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 20px 44px rgba(8, 119, 217, 0.28); }

.btn.secondary {
  color: var(--primary);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: none;
}

.btn.ghost {
  color: var(--text);
  background: color-mix(in srgb, var(--panel-solid) 75%, transparent);
  border: 1px solid var(--line);
  box-shadow: none;
}

.cv-stage {
  position: relative;
  min-height: 560px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(255,255,255,0.74), rgba(232,248,255,0.65));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cv-paper {
  position: absolute;
  inset: 34px 30px 26px;
  display: grid;
  grid-template-columns: 0.38fr 0.62fr;
  gap: 18px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: 0 24px 50px rgba(16, 32, 51, 0.12);
  animation: floatPaper 5.5s ease-in-out infinite;
}

.cv-side {
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--primary), var(--primary-2));
}

.cv-content {
  display: grid;
  gap: 12px;
  align-content: start;
}

.line {
  height: 12px;
  border-radius: 99px;
  background: var(--line);
}

.line.big { height: 24px; width: 70%; background: color-mix(in srgb, var(--primary) 22%, transparent); }
.line.short { width: 52%; }
.line.mid { width: 82%; }

.orbit {
  position: absolute;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--panel-solid);
  box-shadow: 0 16px 34px rgba(16, 32, 51, 0.13);
  animation: orbitMove 6s ease-in-out infinite;
}

.orbit.one { top: 24px; inset-inline-end: 24px; }
.orbit.two { bottom: 34px; inset-inline-start: 22px; animation-delay: -1.8s; color: var(--accent); }
.orbit.three { top: 46%; inset-inline-end: 10px; animation-delay: -3.2s; color: var(--warm); }

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.section-title p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card, .panel, .form-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(16, 32, 51, 0.08);
  transition: background 0.45s ease, border-color 0.45s ease, box-shadow 0.3s ease;
}

.card {
  padding: 20px;
  transition: transform 0.22s ease, box-shadow 0.22s ease, background 0.45s ease, border-color 0.45s ease;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 14px;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}



.card h3 { margin-bottom: 8px; }
.card p, .muted { color: var(--muted); line-height: 1.7; }

.steps {
  display: grid;
  gap: 12px;
  counter-reset: step;
}

.step {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 14px;
  align-items: start;
  padding: 18px;
  border-block-end: 1px solid var(--line);
}

.step::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}



.stat {
  padding: 22px;
  border-inline-start: 4px solid var(--primary);
}

.stat strong {
  display: block;
  font-size: clamp(1.8rem, 4vw, 3.1rem);
  line-height: 1;
}

.testimonial {
  min-height: 190px;
}

.faq-item {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.faq-item h3 {
  margin-bottom: 6px;
  font-size: 1.06rem;
}

.auth-wrap, .simple-page {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  place-items: center;
  padding: 44px 18px;
}

.form-box {
  width: min(520px, 100%);
  padding: clamp(22px, 5vw, 34px);
}

.form-box h1 { margin-bottom: 8px; }

.field {
  display: grid;
  gap: 7px;
  margin: 14px 0;
}

.field label { font-weight: 800; }

.field input, .field textarea, .field select, .search-input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  background: var(--panel-solid);
  outline: none;
}

.field input:focus, .field textarea:focus, .field select:focus, .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}

.check-row, .split-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 0;
}

.social-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.workspace {
  padding: clamp(18px, 4vw, 38px);
}

.workspace.full {
  width: min(1320px, 100%);
  margin-inline: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.welcome {
  padding: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
}



.list-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.progress {
  height: 10px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.builder-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.builder-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field span, .field-label {
  display: block;
  margin-bottom: 7px;
  font-weight: 800;
}

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  width: 38px;
  height: 38px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: var(--sw);
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(16, 32, 51, 0.14);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.swatch:hover, .swatch.active {
  transform: translateY(-2px) scale(1.05);
  border-color: var(--text);
}

.swatch.round { border-radius: 50%; }

.photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.photo-thumb {
  width: 64px;
  height: 64px;
  border: 1px solid var(--line);
  background: var(--panel-solid) center / cover no-repeat;
  flex-shrink: 0;
}

.photo-thumb.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.section-editor {
  display: grid;
  gap: 12px;
}

.cv-section-edit {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-solid) 58%, transparent);
  overflow: hidden;
}

.cv-section-edit summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  font-weight: 800;
}

.cv-section-edit summary .section-name { flex: 1; }

.drag-handle {
  display: inline-flex;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}

.drag-handle:active { cursor: grabbing; }

.item-editor-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.item-drag-hint { font-size: 0.76rem; }

.item-editor[draggable="true"] { cursor: default; }

.dragging { opacity: 0.4; }

.cv-section-edit.dragging summary,
[data-drag-item].dragging { outline: 2px dashed var(--primary); outline-offset: 2px; }

.photo-size-slider {
  width: 100%;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 4px;
}

.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 16, 0.68);
  backdrop-filter: blur(4px);
}

.crop-box {
  width: min(360px, 100%);
  padding: 22px;
  border-radius: var(--radius);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  text-align: center;
}

.crop-box h3 {
  font-size: 1rem;
  color: var(--text);
}

.crop-viewport {
  position: relative;
  width: 280px;
  height: 280px;
  margin-inline: auto;
  overflow: hidden;
  border-radius: 12px;
  background: #111827;
  cursor: grab;
  touch-action: none;
}

.crop-viewport:active { cursor: grabbing; }

.crop-viewport img {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  user-select: none;
  pointer-events: none;
}

.crop-status {
  font-size: 0.82rem;
  min-height: 18px;
}

.crop-aspect-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.crop-aspect-row .btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff;
}

.crop-guide {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  box-shadow: 0 0 0 2000px rgba(0, 0, 0, 0.45);
  border: 2px dashed rgba(255, 255, 255, 0.85);
  pointer-events: none;
}

.crop-guide.square { border-radius: 50%; }

.color-picker {
  width: 38px;
  height: 38px;
  padding: 2px;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  cursor: pointer;
}

.section-items {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.item-editor {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-solid);
  color: var(--text);
}

.btn.mini {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 0.88rem;
}

.preview-stick {
  position: sticky;
  top: calc(var(--header-h) + 18px);
}

.preview-center {
  display: grid;
  place-items: start center;
}

.live-device {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-solid) 70%, transparent);
  box-shadow: var(--shadow);
}

.resume-paper {
  --cv-accent: var(--primary);
  --cv-text: #172033;
  --paper-pad: 34px;
  position: relative;
  width: min(794px, 100%);
  min-height: 980px;
  padding: var(--paper-pad);
  color: var(--cv-text);
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}

.resume-mini {
  width: 100%;
  min-height: 430px;
  max-height: 530px;
  overflow: hidden;
  transform-origin: top center;
}

.resume-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 16px;
  align-items: center;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--cv-accent);
}

.avatar {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  color: #fff;
  border-radius: 50%;
  background: var(--cv-accent);
  font-weight: 900;
  font-size: 1.35rem;
  overflow: hidden;
  flex-shrink: 0;
}

.avatar.avatar-photo {
  background-size: cover;
  background-position: center;
  color: transparent;
}

/* --- Photo frame shapes (independent of resume template) --- */
.avatar-frame-circle { border-radius: 50%; }

.avatar-frame-rounded { border-radius: 18px; }

.avatar-frame-square { border-radius: 4px; }

.avatar-frame-hex {
  border-radius: 0;
  clip-path: polygon(25% 4%, 75% 4%, 100% 50%, 75% 96%, 25% 96%, 0% 50%);
}

.avatar-frame-badge {
  border-radius: 0;
  clip-path: polygon(50% 0%, 100% 22%, 100% 62%, 50% 100%, 0% 62%, 0% 22%);
}

.avatar-frame-polaroid {
  border-radius: 3px;
  border: 5px solid #fff;
  border-bottom-width: 16px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.28);
  transform: rotate(-3deg);
}

.specialty-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 99px;
  color: #fff;
  background: color-mix(in srgb, var(--cv-accent) 82%, black 8%);
  font-size: 0.78rem;
  font-weight: 800;
}

.specialty-badge svg { width: 14px; height: 14px; }

.resume-head h2 {
  margin-bottom: 4px;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.resume-head p {
  margin: 0;
  color: color-mix(in srgb, var(--cv-text) 70%, white);
  font-weight: 800;
}

.contact-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.contact-badges span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--cv-accent);
  font-size: 0.88rem;
  font-weight: 800;
}

.badge-outline .contact-badges span {
  color: var(--cv-accent);
  background: #fff;
  border: 1px solid var(--cv-accent);
}

.badge-soft .contact-badges span {
  color: var(--cv-text);
  background: color-mix(in srgb, var(--cv-accent) 16%, white);
}

.social-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: #fff;
  background: var(--social-color, var(--cv-accent));
  font-size: 0.88rem;
  font-weight: 800;
  direction: ltr;
}

.social-badge svg { width: 14px; height: 14px; flex-shrink: 0; }

.badge-outline .social-badge {
  color: var(--social-color, var(--cv-accent));
  background: #fff;
  border: 1px solid var(--social-color, var(--cv-accent));
}

.badge-soft .social-badge {
  color: var(--cv-text);
  background: color-mix(in srgb, var(--social-color, var(--cv-accent)) 16%, white);
}

/* Sidebar/geometric contact rails give normal contact badges a translucent look,
   but social badges keep their true brand color so the logo stays recognizable. */
.tpl-layout-sidebar .sidebar-contact .social-badge,
.tpl-layout-geometric .geo-sidebar .sidebar-contact .social-badge {
  background: var(--social-color, rgba(255, 255, 255, 0.16));
  color: #fff;
}

.tpl-layout-geometric .geo-sidebar .sidebar-contact .social-badge { color: #fff; }

/* Builder form: shows the platform's mark inline in its field label. */
.social-field span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.social-field svg { width: 15px; height: 15px; flex-shrink: 0; }

.resume-summary {
  color: color-mix(in srgb, var(--cv-text) 78%, white);
  line-height: 1.8;
}

.resume-section {
  margin-top: 18px;
}

.resume-section h3 {
  margin-bottom: 10px;
  color: var(--cv-accent);
  border-bottom: 1px solid rgba(17, 24, 39, 0.12);
  padding-bottom: 6px;
}

.resume-item {
  display: grid;
  gap: 3px;
  margin-bottom: 12px;
}

.resume-item span {
  color: color-mix(in srgb, var(--cv-text) 55%, white);
  font-size: 0.92rem;
}

.resume-item p {
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--cv-text) 78%, white);
  line-height: 1.6;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  width: fit-content;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--cv-accent) 45%, transparent);
  color: var(--cv-accent);
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  direction: ltr;
}

.project-link svg { width: 13px; height: 13px; }

/* ================= LAYOUTS ================= */
/* Classic: default single-column flow, no extra CSS needed. */

/* Sidebar: large photo + contact in a colored left column, content on the right. */
.tpl-layout-sidebar {
  display: grid;
  grid-template-columns: 34% 1fr;
  align-items: stretch;
  padding: 0;
  direction: ltr;
}

.tpl-layout-sidebar .resume-sidebar {
  background: linear-gradient(165deg, var(--cv-accent), color-mix(in srgb, var(--cv-accent) 68%, #000 22%));
  color: #fff;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.tpl-layout-sidebar .resume-sidebar h2 { color: #fff; font-size: clamp(1.3rem, 3vw, 1.85rem); margin-top: 6px; }
.tpl-layout-sidebar .resume-sidebar p { color: rgba(255, 255, 255, 0.85); }
.tpl-layout-sidebar .specialty-badge { background: rgba(255, 255, 255, 0.22); }
.tpl-layout-sidebar .avatar { background: rgba(255, 255, 255, 0.25); border: 3px solid rgba(255, 255, 255, 0.75); }
.tpl-layout-sidebar .sidebar-contact { flex-direction: column; align-items: stretch; width: 100%; margin-top: 10px; gap: 8px; }
.tpl-layout-sidebar .sidebar-contact span { background: rgba(255, 255, 255, 0.16); justify-content: flex-start; }
.tpl-layout-sidebar .resume-main { padding: var(--paper-pad); min-width: 0; }
.tpl-layout-sidebar .resume-main .resume-section:first-of-type { margin-top: 6px; }

/* Banner: full-bleed colored header band, photo centered, content below. */
.tpl-layout-banner .resume-banner {
  background: linear-gradient(120deg, var(--cv-accent), color-mix(in srgb, var(--cv-accent) 65%, #000 15%));
  color: #fff;
  margin: calc(var(--paper-pad) * -1) calc(var(--paper-pad) * -1) 18px;
  padding: 36px var(--paper-pad) 42px;
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tpl-layout-banner .resume-banner h2 { color: #fff; }
.tpl-layout-banner .resume-banner p { color: rgba(255, 255, 255, 0.85); }
.tpl-layout-banner .specialty-badge { background: rgba(255, 255, 255, 0.22); }
.tpl-layout-banner .avatar { border: 4px solid rgba(255, 255, 255, 0.9); background: rgba(255, 255, 255, 0.25); box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22); }
.tpl-layout-banner .contact-badges { justify-content: center; }


/* Geometric: angled two-tone header with the photo on a colored diagonal band. */
.tpl-layout-geometric { padding: 0; }

.tpl-layout-geometric .geo-head {
  direction: ltr;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: 200px;
  padding: 30px var(--paper-pad);
  background: linear-gradient(120deg, #eef1f5 0%, #eef1f5 52%, var(--cv-accent) 52%, color-mix(in srgb, var(--cv-accent) 74%, #000 20%) 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0% 68%);
}

.tpl-layout-geometric .geo-text h2 { color: #111827; }
.tpl-layout-geometric .geo-text { position: relative; z-index: 1; }

.geo-role-badge {
  display: inline-block;
  margin-top: 8px;
  padding: 8px 20px 8px 14px;
  background: var(--cv-accent);
  color: #fff;
  font-weight: 800;
  clip-path: polygon(0 0, 100% 0, 90% 100%, 0% 100%);
}

.tpl-layout-geometric .geo-text .specialty-badge { margin-top: 10px; background: color-mix(in srgb, var(--cv-accent) 16%, white); color: var(--cv-accent); }

.tpl-layout-geometric .geo-photo { display: flex; justify-content: center; }
.tpl-layout-geometric .avatar { border: 4px solid rgba(255, 255, 255, 0.85); background: rgba(255, 255, 255, 0.2); }

.tpl-layout-geometric .geo-body {
  direction: ltr;
  display: grid;
  grid-template-columns: 34% 1fr;
}

.tpl-layout-geometric .geo-sidebar {
  padding: 22px var(--paper-pad) 30px;
  background: color-mix(in srgb, var(--cv-accent) 5%, white);
  border-inline-end: 1px solid rgba(17, 24, 39, 0.08);
}

.tpl-layout-geometric .geo-sidebar h3 {
  color: var(--cv-accent);
  font-size: 1rem;
  margin-bottom: 12px;
}

.tpl-layout-geometric .geo-sidebar .sidebar-contact { margin-bottom: 18px; }
.tpl-layout-geometric .geo-sidebar .sidebar-contact span { background: color-mix(in srgb, var(--cv-accent) 14%, white); color: var(--cv-text); }

.tpl-layout-geometric .geo-main { padding: 26px var(--paper-pad) 30px; min-width: 0; }
.tpl-layout-geometric .geo-main .resume-section:first-of-type { margin-top: 0; }

/* ================= DECOR STYLES (paper-level, work with every layout) ================= */

.dec-double { border: 8px double color-mix(in srgb, var(--cv-accent) 55%, #111827); }

.dec-corner { position: relative; }
.dec-corner::before {
  content: "";
  position: absolute;
  top: -46px;
  inset-inline-end: -46px;
  width: 150px;
  height: 150px;
  background: var(--cv-accent);
  opacity: 0.16;
  transform: rotate(45deg);
  pointer-events: none;
}

.dec-elegant {
  border: 3px solid var(--cv-accent);
  outline: 1px solid color-mix(in srgb, var(--cv-accent) 45%, transparent);
  outline-offset: -9px;
}
.dec-elegant .resume-head h2, .dec-elegant .resume-banner h2, .dec-elegant .resume-sidebar h2 { font-family: "Amiri", Georgia, serif; }

.dec-tech {
  background-image: linear-gradient(rgba(17, 24, 39, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(17, 24, 39, .045) 1px, transparent 1px);
  background-size: 22px 22px;
}

.dec-ats { box-shadow: none; border-radius: 0; border-color: rgba(17, 24, 39, 0.18); }

.dec-soft { background: linear-gradient(180deg, color-mix(in srgb, var(--cv-accent) 8%, white), white 260px); }

.dec-boldshadow { box-shadow: 0 34px 70px rgba(15, 23, 42, 0.3); border-radius: 16px; }

.dec-dotted { border: 3px dashed color-mix(in srgb, var(--cv-accent) 60%, transparent); }

.dec-gradient::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: linear-gradient(90deg, var(--cv-accent), color-mix(in srgb, var(--cv-accent) 35%, white));
  pointer-events: none;
}

.template-card {
  display: grid;
  gap: 12px;
}

.template-mini {
  height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  display: flex;
  justify-content: center;
}

.template-mini .resume-paper {
  width: 794px;
  flex-shrink: 0;
  transform: scale(0.4);
  transform-origin: top center;
}

.template-mini .resume-mini {
  min-height: 0;
  max-height: none;
}

.score {
  display: block;
  margin-bottom: 12px;
  font-size: clamp(2.6rem, 7vw, 5rem);
  color: var(--primary);
}

.not-found {
  text-align: center;
}

.nf-mark {
  width: min(420px, 90vw);
  aspect-ratio: 16 / 9;
  margin: 0 auto 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--primary) 22%, transparent), transparent 55%),
    linear-gradient(45deg, transparent, color-mix(in srgb, var(--accent) 20%, transparent));
  display: grid;
  place-items: center;
  font-size: clamp(4rem, 12vw, 8rem);
  font-weight: 800;
  color: var(--primary);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 22px clamp(18px, 5vw, 72px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-solid) 55%, transparent);
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-credit {
  font-size: 0.78rem;
  opacity: 0.75;
  direction: ltr;
  text-align: left;
}

.footer-contact {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-sticker {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 18px rgba(8, 119, 217, 0.24);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.footer-sticker svg { width: 17px; height: 17px; }

.footer-sticker:hover {
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 12px 26px rgba(8, 119, 217, 0.32);
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes stickerPop {
  0% { opacity: 0; transform: scale(0.4) rotate(-14deg) translateY(10px); }
  60% { opacity: 1; transform: scale(1.12) rotate(5deg) translateY(0); }
  80% { transform: scale(0.96) rotate(-3deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

@keyframes waveHand {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-16deg); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-10deg); }
  80% { transform: rotate(8deg); }
}

@keyframes loadLine {
  from { transform: translateX(-120%); }
  to { transform: translateX(155%); }
}

@keyframes pageIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes languageFlip {
  0% { opacity: 0.35; transform: translateY(14px) scale(0.985); filter: blur(4px); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.002); filter: blur(0); }
  100% { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

@keyframes themeWipe {
  0% { opacity: 0; clip-path: circle(0 at calc(100% - 86px) 36px); }
  42% { opacity: 1; clip-path: circle(145% at calc(100% - 86px) 36px); }
  100% { opacity: 0; clip-path: circle(145% at calc(100% - 86px) 36px); }
}

@keyframes themeWipeRtl {
  0% { opacity: 0; clip-path: circle(0 at 86px 36px); }
  42% { opacity: 1; clip-path: circle(145% at 86px 36px); }
  100% { opacity: 0; clip-path: circle(145% at 86px 36px); }
}

@keyframes themeIconPop {
  0% { opacity: 0; transform: scale(0.45) rotate(-24deg); }
  45% { opacity: 1; transform: scale(1.08) rotate(8deg); }
  100% { opacity: 0; transform: scale(0.92) rotate(0deg); }
}

@keyframes floatPaper {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-12px) rotate(1deg); }
}

@keyframes orbitMove {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@media (max-width: 980px) {
  .main-nav { display: none; }
  .menu-btn { display: inline-grid; }
  .hero-grid, .builder-shell { grid-template-columns: 1fr; }
  .grid, .grid.two, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv-stage { min-height: 430px; }
  .preview-stick { position: static; }
}

@media (max-width: 640px) {
  .site-header { padding-inline: 12px; }
  .brand span:last-child { display: none; }
  .hero { padding-top: 30px; }
  .cv-stage { min-height: 360px; }
  .cv-paper { inset: 26px 18px; grid-template-columns: 1fr; }
  .cv-side { min-height: 92px; }
  .grid, .grid.two, .grid.four, .social-grid, .form-grid { grid-template-columns: 1fr; }
  .section-title, .topbar, .site-footer, .split-row { align-items: flex-start; flex-direction: column; }
  .mobile-panel { grid-template-columns: 1fr; }
  .resume-paper { padding: 22px; min-height: auto; }
  .resume-head { grid-template-columns: 1fr; }
  .tpl-layout-sidebar { grid-template-columns: 1fr; }
  .tpl-layout-geometric .geo-head { grid-template-columns: 1fr; clip-path: none; text-align: center; justify-items: center; }
  .tpl-layout-geometric .geo-body { grid-template-columns: 1fr; }
  .tpl-layout-geometric .geo-sidebar { border-inline-end: 0; border-bottom: 1px solid rgba(17, 24, 39, 0.08); }
}

@page {
  size: A4;
  margin: 10mm;
}

@media print {
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body {
    background: #fff !important;
  }

  .site-header, .site-footer, .topbar, .builder-form, .theme-wipe, .mobile-panel {
    display: none !important;
  }

  .page-shell, .workspace, .preview-center, .builder-shell {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .preview-stick {
    position: static !important;
  }

  .resume-paper {
    width: 100% !important;
    min-height: 0 !important;
    --paper-pad: 8mm;
    padding: var(--paper-pad) !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
  }

  /* Tighten spacing and type scale for print first, so the auto-fit script below
     rarely needs to shrink much further - this keeps printed text readable instead
     of relying on heavy zoom-out to force everything onto one page. */
  html { font-size: 14.5px; }

  .resume-head { padding-bottom: 10px; }
  .resume-head h2 { font-size: clamp(1.5rem, 3vw, 2.05rem); }
  .avatar { width: 58px !important; height: 58px !important; }
  .specialty-badge { margin-top: 4px; padding: 3px 9px; min-height: 20px; font-size: 0.7rem; }
  .contact-badges { margin: 8px 0; gap: 6px; }
  .contact-badges span, .social-badge { min-height: 24px; padding: 4px 8px; gap: 4px; font-size: 0.76rem; }
  .contact-badges span svg, .contact-badges span i, .social-badge svg { width: 12px !important; height: 12px !important; }
  .resume-summary { margin: 6px 0; line-height: 1.45; }
  .resume-section { margin-top: 10px; }
  .resume-section h3 { margin-bottom: 5px; padding-bottom: 3px; font-size: 0.98rem; }
  .resume-item { margin-bottom: 6px; gap: 1px; }
  .resume-item span { font-size: 0.8rem; }
  .resume-item p { margin-top: 2px; line-height: 1.4; }
  .project-link { margin-top: 3px; padding: 2px 8px; font-size: 0.72rem; }
  .project-link svg { width: 11px; height: 11px; }
  .tpl-layout-sidebar .resume-sidebar { padding: 16px 12px; gap: 5px; }
  .tpl-layout-sidebar .resume-main .resume-section:first-of-type { margin-top: 2px; }
  .tpl-layout-banner .resume-banner { padding: 16px 8mm 20px; margin: -8mm -8mm 10px; }
  .tpl-layout-geometric .geo-head { min-height: 130px; padding: 16px 8mm; }
  .tpl-layout-geometric .geo-sidebar { padding: 14px 8mm 16px; }
  .tpl-layout-geometric .geo-main { padding: 14px 8mm 16px; }
  .tpl-layout-geometric .geo-sidebar .sidebar-contact { margin-bottom: 10px; }

  .tpl-layout-sidebar { padding: 0 !important; }

  .resume-section, .resume-item, .resume-head, .geo-head {
    break-inside: avoid;
  }

  .avatar, .avatar-photo, .contact-badges span, .specialty-badge, .project-link,
  .resume-banner, .resume-sidebar, .geo-head, .geo-sidebar, .geo-role-badge {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
