/* =========================================
   Portfolio Typography Refinements
   ========================================= */

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

main {
  max-width: 950px;
  margin: auto;
}

body {
  line-height: 1.65;
}

/* Profile picture */
.profile-pic {
  width: 220px;
  height: 220px;
  object-fit: cover;

  border-radius: 12px;

  border: 2px solid #3a4a5c;

  box-shadow: 0 4px 14px rgba(0,0,0,0.35);

  margin-bottom: 12px;
}

/* Improve section flow */

h2 {
  margin-top: 40px;
  margin-bottom: 10px;
}

h3 {
  margin-top: 30px;
  margin-bottom: 8px;
}

h4 {
  margin-top: 22px;
  margin-bottom: 6px;
}

/* Prevent headings sticking to lists */

h4 + ul,
h4 + ol {
  margin-top: 10px;
}

/* Improve paragraph rhythm */

p {
  margin-bottom: 14px;
}

/* =========================================
   List readability improvements
   ========================================= */

ul, ol {
  margin-top: 10px;
  margin-bottom: 20px;
  padding-left: 26px;
}

li {
  margin-bottom: 9px;
  line-height: 1.6;
}

/* Methodology steps slightly spaced */

.method-step {
  margin-bottom: 12px;
}

/* Nested list spacing */

li ul,
li ol {
  margin-top: 6px;
  margin-bottom: 6px;
}

/* Make numbered process lists clearer */

ol li::marker {
  font-weight: 600;
  color: #8fb3ff;
}

/* =========================================
   Section layout improvements
   ========================================= */

.page {
  max-width: 900px;
}

/* Improve horizontal rule spacing */

hr {
  margin-top: 30px;
  margin-bottom: 30px;
}

/* =========================================
   Viewer spacing consistency
   ========================================= */

.viewer {
  margin-top: 16px;
  margin-bottom: 24px;
}

.viewer-tabs,
.viewer-controls {
  margin-top: .5rem;
}

.viewer-box,
.pdf-viewer,
.image-viewer,
.file-fallback {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
  -webkit-overflow-scrolling: touch;
}

.viewer-box {
  width: 70vw;
  max-width: 100%;
  height: 600px;
  overflow: auto;
}

.viewer-pre {
  margin: 0;
  padding: .75rem;
  white-space: pre;
  tab-size: 2;
  min-width: max-content;
}

.viewer-pre code {
  display: block;
}

.pdf-viewer iframe {
  display: block;
  width: 100%;
  height: clamp(500px, 75vh, 950px);
  border: 0;
}

.image-viewer {
  padding: .75rem;
  text-align: center;
}

.image-viewer img,
.markdown-viewer img {
  max-width: 100%;
  height: auto;
  display: inline-block;
  border-radius: 8px;
}

.file-fallback {
  padding: 1rem;
}

.markdown-viewer {
  padding: 1rem;
  line-height: 1.6;
}

.markdown-viewer pre {
  overflow: auto;
  padding: .75rem;
  border-radius: 8px;
  background: rgba(0,0,0,.28);
}

.markdown-viewer code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.html-viewer {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: rgba(0,0,0,.18);
}

.html-viewer iframe {
  display: block;
  width: 100%;
  height: clamp(700px, 85vh, 1400px);
  border: 0;
  background: white;
}

.print-artifact-summary {
  padding: 1rem 1.1rem;
  border: 1px solid rgba(0,0,0,.18);
  border-radius: 10px;
  background: rgba(0,0,0,.03);
  margin-top: .75rem;
}

.print-artifact-note {
  margin-top: .5rem;
  margin-bottom: 0;
  font-size: .85rem;
  opacity: .7;
}

/* =========================================
   Print optimization
   ========================================= */

@media print {
  a,
  a:visited {
    color: black;
    text-decoration: underline;
  }

  a::after {
    content: "";
  }

  body {
    background: white;
    color: black;
  }

  nav {
    display: none;
  }

  button {
    display: none;
  }

  .viewer-controls,
  .viewer-tabs {
    display: none !important;
  }

  ul, ol {
    margin-bottom: 14px;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  li {
    margin-bottom: 6px;
  }

  h2, h3, h4 {
    break-after: avoid;
    page-break-after: avoid;
  }

  .page {
    page-break-after: always;
    break-after: page;
  }

  details[data-viewer-root] {
    break-inside: avoid-page;
  }

  .viewer-box,
  .pdf-viewer,
  .image-viewer,
  .file-fallback,
  .markdown-viewer {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    border: 1px solid rgba(0,0,0,.15);
    background: transparent !important;
    box-shadow: none !important;
  }

  .viewer-box {
    width: 100% !important;
    height: auto !important;
  }

  .viewer-pre {
    white-space: pre-wrap;
    word-break: break-word;
    overflow: visible !important;
  }

  .markdown-viewer pre {
    white-space: pre-wrap;
    overflow: visible !important;
  }

  .image-viewer img,
  .markdown-viewer img {
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid;
  }

  .image-viewer p {
    display: none !important;
  }

  iframe {
    max-height: 700px;
  }

    .html-viewer {
    border: 1px solid rgba(0,0,0,.15);
    background: transparent !important;
  }

  .html-viewer iframe {
    width: 100%;
    height: 900px;
  }

  .pdf-print-note {
    padding: .75rem 1rem;
  }

    .print-artifact-summary {
    background: transparent !important;
    border: 1px solid rgba(0,0,0,.2);
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .print-artifact-note {
    font-size: .8rem;
    opacity: .75;
  }
}