/* ============================================================
   Temp Clipboard — styles
   Aesthetic preset: 11 Build (airy minimal, soft shadows,
   one accent color used sparingly). Light + dark themes.
   ============================================================ */

:root {
  --bg: #F6F6F3;
  --bg-soft: #EFEFEA;
  --surface: #FFFFFF;
  --surface-2: #FBFBF8;
  --ink: #191917;
  --ink-2: #55554F;
  --muted: #8B8B84;
  --line: #E7E7E0;
  --line-strong: #D8D8D0;
  --accent: #0E7A58;
  --accent-2: #0B6248;
  --accent-soft: #E7F3EE;
  --danger: #B4342A;
  --danger-soft: #F7E9E7;
  --shadow-1: 0 1px 2px rgba(25, 25, 23, .04), 0 10px 30px rgba(25, 25, 23, .06);
  --shadow-2: 0 2px 6px rgba(25, 25, 23, .05), 0 20px 50px rgba(25, 25, 23, .10);
  --r-lg: 18px;
  --r-md: 13px;
  --r-sm: 9px;
  --font: 'Noto Sans Thai', 'Noto Sans Lao', system-ui, -apple-system, 'Segoe UI', 'Leelawadee UI', Tahoma, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0F100F;
  --bg-soft: #161715;
  --surface: #1A1B19;
  --surface-2: #202120;
  --ink: #F0F0EC;
  --ink-2: #C2C2BA;
  --muted: #83837C;
  --line: #272824;
  --line-strong: #373833;
  --accent: #3DC99A;
  --accent-2: #63DCB4;
  --accent-soft: #132821;
  --danger: #E36B60;
  --danger-soft: #2A1B19;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .4), 0 20px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.wrap { max-width: 820px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar-in { display: flex; align-items: center; justify-content: space-between; height: 64px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); position: relative; flex: none; }
.brand-mark::after { content: ""; position: absolute; right: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.18; min-width: 0; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.langs { display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang { border: 0; background: transparent; color: var(--ink-2); font-size: 12.5px; padding: 5px 11px; border-radius: 999px; cursor: pointer; }
.lang:hover { color: var(--ink); }
.lang.active { background: var(--ink); color: var(--bg); font-weight: 600; }
.icon-btn { width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-2); flex: none; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-strong); }
.i-moon { display: none; }
html[data-theme="dark"] .i-sun { display: none; }
html[data-theme="dark"] .i-moon { display: inline-flex; }

@media (max-width: 480px) {
  .wrap { padding: 0 14px; }
  .brand-name { font-size: 14px; }
  .brand-sub { font-size: 10.5px; }
  .topbar-in { gap: 8px; height: 58px; }
  .top-actions { gap: 7px; }
  .langs { padding: 2px; }
  .lang { font-size: 11.5px; padding: 4.5px 8.5px; }
  .icon-btn { width: 34px; height: 34px; }
}

/* ---------- hero ---------- */
.hero { padding: 44px 0 22px; }
.hero h1 { margin: 0; font-size: clamp(24px, 4.4vw, 34px); line-height: 1.3; font-weight: 500; letter-spacing: -.015em; }
.lede { margin: 10px 0 0; color: var(--ink-2); font-size: 15px; max-width: 58ch; }
@media (max-width: 640px) { .hero { padding: 30px 0 16px; } }

/* ---------- composer ---------- */
.composer {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); padding: 16px;
  transition: border-color .18s, box-shadow .18s;
  margin-top: 28px;
}
.composer:focus-within { border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.composer.drag { border-color: var(--accent); background: var(--accent-soft); box-shadow: var(--shadow-2); }
.composer textarea {
  display: block; width: 100%; border: 0; outline: 0; background: transparent;
  color: var(--ink); font: inherit; min-height: 64px; max-height: 320px; resize: none; line-height: 1.6;
}
.composer textarea::placeholder { color: var(--muted); }
.attach { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 0 2px; }
.attach-item { position: relative; width: 72px; height: 72px; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--line); }
.attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-item .rm {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 999px;
  border: 0; background: rgba(17, 17, 17, .72); color: #fff; font-size: 13px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.composer-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 12px; }
.composer-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.composer-main { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.hint { color: var(--muted); font-size: 12.5px; }
@media (max-width: 640px) { .hint { display: none; } }
.temp-note { margin: 10px 2px 0; font-size: 12.5px; color: var(--accent-2); background: var(--accent-soft); border-radius: var(--r-sm); padding: 8px 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-soft); color: var(--ink); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--bg); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--surface-2)); }
.btn.sm { padding: 7px 11px; font-size: 12.5px; border-radius: 9px; }
.btn.copy { background: var(--accent-soft); border-color: transparent; color: var(--accent-2); font-weight: 600; }
.btn.copy:hover { filter: brightness(.97); }
.btn.del { margin-left: auto; border-color: transparent; background: transparent; color: var(--muted); font-weight: 400; }
.btn.del:hover { color: var(--danger); background: var(--danger-soft); }
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn.sm { min-height: 40px; }
  .lang { min-height: 34px; padding: 6px 12px; }
  .icon-btn { width: 42px; height: 42px; }
}

/* ---------- feed ---------- */
.feed-head { display: flex; align-items: baseline; gap: 12px; margin: 30px 0 12px; }
.feed-head h2 { font-size: 12.5px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 0; }
.stats { color: var(--muted); font-size: 12.5px; }
.clear-all { margin-left: auto; border: 0; background: transparent; color: var(--muted); font-size: 12.5px; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.clear-all:hover { color: var(--danger); background: var(--danger-soft); }
.clear-all.armed { color: var(--danger); background: var(--danger-soft); font-weight: 600; }
.feed { display: flex; flex-direction: column; gap: 14px; padding-bottom: 8px; }

.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 18px 20px 14px; }
.post-time { font-size: 12px; color: var(--muted); display: block; margin-bottom: 8px; }
.post-text { white-space: pre-wrap; word-break: break-word; font-size: 15.5px; line-height: 1.65; margin: 0 0 10px; }
.post-imgs { display: grid; gap: 8px; margin: 2px 0 10px; }
.post-imgs.count-1 { grid-template-columns: 1fr; }
.post-imgs.count-2, .post-imgs.count-3, .post-imgs.count-4 { grid-template-columns: 1fr 1fr; }
.post-imgs a { display: block; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); }
.post-imgs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-imgs.count-1 a { max-height: 420px; }
.post-imgs.count-1 img { max-height: 420px; }
.post-imgs.count-2 img, .post-imgs.count-3 img, .post-imgs.count-4 img { height: 168px; }
@media (max-width: 480px) {
  .post-imgs.count-2 img, .post-imgs.count-3 img, .post-imgs.count-4 img { height: 128px; }
}
.post-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- empty state ---------- */
.empty { padding: 54px 16px 60px; text-align: center; color: var(--muted); }
.empty-mark { color: var(--line-strong); margin-bottom: 14px; }
.empty-title { color: var(--ink-2); font-size: 16px; font-weight: 500; margin: 0 0 6px; }
.empty-hint { font-size: 13.5px; margin: 0; }

/* ---------- footer ---------- */
.foot { margin: 48px auto 0; padding-top: 18px; padding-bottom: 44px; border-top: 1px solid var(--line); }
.foot-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.field select {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 6px 10px; font: inherit; font-size: 13px; cursor: pointer;
}
.field.check { cursor: pointer; }
.field.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.foot-note { margin: 14px 0 0; font-size: 12.5px; color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px;
  box-shadow: var(--shadow-2); display: flex; align-items: center; gap: 14px;
  font-size: 14px; max-width: min(92vw, 560px);
  opacity: 0; pointer-events: none; z-index: 50;
  transition: opacity .2s ease, transform .2s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast-action { border: 0; background: transparent; color: #7EE0BB; font-weight: 700; font-size: 14px; cursor: pointer; padding: 2px 4px; flex: none; }

/* ---------- a11y ---------- */
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
