* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  background: #E9E3D7;
  min-height: 100vh;
  padding: 32px 16px;
  font-family: 'EB Garamond', serif;
}

/* ── Password gate / identity picker ─────────────────── */
.gate-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

.gate-card {
  background: #F5F2EC;
  border: 0.5px solid #D5CFC4;
  border-radius: 12px;
  padding: 40px 44px;
  width: 100%;
  max-width: 400px;
  color: #1F1B17;
}

.gate-title {
  font-family: 'EB Garamond', serif;
  font-size: 26px;
  font-style: italic;
  font-weight: 400;
  color: #2A2620;
  line-height: 1.1;
  margin-bottom: 6px;
}

.gate-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8B8074;
  margin-bottom: 28px;
}

.gate-input {
  width: 100%;
  background: #FBF8F1;
  border: 0.5px solid #C8BCA8;
  border-radius: 4px;
  padding: 12px 14px;
  font-family: 'EB Garamond', serif;
  font-size: 18px;
  color: #1F1B17;
  outline: none;
  margin-bottom: 4px;
}

.gate-input:focus { border-color: #8B8074; }

.gate-error {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: #9B4040;
  margin-bottom: 8px;
  margin-top: 4px;
}

.picker-btns {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.picker-btn {
  flex: 1;
  background: #FBF8F1;
  border: 0.5px solid #C8BCA8;
  border-radius: 4px;
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #2A2620;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.picker-btn:hover {
  background: #EDE8DE;
  border-color: #8B8074;
}

/* ── Journal shell ────────────────────────────────────── */
.journal {
  max-width: 640px;
  margin: 0 auto;
  background: #F5F2EC;
  border-radius: 12px;
  border: 0.5px solid #D5CFC4;
  color: #1F1B17;
}

/* ── Header / masthead ─────────────────────────────────── */
.journal-header {
  padding: 24px 44px 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-bottom: 0.5px solid #D5CFC4;
  position: sticky;
  top: 0;
  z-index: 10;
  background: #F5F2EC;
  border-radius: 12px 12px 0 0;
}

.masthead .title {
  font-family: 'EB Garamond', serif;
  font-size: 26px;
  font-style: italic;
  font-weight: 400;
  color: #2A2620;
  line-height: 1.1;
}

.masthead .dash { font-style: normal; color: #B5A998; }

.masthead .sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #8B8074;
  margin-top: 8px;
}

.presence-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  flex-shrink: 0;
}

.presence-line {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6157;
  display: flex;
  align-items: center;
  gap: 7px;
}

.presence-line.dim { color: #9A8F82; }

.pdot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4caf7d;
  box-shadow: 0 0 0 2px rgba(76, 175, 125, 0.18);
  flex-shrink: 0;
}

.pdot.off {
  background: #B5A998;
  box-shadow: 0 0 0 2px rgba(181, 169, 152, 0.18);
}

/* ── Entries ──────────────────────────────────────────── */
.entries {
  padding: 32px 44px 20px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.entry { display: flex; flex-direction: column; }

.entry-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}

.entry-city {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-weight: 500;
  color: #2A2620;
}

.entry-date {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13.5px;
  color: #8B8074;
}

.entry-body {
  font-size: 17px;
  line-height: 1.7;
  color: #1F1B17;
  letter-spacing: 0.003em;
}

.entry-body p + p { margin-top: 0.9em; }

/* ── Editorial figure (photo) ─────────────────────────── */
figure { margin: 14px 0 4px; }

figure img {
  width: 100%;
  max-width: 460px;
  max-height: 640px;
  height: auto;
  display: block;
  border-radius: 3px;
}

figure figcaption {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: #8B8074;
  margin-top: 8px;
}

/* ── Editorial video figure ───────────────────────────── */
.video-figure {
  margin: 14px 0 4px;
  max-width: 460px;
}

.video-frame {
  position: relative;
  width: 100%;
  max-height: 640px;
  border-radius: 3px;
  overflow: hidden;
  cursor: pointer;
}

@media (hover: hover) {
  figure { cursor: zoom-in; }
  .video-frame { cursor: zoom-in; }
}

.video-frame video {
  width: 100%;
  height: auto;
  max-height: 640px;
  display: block;
}

.video-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-play {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-play svg {
  width: 18px;
  height: 18px;
  fill: white;
  margin-left: 3px;
}

.video-duration {
  position: absolute;
  bottom: 8px;
  right: 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.4);
  padding: 2px 7px;
  border-radius: 3px;
}

.video-figcaption {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: #8B8074;
  margin-top: 8px;
}

/* ── Video fullscreen modal ───────────────────────────── */
.video-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.video-modal video {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 4px;
}

.video-modal-close {
  position: absolute;
  top: 20px;
  right: 24px;
  color: rgba(255,255,255,0.7);
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
  background: none;
  border: none;
}

/* ── View-once inset ─────────────────────────────────── */
.once {
  margin: 14px 0 4px;
  border: 0.5px solid #C8BCA8;
  padding: 22px 24px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  max-width: 460px;
  transition: background 0.15s;
}

.once:hover { background: rgba(255, 255, 255, 0.85); }
.once.opened { cursor: default; opacity: 0.5; pointer-events: none; }

.once-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #E5DDD0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.once-icon svg {
  width: 14px;
  height: 14px;
  stroke: #6B6157;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.once-text { display: flex; flex-direction: column; gap: 2px; }

.once-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #2A2620;
  font-weight: 500;
}

.once-sub {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: #8B8074;
}

/* ── Day separator ─────────────────────────────────────── */
.day-rule {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 2px;
}

.day-rule::before,
.day-rule::after {
  content: '';
  flex: 1;
  border-top: 0.5px solid #DDD4C5;
}

.day-rule span {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: #A89F92;
}

/* ── Typing indicator ─────────────────────────────────── */
.typing {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: #A89F92;
  padding: 2px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.t-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #A89F92;
  animation: tb 1.4s infinite ease-in-out;
}

.t-dot:nth-child(2) { animation-delay: 0.15s; }
.t-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes tb {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* ── Compose section ──────────────────────────────────── */
.compose-section {
  padding: 24px 32px 32px;
  background: #EFEAE0;
  border-top: 0.5px solid #D5CFC4;
  border-radius: 0 0 12px 12px;
}

.compose-card {
  background: #FBF8F1;
  border: 0.5px solid #C8BCA8;
  border-radius: 6px;
  padding: 22px 26px 18px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.02);
}

.compose-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 0.5px solid #E5DDD0;
  gap: 12px;
}

.compose-from {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #2A2620;
  font-weight: 500;
}

.compose-now {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13.5px;
  color: #8B8074;
}

.compose-input {
  width: 100%;
  background: transparent;
  border: none;
  font-family: 'EB Garamond', serif;
  font-size: 18px;
  line-height: 1.7;
  color: #1F1B17;
  resize: none;
  outline: none;
  min-height: 110px;
}

.compose-input::placeholder {
  color: #B5A998;
  font-style: italic;
}

.compose-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 0.5px solid #E5DDD0;
  gap: 12px;
  flex-wrap: wrap;
}

.compose-tools {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.tool-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #6B6157;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 0;
}

.tool-btn svg {
  width: 15px;
  height: 15px;
  stroke: #6B6157;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-btn:hover { color: #2A2620; }
.tool-btn:hover svg { stroke: #2A2620; }

.once-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.once-toggle-label {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6157;
}

.pill {
  width: 28px;
  height: 16px;
  border-radius: 8px;
  background: #C8BCA8;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}

.pill.on { background: #4A6B85; }

.pill::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: left 0.2s;
}

.pill.on::after { left: 14px; }

.send-btn {
  background: #2A2620;
  color: #F5F2EC;
  border: none;
  border-radius: 3px;
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s;
}

.send-btn:hover { background: #1A1814; }
.send-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Upload indicator ─────────────────────────────────── */
.upload-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
}

.upload-indicator-text {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 14px;
  color: #A89F92;
}

/* ── Compose attachment preview ───────────────────────── */
.compose-attachment {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.02);
  border: 0.5px solid #E5DDD0;
  border-radius: 4px;
  position: relative;
}

.compose-attachment-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.compose-attachment-video-icon {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6B6157;
}

.compose-attachment-video-icon svg {
  width: 15px;
  height: 15px;
  stroke: #6B6157;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compose-attachment-remove {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #8B8074;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
}

.compose-attachment-remove:hover { color: #2A2620; }

/* ── Entry edit controls ──────────────────────────────── */
.entry-edited {
  font-family: 'EB Garamond', serif;
  font-style: italic;
  font-size: 13px;
  color: #A89F92;
}

.edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  display: flex;
  align-items: center;
  margin-left: auto;
}

.edit-btn svg {
  width: 12px;
  height: 12px;
  stroke: #8B8074;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.edit-btn:hover svg { stroke: #2A2620; }

.entry[data-editing] .edit-btn { display: none; }

.edit-textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.5);
  border: 0.5px solid #C8BCA8;
  border-radius: 3px;
  padding: 10px 12px;
  font-family: 'EB Garamond', serif;
  font-size: 17px;
  line-height: 1.7;
  color: #1F1B17;
  resize: vertical;
  outline: none;
  min-height: 80px;
}

.edit-textarea:focus { border-color: #8B8074; }

.edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: flex-end;
}

.edit-cancel-btn, .edit-save-btn {
  font-family: 'DM Sans', sans-serif;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.edit-cancel-btn {
  background: transparent;
  border: 0.5px solid #C8BCA8;
  color: #6B6157;
}

.edit-cancel-btn:hover { background: #EDE8DE; }

.edit-save-btn {
  background: #2A2620;
  border: none;
  color: #F5F2EC;
}

.edit-save-btn:hover { background: #1A1814; }

/* ── Mobile adjustments ───────────────────────────────── */
@media (max-width: 520px) {
  body { padding: 0; }
  .journal { border-radius: 0; border-left: none; border-right: none; }
  .journal-header { padding: 20px 20px 16px; border-radius: 0; }
  .entries { padding: 24px 20px 16px; }
  .compose-section { padding: 16px 16px 24px; border-radius: 0; }
  .compose-card { padding: 18px 18px 14px; }
  .gate-card { padding: 32px 24px; border-radius: 0; }
}
