/* === Reset & Base === */

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

html {
  font-size: 14px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  color: #334155;
  background: #f1f5f9;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #0f172a;
}

main {
  max-width: 900px;
  margin: 40px auto;
  background: #fff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

/* === Controls (hidden when printing) === */
.no-print {
  @media print {
    display: none !important;
  }
}

header.no-print {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8f0;
  padding: 12px 24px;
}

.controls {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  gap: 32px;
  align-items: center;
}

.control-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.control-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #64748b;
  letter-spacing: 0.05em;
  margin-right: 4px;
  font-weight: 600;
}

.toggle-btn {
  display: inline-block;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 4px 12px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  color: #475569;
  text-decoration: none;
}

.toggle-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.toggle-btn.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

footer {
  text-align: center;
  padding: 24px;
  color: #94a3b8;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.print-button {
  appearance: none;
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  min-height: 42px;
  padding: 0 18px;
}

.print-button:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.print-button:active {
  background: #0f172a;
  border-color: #0f172a;
}

.print-button:focus-visible {
  outline: 3px solid rgba(59, 130, 246, 0.35);
  outline-offset: 3px;
}

footer small {
  color: #94a3b8;
}

/* === CV Document Layout === */
.cv-document {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

/* === Sidebar === */
.sidebar {
  background: #f8fafc;
  padding: 40px 32px;
  border-right: 1px solid #e2e8f0;
}

.sidebar-header {
  margin-bottom: 32px;
  text-align: center;
}

.photo {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sidebar h2 {
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #0f172a;
  margin-bottom: 16px;
  margin-top: 36px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.contact-item strong {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  font-weight: 600;
}

.contact-item span,
.contact-item a {
  font-size: 0.9rem;
  color: #334155;
  text-decoration: none;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.contact-item a:hover {
  color: #0f172a;
  text-decoration: underline;
}

.contact-item.links {
  margin-top: 8px;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
}

.contact-item.links a {
  display: inline-block;
  padding: 4px 10px;
  background: #e2e8f0;
  border-radius: 4px;
  font-size: 0.8rem;
}

.contact-item.links a:hover {
  background: #cbd5e1;
  text-decoration: none;
}

.skills-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.skill-category strong {
  display: block;
  font-size: 0.85rem;
  color: #0f172a;
  margin-bottom: 4px;
}

.skill-category p {
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.4;
}

.activities ul {
  list-style: none;
}

.activities li {
  position: relative;
  font-size: 0.85rem;
  color: #475569;
  margin-bottom: 10px;
  padding-left: 16px;
  line-height: 1.4;
}

.activities li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: #94a3b8;
  font-weight: bold;
}

/* === Main Content === */
.main-content {
  padding: 40px 48px;
}

.main-header {
  margin-bottom: 36px;
}

.name {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 8px;
}

.subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 500;
  color: #3b82f6; /* A subtle tech blue */
  letter-spacing: -0.01em;
}

.main-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #0f172a;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 8px;
  margin-top: 32px;
  margin-bottom: 20px;
}

.profile p {
  font-size: 1rem;
  color: #334155;
  line-height: 1.7;
}

/* === Job === */
.job {
  margin-bottom: 28px;
  page-break-inside: avoid;
}

.job-header {
  margin-bottom: 10px;
}

.job-title-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}

.job-company {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #0f172a;
}

.job-period {
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
  margin-left: 16px;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.job-role {
  font-size: 1rem;
  font-weight: 600;
  color: #3b82f6;
  margin-bottom: 2px;
}

.job-context {
  font-size: 0.85rem;
  color: #64748b;
  font-style: italic;
}

.job-bullets ul {
  list-style: none;
}

.job-bullets li {
  position: relative;
  font-size: 0.95rem;
  color: #334155;
  margin-bottom: 6px;
  padding-left: 18px;
  line-height: 1.6;
}

.job-bullets li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: #94a3b8;
  font-size: 0.9em;
}

.job-bullets li strong {
  color: #0f172a;
  font-weight: 600;
}

/* === Education === */
.edu-item {
  margin-bottom: 20px;
  page-break-inside: avoid;
}

.edu-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
}

.edu-header strong {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  color: #0f172a;
}

.edu-header span {
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.edu-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 2px;
}

.edu-detail {
  font-size: 0.9rem;
  color: #64748b;
  line-height: 1.5;
}

/* === Consent === */
.consent {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
}

.consent p {
  font-size: 0.75rem;
  color: #94a3b8;
  line-height: 1.5;
  text-align: justify;
}

/* === Responsive Layout === */
@media (max-width: 960px) {
  main {
    margin: 24px 16px;
  }

  .cv-document {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .sidebar {
    padding: 32px 24px;
  }

  .main-content {
    padding: 36px 36px;
  }

  .name {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.15rem;
  }
}

@media (max-width: 760px) {
  html {
    font-size: 15px;
  }

  body {
    background: #fff;
  }

  header.no-print {
    padding: 10px 12px;
  }

  .controls {
    max-width: none;
    justify-content: space-between;
    gap: 10px;
  }

  .control-group {
    gap: 4px;
  }

  .control-label {
    display: none;
  }

  .toggle-btn {
    padding: 6px 10px;
    font-size: 0.78rem;
  }

  main {
    width: 100%;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .cv-document {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    order: 2;
    padding: 28px 22px 32px;
    border-top: 1px solid #e2e8f0;
    border-right: 0;
  }

  .sidebar-header {
    display: none;
  }

  .contact-info {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 18px;
  }

  .contact-item.links {
    grid-column: 1 / -1;
    margin-top: 0;
  }

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

  .main-content {
    order: 1;
    padding: 30px 22px 28px;
  }

  .main-header {
    margin-bottom: 24px;
  }

  .name {
    font-size: 2.15rem;
    letter-spacing: 0;
  }

  .subtitle {
    font-size: 1.08rem;
    line-height: 1.35;
  }

  .main-content h2,
  .sidebar h2 {
    margin-top: 26px;
    margin-bottom: 14px;
  }

  .job {
    margin-bottom: 24px;
  }

  .job-title-line,
  .edu-header {
    display: block;
  }

  .job-period,
  .edu-header span {
    display: inline-block;
    margin-top: 6px;
    margin-left: 0;
  }

  .job-bullets li {
    padding-left: 16px;
  }

  .consent {
    margin-top: 34px;
  }
}

@media (max-width: 520px) {
  .controls {
    align-items: stretch;
  }

  .control-group {
    flex: 1 1 0;
  }

  .toggle-btn {
    flex: 1 1 0;
    text-align: center;
  }

  .main-content {
    padding: 26px 18px 24px;
  }

  .sidebar {
    padding: 24px 18px 30px;
  }

  .name {
    font-size: 1.85rem;
  }

  .profile p {
    line-height: 1.6;
  }

  .contact-info,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .job-company {
    font-size: 1.12rem;
  }

  .job-role {
    line-height: 1.35;
  }

  footer {
    padding: 22px 18px 28px;
  }

  .print-button {
    width: 100%;
    max-width: 320px;
  }
}

/* === Print Optimizations === */
@media print {
  @page {
    size: A4;
    margin: 5mm; /* Small margin to prevent printer clipping, but maximizes space */
  }

  html {
    font-size: 10px; /* Reduce base font to fit more content */
  }

  body {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    background: linear-gradient(to right, #f8fafc 0, #f8fafc 220px, #ffffff 220px, #ffffff 100%) !important;
    line-height: 1.4;
    min-height: 100vh;
  }

  main {
    max-width: none;
    margin: 0;
    box-shadow: none;
    border-radius: 0;
    background: transparent !important;
  }

  /* Faux column for sidebar background to ensure it extends full height */
  .cv-document {
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
    background: transparent !important;
  }

  .sidebar {
    background: transparent !important;
    border-right: 1px solid #e2e8f0 !important;
    padding: 20px 16px;
  }

  .sidebar-header {
    margin-bottom: 16px;
  }

  .photo {
    width: 90px;
    height: 90px;
    border-width: 2px;
  }

  .sidebar h2 {
    margin-top: 20px;
    margin-bottom: 10px;
  }

  .contact-info {
    gap: 10px;
  }

  .skills-grid {
    gap: 10px;
  }

  .main-content {
    padding: 20px 24px;
  }

  .main-header {
    margin-bottom: 16px;
  }

  .name {
    font-size: 2.2rem;
    margin-bottom: 4px;
  }

  .subtitle {
    font-size: 1.1rem;
  }

  .main-content h2 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-size: 1rem;
    padding-bottom: 4px;
  }

  .job {
    margin-bottom: 12px;
  }

  .job-header {
    margin-bottom: 4px;
  }

  .job-title-line {
    margin-bottom: 0;
  }

  .job-company {
    font-size: 1.05rem;
  }

  .job-role {
    font-size: 0.95rem;
  }

  .job-bullets li {
    font-size: 0.9rem;
    margin-bottom: 2px;
    line-height: 1.4;
  }

  .edu-item {
    margin-bottom: 10px;
  }

  .edu-header strong {
    font-size: 1rem;
  }

  .edu-title {
    font-size: 0.9rem;
  }

  .edu-detail {
    font-size: 0.85rem;
  }

  .consent {
    margin-top: 16px;
    padding-top: 10px;
  }

  .consent p {
    font-size: 0.7rem;
    line-height: 1.3;
  }
}
