:root {
  color-scheme: light dark;
  --bg: #f4f2ed;
  --surface: #fff;
  --text: #121212;
  --muted: #736f68;
  --line: rgba(18,18,18,.12);
  --accent: #ff4d00;
  --danger: #b42318;
  --max: 760px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
img { display: block; max-width: 100%; }

.page-shell { min-height: 100vh; }
.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 12px max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(18px);
}
.wordmark { text-decoration: none; font-size: 15px; font-weight: 700; letter-spacing: .13em; }
.wordmark span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; letter-spacing: 0; }
.site-header nav { display: flex; align-items: center; gap: 7px; }
.site-header nav a { padding: 10px 11px; border-radius: 999px; color: var(--muted); font-size: 13px; text-decoration: none; }
.site-header nav a[aria-current="page"] { background: var(--text); color: var(--surface); }

.stream-feed, .single-post { width: min(100%, var(--max)); margin: 0 auto; }
.stream-post { margin: 18px 0 34px; overflow: hidden; background: var(--surface); }
.photo-wrap { position: relative; display: block; background: #151515; text-decoration: none; }
.photo-wrap img { width: 100%; height: auto; max-height: min(78vh, 900px); object-fit: contain; margin: auto; }
.photo-location {
  position: absolute;
  bottom: 13px;
  left: 14px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 999px;
  color: white;
  background: rgba(0,0,0,.36);
  backdrop-filter: blur(10px);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.post-details { padding: 9px 16px 17px; }
.post-actions { display: flex; align-items: center; gap: 2px; }
.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}
.icon-action:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }
.icon-action svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.like-button.is-liked { color: var(--accent); }
.like-button.is-liked svg { fill: currentColor; }
.caption { margin: 2px 2px 8px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; }
.post-meta { margin: 0 2px; color: var(--muted); font-size: 11px; line-height: 1.5; text-transform: uppercase; letter-spacing: .05em; }
.post-meta span { padding: 0 3px; }
.feed-sentinel { display: grid; place-items: center; height: 90px; }
.feed-sentinel span { width: 24px; height: 24px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.feed-sentinel.is-finished { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .feed-sentinel span { animation: none; } }

.empty-state { width: min(100% - 36px, 660px); margin: 14vh auto; text-align: center; }
.empty-state h1 { margin: 7px 0 12px; font-size: clamp(36px, 8vw, 70px); line-height: .98; letter-spacing: -.045em; }
.empty-state > p:last-child { color: var(--muted); font-size: 16px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
footer { padding: 40px 18px 70px; color: var(--muted); font-size: 12px; text-align: center; }
footer span { padding: 0 6px; }
footer a { text-underline-offset: 3px; }
.single-post { padding-top: 22px; }
.single-page .stream-post { margin-top: 0; }
.toast {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 36px);
  padding: 11px 15px;
  border-radius: 999px;
  color: var(--surface);
  background: var(--text);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Admin */
.admin-page { background: #efede7; color: #151515; }
.admin-shell { width: min(100% - 34px, 1160px); margin: 0 auto; padding: 36px 0 70px; }
.admin-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.admin-header h1 { margin: 0; font-size: clamp(34px, 6vw, 64px); line-height: 1; letter-spacing: -.05em; }
.admin-header-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.admin-header-actions form { margin: 0; }
.admin-header-actions a, .admin-header-actions button { border: 0; color: #5f5b54; background: transparent; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 10px; }
.stats-grid > div { padding: 18px; border: 1px solid rgba(18,18,18,.1); border-radius: 18px; background: #fff; }
.stats-grid span { display: block; color: #746f67; font-size: 12px; }
.stats-grid strong { display: block; margin-top: 8px; font-size: 32px; font-weight: 500; }
.admin-grid { display: grid; grid-template-columns: minmax(320px, .78fr) minmax(0, 1.22fr); gap: 10px; align-items: start; }
.admin-card { border: 1px solid rgba(18,18,18,.1); border-radius: 22px; background: #fff; box-shadow: 0 16px 48px rgba(20,18,15,.06); }
.upload-card { position: sticky; top: 12px; padding: 24px; }
.admin-card h2 { margin: 3px 0 22px; font-size: 28px; letter-spacing: -.035em; }
.admin-card label { display: grid; gap: 7px; margin: 0 0 16px; color: #48443e; font-size: 12px; font-weight: 600; }
.admin-card label > span { color: #8a857d; font-weight: 400; }
.admin-card input[type="text"], .admin-card input[type="password"], .admin-card input[type="date"], .admin-card textarea {
  width: 100%; min-height: 46px; padding: 11px 12px; border: 1px solid rgba(18,18,18,.16); border-radius: 11px; color: #151515; background: #fff; font-size: 16px; resize: vertical;
}
.admin-card input:focus, .admin-card textarea:focus { outline: 2px solid #ff4d00; outline-offset: 2px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.file-drop { min-height: 120px; place-items: center; align-content: center; padding: 18px; border: 1px dashed rgba(18,18,18,.28); border-radius: 14px; text-align: center; cursor: pointer; }
.file-drop input { width: 100%; }
.file-drop span { color: #151515 !important; font-size: 15px; font-weight: 600 !important; }
.file-drop small { color: #7a756d; font-weight: 400; }
.primary-button, a.primary-button {
  display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 48px; padding: 12px 16px; border: 0; border-radius: 12px; color: #fff; background: #151515; font-weight: 600; text-decoration: none; cursor: pointer;
}
.primary-button:hover { background: #ff4d00; }
.form-note { margin: 13px 0 0; color: #7a756d; font-size: 11px; line-height: 1.5; }
.library { padding: 24px; }
.library-head { display: flex; justify-content: space-between; }
.admin-posts { display: grid; gap: 8px; }
.admin-post { display: grid; grid-template-columns: 86px minmax(0,1fr) auto; gap: 13px; align-items: center; padding: 8px; border-radius: 13px; background: #f4f2ed; }
.admin-post img { width: 86px; height: 86px; border-radius: 9px; object-fit: cover; }
.admin-post-copy { min-width: 0; }
.admin-post-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.admin-post-copy > span { display: block; margin-top: 5px; color: #777169; font-size: 11px; }
.post-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 11px; color: #56514a; font-size: 11px; }
.admin-post details { position: relative; }
.admin-post summary { padding: 12px 8px; color: #777169; font-size: 11px; cursor: pointer; list-style: none; }
.admin-post details form { position: absolute; z-index: 3; right: 0; top: 36px; width: 150px; padding: 8px; border: 1px solid rgba(18,18,18,.12); border-radius: 11px; background: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.15); }
.danger-button { width: 100%; padding: 9px; border: 0; border-radius: 8px; color: #fff; background: var(--danger); cursor: pointer; }
.admin-empty { color: #777169; }
.login-shell { display: grid; min-height: 100vh; place-items: center; padding: 20px; }
.login-card { width: min(100%, 400px); padding: 28px; }
.login-card h1 { margin: 4px 0 22px; font-size: 34px; letter-spacing: -.04em; }
.quiet-link { display: block; margin-top: 18px; color: #716c65; font-size: 12px; text-align: center; }
.form-error { padding: 10px 12px; border-radius: 9px; color: #8d1c13; background: #fff0ee; font-size: 13px; }

@media (max-width: 780px) {
  .stream-post { margin-top: 0; border-bottom: 1px solid var(--line); }
  .site-header { min-height: 70px; }
  .wordmark { font-size: 13px; }
  .wordmark span { display: none; }
  .admin-header { align-items: flex-start; flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .upload-card { position: static; }
}

@media (max-width: 480px) {
  .site-header nav a { padding: 9px; font-size: 12px; }
  .post-details { padding-inline: 13px; }
  .admin-shell { width: min(100% - 22px, 1160px); padding-top: 22px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .admin-post { grid-template-columns: 68px minmax(0,1fr) auto; }
  .admin-post img { width: 68px; height: 68px; }
}

@media (prefers-color-scheme: dark) {
  :root { --bg: #080808; --surface: #111; --text: #f3f1ec; --muted: #aaa59d; --line: rgba(255,255,255,.1); }
}
