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

:root {
  --bg: #ecebe6;
  --text: #1a1a1a;
  --muted: #888888;
  --border: #dcdcd6;
  --font: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.theme-dark {
  --bg: #121212;
  --text: #ecebe6;
  --border: #333333;
  --muted: #666666;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

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

/* ── Nav ── */
nav {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--text);
  background: var(--bg);
  z-index: 10;
}

.site-name {
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.site-name-mobile { display: none; }

.site-name:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  font-size: 0.875rem;
}

.nav-links a:hover { 
  text-decoration: underline; 
}

/* ── Homepage project list ── */
.project-list {
  padding: 38vh 2rem 2rem;
}

.project-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity 0.1s;
}

.project-row:first-child { border-top: 1px solid var(--border); }

.project-row:hover .project-name { text-decoration: underline; }

.project-name { font-size: 1.3rem; }
.project-row--small .project-name { font-size: 0.95rem; }

.project-descriptor {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Hover preview ── */
#preview {
  position: fixed;
  pointer-events: none;
  width: 400px;
  display: flex;
  align-items: center;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 1000;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#preview img {
  width: 100%;
  height: auto;
  display: block;
}

#preview.visible { opacity: 1; }

/* ── Footer ── */
footer {
  padding: 5rem 2rem 3rem;
  margin-top: 15vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#logo-footer {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  user-select: none;
  line-height: 1;
}

.logo-letter {
  font-size: clamp(2.8rem, 9vw, 8rem);
  font-weight: 700;
  font-family: var(--font);
  letter-spacing: 0;
  line-height: 1;
  display: inline-block;
  cursor: grab;
}

.logo-ghost {
  display: inline-block;
  height: 1em;
  flex-shrink: 0;
}

.logo-letter:active { cursor: grabbing; }

.logo-space {
  cursor: default;
  pointer-events: none;
}

/* ── Project page header ── */
.project-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--text);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.project-title { font-size: 0.875rem; }

.back-link {
  font-size: 0.875rem;
  border: 1px solid var(--text);
  padding: 0.4rem 0.8rem;
}

.back-link:hover { 
  background: var(--text);
  color: var(--bg);
  text-decoration: none; 
}

/* ── Center-line content layout ── */
.content-line {
  position: relative;
  padding-top: 0;
}

.content-line::before {
  content: '';
  position: fixed;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--text);
  pointer-events: none;
  z-index: 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  position: relative;
  z-index: 1;
}

.block-left  { grid-column: 1; padding: 2.5rem 1rem 2.5rem 2rem; }
.block-right { grid-column: 2; padding: 2.5rem 2rem 2.5rem 1rem; }
.block-full  { grid-column: 1 / -1; padding: 2.5rem 2rem; }
.block-empty { display: block; }

.block-full .img-ph,
.block-full .caption {
  width: 50%;
  margin-left: auto;
  margin-right: auto;
}

/* Image placeholders (replace with <img> later) */
.img-ph {
  width: 100%;
  display: block;
}

.img-ph.r-landscape { aspect-ratio: 3/2; }
.img-ph.r-portrait  { aspect-ratio: 2/3; }
.img-ph.r-square    { aspect-ratio: 1; }
.img-ph.r-wide      { aspect-ratio: 16/9; }

.img-ph.c1 { background: #c9c6c1; }
.img-ph.c2 { background: #bfbdb8; }
.img-ph.c3 { background: #d2cfc9; }
.img-ph.c4 { background: #b4b2ae; }
.img-ph.c5 { background: #cac7c3; }

.caption {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ── Project intro text ── */
.project-intro {
  max-width: 100%;
}

.spec-title {
  font-size: 0.875rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
}

.spec-row {
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

.spec-key {
  font-weight: 700;
  margin-right: 0.3rem;
}

.spec-desc {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.8;
  margin-top: 1rem;
}

.intro-text {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.7;
  max-width: 38ch;
  margin: 0 auto;
  text-align: center;
}

/* ── Mobile ── */
@media (max-width: 680px) {
  .site-name-desktop { display: none; }
  .site-name-mobile { display: inline; }

  nav, .project-header { padding: 1rem; }
  .project-list { padding: 6rem 1rem 2rem; }
  footer { padding: 3rem 1rem 2rem; margin-top: 4rem; }
  .project-intro { max-width: 100%; padding: 2rem 1rem 0; }

  .content-grid { grid-template-columns: 1fr; }
  .block-left, .block-right, .block-full { grid-column: 1; padding: 1.5rem 1rem; }
  .block-empty { display: none; }
  .content-line::before { display: none; }

  .block-full .img-ph,
  .block-full .caption {
    width: 100%;
  }

  #preview { display: none; }

  .about-overlay {
    width: 100vw;
    border-left: none;
  }

  /* Spec intro block — full width on mobile, not 25% */
  .content-grid .block-full > div[style*="0 0 25%"] {
    flex: 0 0 100% !important;
    padding-right: 0 !important;
  }

  /* Images and inner containers — override inline percentages */
  .block-full img,
  .block-left img,
  .block-right img {
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
  }
  .block-left > div[style*="width:"],
  .block-right > div[style*="width:"],
  .block-full > div[style*="width:"] {
    width: 100% !important;
  }

  /* Lamp swap container at 30% would be ~110px on phone */
  .lamp-swap { width: 70% !important; }

  /* Project rows: stack name above descriptor on narrow screens */
  .project-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding: 0.9rem 0;
  }

  /* Larger tap targets */
  .back-link { padding: 0.6rem 1rem; font-size: 0.95rem; }
  .about-close { padding: 0.5rem 0; font-size: 1rem; }

  /* Frame lines at 1rem from edges hug content too tightly on phones */
  .line-left, .line-right { display: none; }
}

/* ── Floating Title & Lines ── */
.line-left, .line-right {
  position: fixed;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--text);
  z-index: 99;
  pointer-events: none;
}
.line-left { left: 1rem; }
.line-right { right: 1rem; }

.floating-title {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  background: var(--bg);
  border: 1px solid var(--text);
  padding: 0.4rem 0.8rem;
  font-size: 0.875rem;
  z-index: 999;
  display: flex;
  gap: 1rem;
}
.floating-title-bold {
  font-weight: bold;
}

/* ── About Overlay ── */
.about-overlay {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--text);
  z-index: 900;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.76, 0, 0.24, 1);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 2rem;
  overflow-y: auto;
}

.about-overlay.open {
  transform: translateX(0);
}

.about-close {
  align-self: flex-end;
  cursor: pointer;
  font-size: 0.875rem;
  margin-bottom: 4rem;
}

.about-close:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.about-content {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.about-block {
  margin-bottom: 3rem;
  max-width: 80%;
}

.about-block h3 {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.about-block p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text);
}

.contact-block {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-bottom: 2rem;
}

.contact-block a {
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--text);
}

.contact-block a:hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
