:root {
  --app-max-width: 500px;
  --page-padding: 16px;
  --text: #111;
  --muted: #444;
  --line: #e6e6e6;
}

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

html {
  -webkit-text-size-adjust: none;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: #fff;
  color: var(--text);
  font-family:
    "Roboto Condensed",
    system-ui,
    -apple-system,
    sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  appearance: none;
}

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

.page-shell {
  width: 100%;
  max-width: var(--app-max-width);
  margin: 0 auto;
  padding: 18px 0 56px;
}

.page-shell-post {
  padding-top: 14px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 0 var(--page-padding) 18px;
}

.site-header-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.site-title {
  display: inline-block;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: 0;
}

.site-tagline {
  margin: 0;
  font-size: 14px;
  line-height: 1.2;
  color: var(--text);
}

.edit-mark {
  font-size: 0.8em;
  font-weight: 400;
  white-space: nowrap;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.post-row {
  display: grid;
  grid-template-columns: minmax(112px, 34%) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  width: 100%;
  padding: 0;
  border: 0;
  background: #fff;
  text-align: left;
  color: inherit;
}

.post-row.is-clickable {
  cursor: pointer;
}

.post-thumb {
  aspect-ratio: 4 / 5;
  width: 100%;
  object-fit: cover;
  border-radius: 0;
  background: #efefef;
}

.post-copy {
  display: flex;
  min-width: 0;
  min-height: 100%;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 12px var(--page-padding) 12px 0;
}

.post-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: 0;
}

.post-subtitle,
.post-date {
  margin: 0;
  line-height: 1.2;
}

.post-subtitle {
  font-size: 15px;
  color: var(--text);
}

.post-date {
  font-size: 14px;
  color: var(--muted);
}

.admin-chip {
  display: block;
  margin: 0;
  padding: 0 var(--page-padding) 12px;
  color: var(--muted);
  font-size: 13px;
}

.floating-add {
  position: fixed;
  right: max(16px, calc((100vw - var(--app-max-width)) / 2 + 16px));
  bottom: 16px;
  display: grid;
  height: 72px;
  width: 72px;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: #111;
  color: #fff;
  font-size: 42px;
  line-height: 1;
  cursor: pointer;
  z-index: 30;
}

.empty-state {
  margin: 0 var(--page-padding);
  padding: 20px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 0 var(--page-padding) 14px;
}

.back-link {
  color: var(--text);
  font-size: 14px;
}

.post-view {
  display: grid;
  gap: 0;
}

.carousel-shell {
  position: relative;
  overflow: hidden;
  border-radius: 0;
  background: #fff;
}

.carousel-track {
  display: flex;
  transition: transform 220ms ease;
  touch-action: pan-y;
}

.carousel-slide {
  min-width: 100%;
}

.carousel-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  background: #efefef;
}

.carousel-nav {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
}

.ghost-button {
  border: 0;
  border-radius: 0;
  background: rgba(17, 17, 17, 0.9);
  color: #fff;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.carousel-dots {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 6px;
}

.carousel-dot {
  width: 6px;
  height: 6px;
  background: rgba(255, 255, 255, 0.5);
}

.carousel-dot.is-active {
  background: #fff;
}

.post-body-shell {
  padding: 14px var(--page-padding) 0;
}

.post-body-shell .post-title {
  margin-bottom: 6px;
}

.post-body {
  margin-top: 18px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.modal,
.login-modal {
  position: fixed;
  inset: 0;
  display: none;
  padding: 0;
  background: rgba(255, 255, 255, 0.96);
  z-index: 40;
}

.modal {
  place-items: end center;
}

.login-modal {
  place-items: center;
}

.modal.is-open,
.login-modal.is-open {
  display: grid;
}

.modal-card,
.login-card {
  width: min(100%, var(--app-max-width));
  border: 1px solid var(--line);
  background: #fff;
}

.modal-card {
  max-height: 100vh;
  overflow: auto;
  border-radius: 0;
  padding: 16px;
}

.login-card {
  border-radius: 0;
  padding: 16px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-title,
.login-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.login-copy,
.form-message,
.login-error {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  padding: 0;
}

.editor-form,
.login-form {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field textarea,
.login-input {
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.field textarea {
  min-height: 160px;
  resize: vertical;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

.button {
  border: 0;
  border-radius: 0;
  padding: 12px 14px;
  cursor: pointer;
}

.button-primary {
  background: #111;
  color: #fff;
}

.button-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
}

.preview-item {
  position: relative;
}

.preview-strip img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 0;
  background: #efefef;
}

.preview-remove {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 32px;
  border: 0;
  background: rgba(17, 17, 17, 0.88);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

@media (max-width: 520px) {
  .page-shell {
    padding-top: 10px;
  }

  .site-header {
    padding-top: 6px;
  }

  .site-title {
    font-size: 22px;
  }

  .post-row {
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--line);
  }

  .post-copy {
    padding: 12px;
    background: #fff;
  }

  .floating-add {
    right: 0;
    bottom: 0;
  }

  .modal-card,
  .login-card {
    width: 100%;
    min-height: auto;
  }
}
