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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  background: #fff;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #6b6660;
  text-decoration: none;
  transition: color 0.3s;
}

a:hover {
  color: #3a3835;
}

/* ====== View toggle ====== */

.view-nav {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  gap: 16px;
  z-index: 100;
}

.view-nav button {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 11px;
  color: #9e9a94;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 4px;
  transition: color 0.3s;
}

.view-nav button:hover {
  color: #6b6660;
}

.view-nav button:focus-visible {
  outline: 1px solid #6b6660;
  outline-offset: 2px;
}

[data-view="feed"] .view-nav [data-for="feed"],
[data-view="lists"] .view-nav [data-for="lists"],
[data-view="sidebar"] .view-nav [data-for="sidebar"] {
  color: #3a3835;
}

.view-feed,
.view-lists,
.view-sidebar { display: none; }

[data-view="feed"] .view-feed { display: block; }
[data-view="lists"] .view-lists { display: block; }
[data-view="sidebar"] .view-sidebar { display: flex; }

/* ====== FEED VIEW ====== */

.view-feed,
.view-lists {
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.axis-top,
.axis-bottom,
.axis-left,
.axis-right {
  position: fixed;
  z-index: 10;
  font-size: 11px;
  color: #6b6660;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

a.axis-right:hover {
  color: #3a3835;
}

.axis-top {
  top: 48px;
  left: 50%;
  transform: translateX(-50%);
}

.axis-bottom {
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
}

.axis-left {
  left: 48px;
  top: 50%;
  transform: translateY(-50%);
}

.axis-right {
  right: 48px;
  top: 50%;
  transform: translateY(-50%);
}

.feed {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  width: 75%;
  max-width: 1000px;
  margin: 0 auto;
  padding: 140px 0;
}

.feed-item.span-2 { grid-column: span 2; }
.feed-item.span-3 { grid-column: span 3; }
.feed-item.span-row-2 { grid-row: span 2; }
.feed-item.span-row-2 img, .feed-item.span-row-2 video { height: 100%; object-fit: cover; }
.sf-item.span-2 { grid-column: span 2; }
.sf-item.span-3 { grid-column: span 3; }
.sf-item.span-4 { grid-column: span 4; }
.sf-item.span-5 { grid-column: span 5; }

.feed-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-item img, .feed-item video {
  display: block;
  width: 100%;
  height: auto;
}

.feed-title {
  font-size: 10px;
  color: #9e9a94;
  letter-spacing: 0.03em;
}

.feed-year {
  color: #b5b0aa;
}

a.feed-item {
  text-decoration: none;
}

.feed-tweet {
  overflow: hidden;
}

.feed-tweet blockquote {
  margin: 0 !important;
}

.feed-tweet .twitter-tweet-rendered,
.feed-tweet twitter-widget {
  margin: 0 !important;
  padding: 0 !important;
}

.feed-tweet iframe {
  margin: 0 !important;
}

/* ====== LISTS VIEW ====== */

.lists-view {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: auto;
}

.list-cluster {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

h2.cluster-title {
  font-size: 11px;
  font-weight: 500;
  color: #3a3835;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.list-cluster span:not(.cluster-title),
.list-cluster a {
  font-size: 13px;
  color: #6b6660;
  line-height: 1.6;
}

.cluster-sub {
  color: #9e9a94 !important;
  font-size: 12px !important;
}

.list-cluster a:hover {
  color: #3a3835;
}

.cluster-name { top: 12%; left: 8%; }
.cluster-work { top: 18%; right: 12%; }
.cluster-products { top: 42%; left: 15%; }
.cluster-services { top: 55%; right: 20%; }
.cluster-writing { bottom: 22%; left: 8%; }
.cluster-contact { bottom: 12%; left: 42%; }
.cluster-social { bottom: 28%; right: 8%; }

@media (max-width: 768px) {
  .lists-view {
    height: auto;
    overflow: visible;
    padding: 60px 24px 80px;
  }

  .list-cluster {
    position: relative;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    margin-bottom: 40px;
  }
}

/* ====== SIDEBAR VIEW ====== */

.sidebar-view {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 320px;
  height: 100vh;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.2;
}

/* Sidebar markdown content */

.sidebar img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  display: block;
}

.sidebar h1 {
  font-size: 13px;
  color: #1a1a1a;
  font-weight: 500;
  margin-bottom: -14px;
}

.sidebar h1 + p {
  font-size: 13px;
  color: #9e9a94;
  line-height: 1.4;
  margin-bottom: -8px;
}

.sidebar > p {
  font-size: 13px;
  color: #1a1a1a;
  line-height: 1.2;
}

.sidebar > p a {
  color: #1a1a1a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sidebar .sidebar-section {
  display: flex;
  flex-direction: column;
}

.sidebar h2 {
  font-size: 13px;
  color: #1a1a1a;
  font-weight: 500;
  margin-bottom: 8px;
}

.sidebar ul {
  list-style: disc;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar li {
  font-size: 13px;
  color: #6b6660;
  line-height: 1.5;
}

.sidebar li a {
  color: #1a1a1a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Sidebar feed (right side) */

.sidebar-feed {
  margin-left: 320px;
  padding: 24px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-flow: dense;
  gap: 16px;
  overflow: hidden;
}

.sf-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sf-item img, .sf-item video {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.img-bordered img {
  border: 1px solid #efefef;
}

/* Grid editor controls */

.grid-edit-controls {
  position: fixed;
  bottom: 24px;
  left: 24px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.grid-edit-controls button {
  background: none;
  border: 1px solid #d5d0cb;
  font-family: inherit;
  font-size: 11px;
  color: #6b6660;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 3px;
  transition: color 0.2s, border-color 0.2s;
}

.grid-edit-controls button:hover {
  color: #3a3835;
  border-color: #9e9a94;
}

/* Edit mode item styles */

.grid-editing .sf-item {
  outline: 2px dashed #9e9a94;
  outline-offset: -1px;
  cursor: grab;
  position: relative;
  user-select: none;
}

.grid-editing .sf-item > *:not(.resize-handle):not(.span-badge):not(.feed-title) {
  pointer-events: none;
}

.grid-editing .sf-item .feed-title[contenteditable] {
  pointer-events: auto;
  cursor: text;
  user-select: text;
  border-bottom: 1px dashed #9e9a94;
}

.grid-editing .sf-item:active {
  cursor: grabbing;
}

.grid-editing .sf-item.dragging {
  opacity: 0.35;
}

.grid-editing .sf-item.drag-over {
  outline-color: #3a3835;
  outline-width: 3px;
}

/* Resize handle */

.resize-handle {
  position: absolute;
  top: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  z-index: 3;
}

.resize-handle-r { right: -4px; }
.resize-handle-l { left: -4px; }

.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 32px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.4);
  transition: background 0.15s;
}

.resize-handle-r::after { right: 2px; }
.resize-handle-l::after { left: 2px; }

.resize-handle:hover::after {
  background: rgba(0, 0, 0, 0.7);
}

.sf-item.resizing {
  outline-color: #3a3835;
  outline-style: solid;
}

/* Span badge */

.span-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 10px;
  font-family: inherit;
  letter-spacing: 0.03em;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  z-index: 2;
}

/* Sidebar XL */

@media (min-width: 1440px) {
  .sidebar-feed {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Sidebar mobile */

@media (max-width: 768px) {
  .sidebar-view {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    padding: 24px;
  }

  .sidebar-feed {
    margin-left: 0;
    padding: 24px;
    grid-template-columns: 1fr;
  }

  .sf-item.span-2,
  .sf-item.span-3,
  .sf-item.span-4,
  .sf-item.span-5 {
    grid-column: span 1;
  }
}