/* ===== Elio's Corner — web 1.0 vibes, mobile-first ===== */

:root {
  --bg: #f6f0ff;
  --bg2: #ffffff;
  --ink: #2a1a4a;
  --muted: #6b5b8a;
  --accent: #e8590c;
  --accent2: #a85a00;
  --border: #e6b877;
  --card-shadow: 4px 4px 0 #f2cd92;
  --tag: #fff3cf;
}

html[data-theme="dark"] {
  --bg: #160d24;
  --bg2: #21163a;
  --ink: #efe6ff;
  --muted: #b59be0;
  --accent: #ff7a28;
  --accent2: #ffcf6e;
  --border: #6a3fb0;
  --card-shadow: 4px 4px 0 #3a2360;
  --tag: #4a3b12;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", system-ui, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

/* sunrise sky (light) */
html[data-theme="light"] body, body {
  background-color: #fff4e0;
  background-image:
    radial-gradient(820px 460px at 50% -12%, rgba(255,196,92,0.85), rgba(255,158,66,0.22) 42%, transparent 66%),
    linear-gradient(180deg, #fff7ea 0%, #ffeede 38%, #f1ebff 100%);
}

/* deep space + sun (dark) */
html[data-theme="dark"] body {
  background-color: #0b0717;
  background-image:
    radial-gradient(900px 520px at 50% -14%, rgba(255,176,59,0.30), rgba(255,110,40,0.10) 38%, transparent 64%),
    radial-gradient(2px 2px at 12% 22%, rgba(255,255,255,.9), transparent),
    radial-gradient(1.6px 1.6px at 28% 64%, rgba(255,255,255,.65), transparent),
    radial-gradient(1.6px 1.6px at 47% 34%, rgba(255,255,255,.8), transparent),
    radial-gradient(2px 2px at 68% 72%, rgba(255,255,255,.7), transparent),
    radial-gradient(1.4px 1.4px at 82% 28%, rgba(255,255,255,.75), transparent),
    radial-gradient(1.6px 1.6px at 90% 58%, rgba(255,255,255,.6), transparent),
    radial-gradient(1.4px 1.4px at 60% 12%, rgba(255,255,255,.7), transparent),
    linear-gradient(180deg, #0b0717 0%, #160d24 55%, #1c1132 100%);
}

.page { max-width: 760px; margin: 0 auto; padding: 0 12px 40px; }

a { color: var(--accent2); transition: color .12s ease; }
a:hover { color: var(--accent); }

/* consistent keyboard-focus ring for every interactive element */
a:focus-visible, button:focus-visible, .btn:focus-visible, .linkish:focus-visible,
.toggle:focus-visible, .gnav:focus-visible, .dl-btn:focus-visible,
input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----- masthead ----- */
.masthead { padding: 14px 0 6px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.logo {
  font-size: 1.5rem; font-weight: bold; text-decoration: none;
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--bg2);
}
.bar-right { display: flex; align-items: center; gap: 10px; }
.who { font-size: .8rem; color: var(--muted); }
.tagline {
  display: block; margin-top: 6px; color: var(--accent2);
  font-style: italic; font-size: .95rem;
}

.toggle {
  background: var(--bg2); border: 2px solid var(--border);
  border-radius: 50%; width: 36px; height: 36px; font-size: 1rem;
  cursor: pointer; line-height: 1;
  transition: border-color .12s ease, transform .08s ease;
}
.toggle:hover { border-color: var(--accent); transform: translateY(-1px); }

/* ----- cards ----- */
.card {
  background: var(--bg2);
  border: 2px solid var(--border);
  box-shadow: var(--card-shadow);
  border-radius: 8px;
  padding: 14px;
  margin: 16px 0;
}

.flash { list-style: none; padding: 0; margin: 12px 0; }
.flash li {
  background: var(--tag); border: 2px dashed var(--accent);
  padding: 8px 12px; border-radius: 6px; margin-bottom: 6px;
}

/* ----- forms ----- */
label { display: block; margin: 10px 0; font-weight: bold; font-size: .9rem; }
input[type=text], input[type=password], textarea, input[type=file] {
  display: block; width: 100%; margin-top: 4px;
  padding: 10px; font-size: 16px; /* 16px avoids mobile zoom */
  border: 2px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--ink);
  font-family: inherit;
}
textarea { resize: vertical; }

.btn, button.btn {
  display: inline-block; cursor: pointer;
  background: var(--accent); color: #fff;
  border: 2px solid var(--ink); border-radius: 8px;
  padding: 10px 16px; font-size: 1rem; font-weight: bold;
  text-decoration: none; box-shadow: 3px 3px 0 var(--ink);
  font-family: inherit;
  transition: transform .08s ease, box-shadow .08s ease, background-color .12s ease;
}
.btn:hover { color: #fff; background: var(--accent2); transform: translate(1px, 1px); box-shadow: 2px 2px 0 var(--ink); }
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }

.linkish {
  background: none; border: none; color: var(--accent2);
  cursor: pointer; font: inherit; padding: 0; text-decoration: underline;
  transition: color .12s ease;
}
.linkish:hover { color: var(--accent); }
.danger-link { color: var(--accent); }
.danger-link:hover { color: var(--accent2); }
.inline { display: inline; }

/* ----- feed ----- */
.new-post-row { text-align: center; }
.feed { list-style: none; padding: 0; margin: 0; }
.post-card { padding: 0; overflow: hidden; }
.cover-link { display: block; }
.cover { position: relative; background: #000; }
.cover img { display: block; width: 100%; height: auto; max-height: 460px; object-fit: cover; }
.badge {
  position: absolute; right: 8px; bottom: 8px;
  background: rgba(0,0,0,.7); color: #fff; padding: 2px 8px;
  border-radius: 10px; font-size: .8rem;
}
.post-body { padding: 12px 14px; }
.caption { word-wrap: break-word; margin: 0 0 8px; }
.caption.big { font-size: 1.15rem; }

/* markdown-rendered text */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 8px; }
.md ul, .md ol { margin: 0 0 8px; padding-left: 1.4em; }
.md a { word-break: break-word; }
.md img { max-width: 100%; height: auto; border-radius: 4px; }
.md code {
  background: var(--bg); padding: 1px 5px; border-radius: 4px;
  font-family: "Courier New", monospace; font-size: .9em;
}
.md pre {
  background: var(--bg); padding: 10px; border-radius: 6px;
  overflow-x: auto; border: 1px solid var(--border);
}
.md pre code { background: none; padding: 0; }
.md blockquote {
  margin: 0 0 8px; padding: 2px 0 2px 12px;
  border-left: 3px solid var(--accent); color: var(--muted);
}
.meta { color: var(--muted); font-size: .85rem; margin: 4px 0; }

.post-title { margin: 0 0 8px; font-size: 1.35rem; line-height: 1.2; }
.post-title a { color: var(--accent); text-decoration: none; }
.post-title a:hover { text-decoration: underline; }
.post-detail .post-title { margin-top: 8px; }

.pager { display: flex; justify-content: space-between; margin-top: 18px; }
.pager .btn { font-size: .9rem; }

/* ----- post detail gallery ----- */
.gallery-wrap { position: relative; }
.gnav {
  position: absolute; top: 50%; transform: translateY(-50%);
  z-index: 2; width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid #fff; background: rgba(0, 0, 0, .5); color: #fff;
  font-size: 1.7rem; line-height: 1; cursor: pointer; padding: 0 0 3px;
  display: flex; align-items: center; justify-content: center;
  transition: background-color .12s ease, border-color .12s ease, transform .08s ease;
}
.gnav:hover { background: rgba(0, 0, 0, .8); border-color: var(--accent); transform: translateY(-50%) scale(1.08); }
.gnav-prev { left: 8px; }
.gnav-next { right: 8px; }
.gallery {
  display: flex; gap: 8px; overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 8px; padding-bottom: 6px;
}
.gallery.single { overflow: visible; }
.slide {
  margin: 0; flex: 0 0 100%; scroll-snap-align: center;
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: #000; border-radius: 6px; overflow: hidden;
}
.slide img, .slide video { width: 100%; height: auto; max-height: 70vh; object-fit: contain; display: block; }
.dl-btn {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(0, 0, 0, .5); border: 2px solid #fff; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; text-decoration: none; line-height: 1;
  transition: background-color .12s ease, border-color .12s ease, transform .08s ease;
}
.dl-btn:hover { background: rgba(0, 0, 0, .8); border-color: var(--accent); transform: scale(1.08); }
.swipe-hint { text-align: center; color: var(--muted); font-size: .85rem; margin: 4px 0 0; }

.admin-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.btn.small { font-size: .85rem; padding: 4px 10px; }

.backlink { margin: 12px 0 0; }
.danger { margin-top: 10px; }

/* ----- comments ----- */
.comments h2 { margin-top: 0; }
.comment-list { list-style: none; padding: 0; margin: 0 0 16px; }
.comment {
  border-bottom: 1px dashed var(--border); padding: 10px 0;
}
.comment-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.author { font-weight: bold; color: var(--accent); }
.comment-body { white-space: pre-wrap; word-wrap: break-word; margin: 4px 0 0; }
.muted { color: var(--muted); }

.comment-form { margin-top: 8px; }

/* ----- login ----- */
.login-card { max-width: 380px; margin: 40px auto; }
.empty { text-align: center; }

/* ----- footer ----- */
.footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 30px; }
.divider {
  border: 0; height: 2px; margin: 0 auto 10px; max-width: 220px;
  background: linear-gradient(90deg, transparent, #ffb13b, #ff7a28, #ffb13b, transparent);
  opacity: .75;
}

/* ----- visitor counter (web 1.0 odometer) ----- */
.counter {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; flex-wrap: wrap; margin: 14px 0 6px;
}
.counter-label { font-style: italic; }
.odometer {
  display: inline-flex; gap: 2px; padding: 4px;
  background: #111; border: 2px solid #444; border-radius: 4px;
  box-shadow: inset 0 0 6px #000;
}
.digit {
  display: inline-block; min-width: 1ch; padding: 2px 5px;
  font-family: "Courier New", monospace; font-weight: bold; font-size: 1.1rem;
  color: #39ff14; background: #000;
  text-shadow: 0 0 6px #39ff14;
  border-radius: 2px;
}

/* light mode: warm "sunlit" odometer — dark amber on cream, high contrast */
html[data-theme="light"] .odometer {
  background: #f3e3bd; border-color: #d8a85a;
  box-shadow: inset 0 0 6px rgba(168, 90, 0, .3);
}
html[data-theme="light"] .digit {
  color: #8a3b00; background: #fff6e0;
  text-shadow: none; border: 1px solid #e6c489;
}

@media (max-width: 480px) {
  .logo { font-size: 1.2rem; }
  .card { padding: 12px; }
}
