:root {
  --paper: #FFFFFF;
  --ink: #111111;
  --gray: #6E6E6E;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: #EAEAEA; color: var(--ink); }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 40px;
}

/* ---------- NAV ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(6px);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 24px;
}

.nav-mark {
  font-size: 16px;
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 24px;
  font-size: 16px;
  font-weight: 400;
}

/* ---------- WORK: project list ---------- */
.work {
  padding: 72px 24px 90px;
  position: relative;
}

.index-shell {
  max-width: 480px;
}

.index-item {
  display: block;
  padding: 8px 0;
  cursor: pointer;
}

.index-name {
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  transition: font-weight 0.1s ease;
}

.index-item:hover .index-name {
  font-weight: 700;
}

/* ---------- PREVIEW: outlined box with grey border and corner-to-corner X ---------- */
.preview-frame {
  position: fixed;
  /* centered horizontally */
  left: 50%;
  transform: translateX(-50%);
  /* roughly half the page width, with reasonable caps */
  width: min(50vw, 680px);
  height: min(48vh, 520px);
  /* no fill, subtle grey border */
  background: transparent;
  border-radius: 6px;
  border: 1px solid var(--gray);
  box-shadow: none;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible; /* allow X to reach corners */
  /* keep pointer events off for the frame itself */
  pointer-events: none;
}

/* top alignment is handled in JS (previewFrame.style.top) */

/* hide legacy dashed line element if present */
.preview-line { display: none; }

/* X across the box using pseudo elements centered and long enough to hit corners */
.preview-frame::before,
.preview-frame::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 160%;
  height: 1px;
  background: var(--gray);
  transform-origin: center;
  pointer-events: none;
  opacity: 0.5;
}
.preview-frame::before { transform: translate(-50%, -50%) rotate(45deg); }
.preview-frame::after  { transform: translate(-50%, -50%) rotate(-45deg); }

/* preview images sized a bit larger so they feel proportional to the outlined box */
.preview-frame img {
  position: absolute;
  top: 50%;
  left: 50%;
  /* slightly inset from the border so the image doesn't touch it */
  width: calc(100% - 32px);
  height: calc(100% - 32px);
  object-fit: cover;
  transform: translate(-50%, -50%) rotate(0deg);
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.25s ease;
  pointer-events: auto;
}

/* visible/active image */
.preview-frame img.active {
  opacity: 1;
}

/* ---------- PROJECT DETAIL PAGE ---------- */
.project-header {
  padding-top: 40px;
  padding-bottom: 60px;
}

.back-link {
  font-size: 16px;
  font-weight: 400;
  color: var(--ink);
  display: inline-block;
  margin-bottom: 40px;
}

.project-meta {
  font-size: 16px;
  font-weight: 400;
  color: var(--gray);
  margin-bottom: 12px;
}

.project-title {
  font-size: 16px;
  font-weight: 400;
}

.project-desc {
  margin-top: 12px;
  max-width: 560px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 400;
}

.project-gallery {
  padding-top: 20px;
  padding-bottom: 100px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.project-gallery img {
  width: 100%;
  border-radius: 6px;
  display: block;
}

@media (max-width: 780px) {
  .wrap { padding: 0 20px; }
  nav { padding: 18px 20px; }
  .work { padding: 24px 20px 60px; }
  .preview-frame { display: none; }
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
