:root {
  color-scheme: dark;

  --bg: #181818;
  --surface: #1F1F1F;
  --surface-hover: #232323;
  --ink: #EDEDED;
  --ink-soft: #A0A0A0;
  --ink-dim: #6E6E6E;
  --rule: #2D2D2D;
  --accent: #FFFFFF;

  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;

  --container: 1200px;
  --gutter: clamp(24px, 5vw, 64px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) var(--gutter) 48px;
}

a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
  transition: background 0.15s ease, color 0.15s ease;
}

a:hover {
  background: var(--surface-hover);
}

/* ---------- Masthead ---------- */
.masthead {
  margin: 0 0 clamp(28px, 4vw, 40px);
}

.masthead h1 {
  font-size: clamp(3.5rem, 13vw, 10rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.045em;
  margin: 0;
}

/* ---------- Banner (Substack) ---------- */
.banner {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 18px 22px;
  border: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 0 0 clamp(12px, 2vw, 18px);
  text-decoration: none;
  color: var(--ink);
  transition: background 0.15s ease;
}

.banner:hover { background: var(--surface-hover); }

.banner-label {
  font-weight: 500;
  font-size: 0.95rem;
  flex: 1;
}

.banner-arrow {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

/* ---------- Projects (collapsible) ---------- */
.project {
  border: 1px solid var(--rule);
  margin: 0 0 clamp(12px, 2vw, 18px);
  background: var(--bg);
}

.project[open] {
  margin-bottom: clamp(24px, 4vw, 40px);
}

.project-summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.project-summary::-webkit-details-marker { display: none; }
.project-summary::marker { content: ""; }

.project-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.project-name {
  font-weight: 500;
  font-size: 0.95rem;
}

.project-tag {
  font-size: 0.85rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

.project-toggle {
  width: 14px;
  height: 14px;
  position: relative;
  flex-shrink: 0;
  color: var(--ink-soft);
}

.project-toggle::before,
.project-toggle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: currentColor;
  transition: transform 0.2s ease;
}

.project-toggle::before {
  width: 12px;
  height: 1px;
  transform: translate(-50%, -50%);
}

.project-toggle::after {
  width: 1px;
  height: 12px;
  transform: translate(-50%, -50%);
}

.project[open] .project-toggle::after {
  transform: translate(-50%, -50%) scaleY(0);
}

/* ---------- Project content ---------- */
.project-content {
  border-top: 1px solid var(--rule);
}

.pan-container {
  width: 100%;
  overflow: hidden;
  position: relative;
  line-height: 0;
  background: #222;
  touch-action: none;
}

.pan-image {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1);
  transform-origin: 50% 50%;
  transition: transform-origin 0.15s ease-out;
  will-change: transform-origin, transform;
}

@media (hover: none) and (pointer: coarse) {
  .pan-image { transform: scale(1.75); }
}

.zoom-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  animation: zoom-hint 2.6s ease-in-out infinite;
  transition: opacity 0.25s ease;
  z-index: 2;
}

.pan-container.is-zoomed .zoom-hint {
  opacity: 0;
}

@keyframes zoom-hint {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.1); }
}

@media (hover: hover) and (pointer: fine) {
  .pan-container { cursor: default; }
  .pan-container.is-zoomed { cursor: grab; }
  .pan-container.is-dragging { cursor: grabbing; }
  .drag-hint { display: none; }
  .zoom-hint { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .zoom-hint { animation: none; }
}

.pan-container.is-dragging .pan-image {
  transition: none;
}

.drag-hint {
  position: absolute;
  bottom: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  animation: drag-hint 2.6s ease-in-out infinite;
  transition: opacity 0.3s ease;
  z-index: 2;
}

.pan-container.is-interacting .drag-hint {
  opacity: 0;
}

@keyframes drag-hint {
  0%, 100% { transform: translate(0, 0); }
  25%     { transform: translate(-6px, -3px); }
  50%     { transform: translate(-8px, 0); }
  75%     { transform: translate(-4px, 4px); }
}

@media (prefers-reduced-motion: reduce) {
  .drag-hint { animation: none; }
}

.placeholder-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-dim);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.product-preview {
  min-height: 420px;
  padding: clamp(20px, 4vw, 44px);
  background: #161616;
  display: grid;
  grid-template-columns: minmax(132px, 0.22fr) minmax(0, 1fr);
  gap: 1px;
  border-bottom: 1px solid var(--rule);
}

.product-sidebar,
.product-panel {
  background: var(--surface);
  border: 1px solid var(--rule);
}

.product-sidebar {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.product-logo {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  border: 1px solid var(--rule);
  font-size: 0.9rem;
  font-weight: 600;
}

.product-nav {
  padding: 9px 10px;
  color: var(--ink-soft);
  font-size: 0.86rem;
}

.product-nav.is-active {
  color: var(--ink);
  background: #2A2A2A;
}

.product-panel {
  min-width: 0;
  padding: clamp(18px, 3vw, 28px);
  display: grid;
  align-content: start;
  gap: 22px;
}

.product-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
}

.product-toolbar strong {
  display: block;
  margin-top: 2px;
  font-size: clamp(1.45rem, 3vw, 2.3rem);
  line-height: 1.05;
  font-weight: 560;
}

.product-kicker,
.product-status,
.product-domain span,
.product-row-head {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.product-status {
  white-space: nowrap;
  border: 1px solid var(--rule);
  padding: 6px 9px;
  color: var(--ink);
}

.product-table {
  border: 1px solid var(--rule);
}

.product-row {
  display: grid;
  grid-template-columns: minmax(74px, 0.8fr) minmax(0, 1.6fr) minmax(52px, 0.4fr);
  gap: 14px;
  padding: 13px 14px;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
}

.product-row:first-child {
  border-top: 0;
}

.product-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-domain {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: baseline;
  padding: 16px 0 0;
  border-top: 1px solid var(--rule);
}

.product-domain strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.project-body {
  padding: clamp(24px, 4vw, 40px);
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(20px, 4vw, 56px);
  align-items: start;
}

.project-body p {
  margin: 0;
  max-width: 48ch;
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
}

.cta {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  padding: 13px 21px;
  font-weight: 500;
  font-size: 0.95rem;
  border: 1px solid var(--accent);
  transition: background 0.15s ease, color 0.15s ease;
}

.cta:hover {
  background: var(--accent);
  color: #111;
}

.cta-secondary {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */
footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  margin-top: clamp(48px, 8vw, 80px);
  padding-top: 32px;
  border-top: 1px solid var(--rule);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

footer p { margin: 0; }

/* ---------- Selection ---------- */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .project-body {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .product-preview {
    min-height: 0;
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .product-sidebar {
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }

  .product-logo {
    margin: 0 8px 0 0;
    flex: 0 0 auto;
  }

  .product-nav {
    flex: 0 0 auto;
  }

  .product-toolbar,
  .product-domain {
    flex-direction: column;
    gap: 10px;
  }

  .product-status {
    align-self: flex-start;
  }

  .product-row {
    grid-template-columns: minmax(70px, 0.8fr) minmax(0, 1.2fr) minmax(44px, 0.35fr);
    gap: 10px;
    padding: 11px 10px;
    font-size: 0.82rem;
  }

  .project-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .banner, .project-summary {
    flex-wrap: wrap;
  }
}
