/* Tales: builds on the trip site's stylesheet (/base.css) for colors, cards, stats and splits. */
main.wide { max-width: 1200px; }
a { color: var(--accent); }

.preview { background: #f59e0b; color: #1d2a2f; text-align: center; font-size: .9rem; padding: 6px 12px; }
.preview a { color: inherit; font-weight: 600; }

header.site { max-width: 1000px; margin: 0 auto; padding: 18px 16px 6px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 24px; }
header.site .brand { text-decoration: none; color: var(--text); display: block; }
header.site .brand span { display: block; font-size: 1.6rem; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
header.site .brand small { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
header.site nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
header.site nav a { color: var(--text); text-decoration: none; font-weight: 500; padding-bottom: 2px; border-bottom: 2px solid transparent; }
header.site nav a[aria-current] { border-color: var(--accent); }
footer.site { max-width: 1000px; margin: 24px auto 0; padding: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; display: flex; gap: 16px; }
footer.site a { color: var(--muted); }

h1 { font-size: 1.7rem; }
.sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }
.card .sechead { margin-top: 0; }
.sechead h2 { margin: 0; font-size: 1.2rem; }
.sechead a { font-size: .9rem; }

/* Home hero */
.hero { position: relative; border-radius: 14px; overflow: hidden; background: var(--card); border: 1px solid var(--line); margin-bottom: 8px; min-height: 160px; }
.hero img { display: block; width: 100%; height: clamp(220px, 42vw, 420px); object-fit: cover; }
.hero .herotext { padding: 18px 20px; }
.hero img + .herotext { position: absolute; left: 0; right: 0; bottom: 0; color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); padding-top: 60px; }
.hero h1 { margin: 0 0 4px; font-size: clamp(1.4rem, 4vw, 2.2rem); }
.hero p { margin: 0; max-width: 640px; }

/* Trip cards */
.tcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--text); text-decoration: none; }
.tcard:hover { border-color: var(--accent); }
.tcard img, .tcard .noimg { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.noimg { background: linear-gradient(135deg, var(--line), var(--bg)); }
.tcard > div { padding: 12px 14px; }
.tcard h3 { margin: 0 0 4px; font-size: 1.1rem; }
.tcard p { margin: 0 0 2px; }

/* Hike rows */
.hline { display: grid; grid-template-columns: 7.5em 1fr auto; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; align-items: baseline; }
.hline:first-of-type { border-top: 0; }
.hline:hover .hname { color: var(--accent); }
.hdate { color: var(--muted); font-size: .85rem; }
.hstats { color: var(--muted); font-size: .85rem; text-align: right; }
@media (max-width: 600px) { .hline { grid-template-columns: 1fr auto; } .hdate { grid-column: 1 / -1; } }

/* Post and gear cards */
.pcard { display: flex; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 12px; }
.pcard img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; flex: none; }
.pcard h3 { margin: 0 0 2px; font-size: 1.05rem; }
.pcard h3 a { color: var(--text); text-decoration: none; }
.pcard p { margin: 2px 0; }
@media (max-width: 500px) { .pcard img { width: 84px; height: 64px; } }
.gcard { display: flex; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); color: var(--text); text-decoration: none; }
.gcard:first-of-type { border-top: 0; }
.gcard img, .gcard .noimg { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; flex: none; }
.gcard h3 { margin: 0; font-size: 1rem; }
.gcard p { margin: 0; }
.stars { color: #f59e0b; letter-spacing: 1px; }

/* Trip page */
.triphead { margin-bottom: 12px; }
.triphead h1 { margin-bottom: 2px; }
.triphead .stats { margin-top: 10px; }
.tday h3 { margin: 0 0 8px; font-size: 1.05rem; }
.tday .dnum { color: var(--accent); margin-right: 4px; }
.tday .grid { margin-top: 10px; }
.dpost h4 { margin: 8px 0 2px; font-size: 1rem; }
.dpost p { margin: 0; color: var(--muted); }
.plans { margin: 0 0 6px; padding-left: 1.2rem; color: var(--muted); font-size: .9rem; }
.plist { margin: 0; padding-left: 1.2rem; }
.plist li { margin: 4px 0; }

/* Posts */
.post { max-width: 760px; margin: 0 auto; }
.post h1 { margin-top: 4px; }
.post .body { font-size: 1.05rem; line-height: 1.65; }
.post .body p { margin: 0 0 14px; }
.body h2, .body h3 { margin: 22px 0 8px; }
figure.media { margin: 16px 0; }
figure.media img, figure.media video { display: block; width: 100%; height: auto; border-radius: 10px; cursor: zoom-in; background: var(--line); }
figure.media video { cursor: auto; }
figure.media figcaption { color: var(--muted); font-size: .88rem; margin-top: 6px; text-align: center; }
.gallery { margin: 16px 0; }
.grid video { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; background: #000; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 24px 0; }
.tags .tag { text-decoration: none; }
.tag.draft { background: #f59e0b; color: #1d2a2f; vertical-align: middle; font-size: .7rem; }
.filters { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.filters a[aria-current] { font-weight: 700; text-decoration: none; color: var(--text); }

.tmap { border-radius: 8px; isolation: isolate; }

/* Embedded YouTube videos and AllTrails maps from the old posts */
.embed { margin: 16px 0; }
.embed iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; background: var(--line); }
.embed.alltrails iframe { aspect-ratio: 4 / 3; max-height: 560px; }
.body table { border-collapse: collapse; width: 100%; margin: 16px 0; font-size: .95rem; display: block; overflow-x: auto; }
.body th, .body td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.body th { background: var(--card); }

/* Traveling banner on the home page */
.traveling { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; background: var(--card); border: 2px solid var(--accent); border-radius: 12px; padding: 12px 16px; margin-bottom: 14px; }
.traveling > div { flex: 1 1 260px; }
.traveling .btn { white-space: nowrap; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 0 rgba(22, 163, 74, .6); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); } 100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- followers and comments ---------- */
header.site nav a.follow { color: var(--accent); font-weight: 700; }
header.site nav a.who { color: var(--muted); }
.card.narrow { max-width: 520px; margin: 12px auto; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.ok { color: var(--accent); font-weight: 600; }
fieldset.afield { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.radio { display: flex; gap: 10px; align-items: flex-start; margin: 6px 0; }
.radio input { width: auto; margin: 4px 0 0; }
.danger-btn { background: var(--err); }
.comments { max-width: 760px; margin: 20px auto; }
.comment { border-top: 1px solid var(--line); padding: 10px 0 4px; }
.comment.reply { border-top: 0; margin-left: 18px; padding-left: 12px; border-left: 2px solid var(--line); }
.cmeta { margin: 0 0 4px; }
.cbody p { margin: 0 0 8px; }
.creply summary { color: var(--muted); font-size: .85rem; cursor: pointer; }
.cform textarea { margin-top: 8px; }
.cform button { width: auto; }
.qrow { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; border-top: 1px solid var(--line); padding: 10px 0; }
.qrow:first-of-type { border-top: 0; }
.qrow blockquote { margin: 6px 0 0; padding-left: 10px; border-left: 3px solid var(--line); white-space: pre-wrap; }
form.inline { display: inline; }
form.inline button { width: auto; margin: 0; }

/* ---------- admin ---------- */
.preview.live { background: var(--card); color: var(--muted); border-bottom: 1px solid var(--line); }
.anav { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 4px 0 8px; font-size: .95rem; }
.anav a { text-decoration: none; color: var(--muted); }
.anav a[aria-current] { color: var(--text); font-weight: 600; }
.btn, button.ghost, .btnlike { display: inline-block; width: auto; padding: 8px 14px; border-radius: 8px; text-decoration: none; font-weight: 600; }
.btn { background: var(--accent); color: var(--bg); }
.btn.ghost, button.ghost, .btnlike { background: none; color: var(--accent); border: 1px solid var(--accent); }
.btnlike { cursor: pointer; margin: 0; }
.tag.pub { background: none; color: var(--accent); border: 1px solid var(--accent); }
.atable { border-collapse: collapse; width: 100%; font-size: .92rem; }
.atable th, .atable td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: middle; }
.atable th { color: var(--muted); font-weight: 600; }
.atable input[type=checkbox] { width: auto; margin: 0; }
.atable select.rate { width: auto; margin: 0; padding: 4px 6px; color: #f59e0b; }
.afilter, .bulkbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 12px; }
.afilter > *, .bulkbar > * { width: auto; margin: 0; }
.afilter input[name=q] { flex: 1 1 160px; }
.bulkbar label { display: flex; gap: 6px; align-items: center; }
.bulkbar input { width: auto; margin: 0; }
@media (max-width: 700px) { .atable th:nth-child(4), .atable td:nth-child(4) { display: none; } }

.aform { max-width: 1100px; }
.afield { display: block; margin-bottom: 12px; }
.afield > span, .afield > summary { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; cursor: default; }
.afield > summary { cursor: pointer; }
.afield small { display: block; margin-top: -4px; }
.arow { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px 14px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.checks input { width: auto; margin: 0; }
.checks fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; margin: 0 0 8px; }
.checks legend { color: var(--muted); font-size: .85rem; }
.cover { display: flex; gap: 10px; align-items: center; }
.cover > * { margin: 0; }
.cover input { width: 15em; }
.coverimg { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }
.savebar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--line); z-index: 5; }
.savebar button { width: auto; margin: 0; }
button.danger { color: var(--err); margin-left: auto; }

.mded { border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.mded.drop { outline: 3px dashed var(--accent); }
.mdbar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 4; border-radius: 10px 10px 0 0; }
.mdbar button, .mdbar .btnlike { width: auto; margin: 0; padding: 6px 10px; font-size: .88rem; background: none; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.mdbar button.on { background: var(--accent); color: var(--bg); }
.mdbar .pvtoggle { margin-left: auto; }
.mdpanes { display: grid; }
.mded.split .mdpanes { grid-template-columns: 1fr 1fr; }
.mdpanes textarea { border: 0; border-radius: 0; margin: 0; min-height: 260px; font-family: ui-monospace, Consolas, monospace; font-size: .92rem; line-height: 1.5; resize: vertical; background: var(--card); }
.mdpreview { padding: 4px 14px; border-left: 1px solid var(--line); overflow: auto; max-height: 75vh; line-height: 1.6; }
.mdstatus { padding: 4px 8px; font-size: .8rem; border-top: 1px solid var(--line); }
@media (max-width: 800px) { .mded.split .mdpanes { grid-template-columns: 1fr; } .mdpreview { border-left: 0; border-top: 1px solid var(--line); } }

.picker { width: min(960px, 96vw); max-height: 90vh; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); color: var(--text); padding: 0; }
.picker::backdrop { background: rgba(0, 0, 0, .55); }
.pickhead { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; padding: 10px 12px; background: var(--card); border-bottom: 1px solid var(--line); z-index: 1; }
.pickhead button { width: auto; margin: 0; }
.pickhead .pcount { margin-right: auto; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; padding: 10px 12px; }
.pday { grid-column: 1 / -1; color: var(--muted); font-size: .85rem; margin-top: 6px; }
.pimg { position: relative; padding: 0; margin: 0; background: none; border: 3px solid transparent; border-radius: 8px; overflow: hidden; }
.pimg img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.pimg.on { border-color: var(--accent); }
.pimg span { position: absolute; inset: auto 4px 4px auto; color: #fff; text-shadow: 0 0 4px #000; }
.pchoose { position: relative; display: block; margin: 0; cursor: pointer; }
.pchoose img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; opacity: .3; }
.pchoose input { position: absolute; top: 6px; left: 6px; width: 18px; height: 18px; margin: 0; }
.pchoose input:checked + img { opacity: 1; }
.pchoose span { position: absolute; inset: auto 6px 6px auto; color: #fff; text-shadow: 0 0 4px #000; }
.pmore { margin: 0 12px 12px; width: calc(100% - 24px); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--bg); padding: 8px 18px; border-radius: 20px; font-weight: 600; z-index: 20; }
