: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;
}

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

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

.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;
}

.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;
  }
  .project-actions {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .banner, .project-summary {
    flex-wrap: wrap;
  }
}
