/* ---------------------------------------------------------------
   I'm AT - Swarm チェックイン共有
   琥珀とインクの配色。履歴はカードではなく、時刻レールつきのログ。
----------------------------------------------------------------*/

:root {
  color-scheme: light;

  --bg:          #FAF6F0;
  --surface:     #FFFFFF;
  --ink:         #1C1814;
  --ink-soft:    #4A423A;
  --muted:       #7C7166;
  --line:        #E7DED1;
  --line-strong: #D6C9B6;
  --accent:      #D9480F;
  --accent-ink:  #FFFFFF;
  --accent-soft: #FDEEE4;

  --w-page: 34rem;
  --rail:   3.5rem;

  --font-display: "Bricolage Grotesque", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN",
               "Yu Gothic UI", "Noto Sans JP", "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg:          #15120E;
    --surface:     #1E1A15;
    --ink:         #F3EDE4;
    --ink-soft:    #D4CABC;
    --muted:       #A2978A;
    --line:        #2E2820;
    --line-strong: #40382D;
    --accent:      #FF7A3D;
    --accent-ink:  #1A1008;
    --accent-soft: #2A1B11;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #15120E;
  --surface:     #1E1A15;
  --ink:         #F3EDE4;
  --ink-soft:    #D4CABC;
  --muted:       #A2978A;
  --line:        #2E2820;
  --line-strong: #40382D;
  --accent:      #FF7A3D;
  --accent-ink:  #1A1008;
  --accent-soft: #2A1B11;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}

img { max-width: 100%; }
[hidden] { display: none !important; }

:where(button, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* --- トップバー ------------------------------------------------ */

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: 16px;
  padding-block: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -.02em;
  line-height: 1;
}
.wordmark::after {
  content: "";
  display: inline-block;
  width: .4em;
  height: .4em;
  margin-left: .28em;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: .06em;
}

.topbar__actions { display: flex; gap: 4px; }

.iconbtn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.iconbtn:hover { background: var(--accent-soft); color: var(--accent); }
.iconbtn svg {
  width: 20px; height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.iconbtn.is-spinning svg { animation: spin .8s linear infinite; }

/* --- 共通レイアウト -------------------------------------------- */

#main {
  max-width: var(--w-page);
  margin-inline: auto;
  padding-inline: 16px;
  padding-block: 0 calc(32px + env(safe-area-inset-bottom, 0px));
}

/* --- 未接続 ---------------------------------------------------- */

.connect {
  padding-block: clamp(3rem, 16vh, 6rem) 2rem;
  text-align: center;
}
.connect__lead {
  margin: 0 0 2rem;
  color: var(--ink-soft);
  font-size: 1rem;
  text-wrap: balance;
}
.connect__note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: .8125rem;
  min-height: 1.4em;
}

/* --- ボタン ---------------------------------------------------- */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  min-height: 40px;
  padding: 0 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  /* <a> でも使うので、リンクの下線と既定色を打ち消しておく */
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .5; cursor: default; }

.btn--primary {
  border-color: transparent;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn--primary:hover { border-color: transparent; filter: brightness(1.06); }

.btn--wide { width: 100%; max-width: 20rem; min-height: 48px; font-size: 1rem; }

.btn--icon { width: 40px; min-height: 40px; padding: 0; }

.btn svg { width: 17px; height: 17px; flex: none; }

/* --- 状態表示 -------------------------------------------------- */

.state {
  padding-block: 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
}
.state__text { margin: 0; color: var(--muted); font-size: .9375rem; }

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- ログ本体 -------------------------------------------------- */

.log {
  list-style: none;
  margin: 0;
  padding: 0;
}

.daymark {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 60px);
  z-index: 5;
  margin: 0;
  padding: 1.5rem 0 .5rem;
  background: var(--bg);
  font-family: var(--font-display);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--muted);
}
.log > li:first-child .daymark { padding-top: 1.25rem; }

.entry {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  gap: 0 .75rem;
  padding-block: 1rem;
  border-top: 1px solid var(--line);
}

.entry__time {
  grid-column: 1;
  padding-top: .1rem;
  color: var(--muted);
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.entry__body { grid-column: 2; min-width: 0; }

.entry__venue {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -.005em;
  overflow-wrap: anywhere;
}

.entry__place {
  margin: .15rem 0 0;
  color: var(--muted);
  font-size: .875rem;
  overflow-wrap: anywhere;
}

/* コメント欄。空のうちは静かに、入っていると共有に乗る合図として色が付く */
.entry__comment {
  display: block;
  width: 100%;
  margin: .6rem 0 0;
  padding: .45rem .7rem;
  border: 1px solid var(--line);
  border-left-width: 2px;
  border-left-color: var(--line-strong);
  border-radius: 0 8px 8px 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  /* 16px 未満だとフォーカス時に拡大する端末があるので下げない */
  font-size: 1rem;
  line-height: 1.5;
  transition: border-color .15s, background .15s, color .15s;
}

.entry__comment::placeholder {
  color: var(--muted);
  opacity: .75;
}

.entry__comment:hover { border-color: var(--line-strong); }

.entry__comment.is-filled {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.entry__comment:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
  color: var(--ink);
}

.chip {
  display: inline-block;
  margin-left: .45em;
  padding: .05em .45em;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: .6875rem;
  font-weight: 600;
  letter-spacing: .04em;
  vertical-align: .15em;
  white-space: nowrap;
}

.entry__actions {
  display: flex;
  gap: .5rem;
  margin-top: .7rem;
}

.log__end {
  margin: 2rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .8125rem;
  text-align: center;
}

/* --- トースト -------------------------------------------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: .6rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
  animation: rise .2s ease-out;
}
@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* せまい画面（Z Fold の折りたたみ時など）では時刻レールを詰める */
@media (max-width: 22rem) {
  :root { --rail: 2.9rem; }
  .entry { gap: 0 .55rem; }
}
