/* friendly-safe — teal + coral, serif headings. Deliberately unlike the other
   dot-files.xyz sites (amber, navy, farm green, slate, bronze). No web fonts. */

:root {
  --bg: #f2f6f4;
  --bg-glow-1: rgba(15, 139, 128, .13);
  --bg-glow-2: rgba(239, 111, 92, .12);
  --surface: #ffffff;
  --surface-2: #f6faf8;
  --ink: #14302b;
  --muted: #5d7570;
  --line: #dce7e3;
  --teal: #0f8b80;
  --teal-deep: #0b6b63;
  --teal-soft: #dff2ee;
  --coral: #ef6f5c;
  --coral-deep: #c9503f;
  --coral-soft: #fde6e1;
  --shadow: 0 1px 2px rgba(20, 48, 43, .05), 0 8px 28px rgba(20, 48, 43, .07);
  --radius: 18px;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c1615;
    --bg-glow-1: rgba(60, 199, 183, .10);
    --bg-glow-2: rgba(255, 138, 120, .08);
    --surface: #13221f;
    --surface-2: #182b28;
    --ink: #e5f1ee;
    --muted: #93aaa5;
    --line: #24403b;
    --teal: #3cc7b7;
    --teal-deep: #6ad8cb;
    --teal-soft: #173b36;
    --coral: #ff8a78;
    --coral-deep: #ff8a78;
    --coral-soft: #3a2420;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 10% -10%, var(--bg-glow-1), transparent 60%),
    radial-gradient(700px 450px at 100% 0%, var(--bg-glow-2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

.wrap { width: min(680px, 100% - 32px); margin-inline: auto; }

h1, h2 { font-family: var(--serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(2rem, 6vw, 2.8rem); }
h2 { font-size: 1.35rem; }
p { margin: 0; }
strong { font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.loading { padding: 48px 0; text-align: center; color: var(--muted); }

a { color: var(--teal-deep); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--teal) 55%, transparent); outline-offset: 2px; border-radius: 8px; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 0 8px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
  font-family: var(--serif); font-size: 1.3rem; font-weight: 600;
}
.brand em { color: var(--coral); font-style: italic; }
.logo { display: block; }

/* ------------------------------------------------------------------ cards */

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin: 16px 0;
}
.card > h2 + * { margin-top: 14px; }
.card.quiet { box-shadow: none; background: var(--surface-2); }
.card.empty { text-align: center; padding: 40px 22px; }
.card.empty p { margin: 12px 0 22px; color: var(--muted); }

.hero { padding: 28px 0 6px; }
.hero h1 em { color: var(--teal); font-style: italic; }
.lead { margin-top: 12px; font-size: 1.1rem; color: var(--muted); max-width: 34em; }

/* ----------------------------------------------------------------- forms */

.field { display: block; margin-top: 14px; }
.field .label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
.field .hint { display: block; margin-top: 6px; font-size: .82rem; color: var(--muted); }

input, select, button { font: inherit; color: inherit; }

input[type="text"], input[type="number"], select {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color .15s, background .15s;
  min-width: 0;
}
input:focus, select:focus { outline: none; border-color: var(--teal); background: var(--surface); }
input:disabled { opacity: .55; cursor: not-allowed; }
input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

.row2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 520px) { .row2 { grid-template-columns: 1fr 1fr; } }

.money { position: relative; }
.money > span {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-weight: 600; pointer-events: none;
}
.money input { padding-left: 30px; font-variant-numeric: tabular-nums; }

.duration { display: grid; grid-template-columns: 5.5em 1fr; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .08s, background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { border-color: var(--teal); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--teal) 70%, transparent); }
.btn.primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
@media (prefers-color-scheme: dark) { .btn.primary, .btn.primary:hover { color: #08201d; } }
.btn.ghost { background: transparent; }
.btn.ghost:hover { border-color: var(--coral); color: var(--coral-deep); }
.btn.block { width: 100%; margin-top: 18px; padding: 14px 18px; font-size: 1.05rem; }
.btn.small { padding: 5px 12px; font-size: .85rem; }

.link {
  border: 0; background: none; padding: 0;
  color: var(--teal-deep); text-decoration: underline; cursor: pointer; font-size: inherit;
}

.icon {
  flex: none;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 1.3rem; line-height: 1; cursor: pointer;
}
.icon:hover { background: var(--coral-soft); color: var(--coral-deep); }

/* -------------------------------------------------------------- landing */

.preview {
  margin-top: 18px; padding: 16px;
  border-radius: 14px;
  background: var(--teal-soft);
}
.preview strong { color: var(--teal-deep); }
.split {
  list-style: none; padding: 0; margin: 12px 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 8px;
}
.split li {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--surface);
}
.split .who { font-size: .8rem; color: var(--muted); }
.split .amt { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.split li.alone { opacity: .7; }

.safes { list-style: none; padding: 0; margin: 0; }
.safes li { padding: 8px 0; border-top: 1px solid var(--line); }
.safes li:first-child { border-top: 0; }
.safes a { font-weight: 600; text-decoration: none; }
.safes a:hover { text-decoration: underline; }

.open-link, .linkbox, .inline { display: flex; gap: 8px; }
.open-link input, .linkbox input, .inline input { flex: 1; }

/* ------------------------------------------------------------- safe view */

.safe-head { padding: 18px 0 4px; }
.friends { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 12px; color: var(--muted); }
.friends .me strong { color: var(--ink); }
.friends .me::before { content: "·"; margin-right: 8px; }
@media (max-width: 420px) { .friends .me { flex-basis: 100%; } .friends .me::before { content: none; } }
.avatars { display: flex; }
.avatar {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  color: #fff; font-weight: 700; font-size: .85rem;
  border: 2px solid var(--bg);
  flex: none;
}
.avatars .avatar + .avatar { margin-left: -8px; }

.callout {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  background: linear-gradient(135deg, var(--coral-soft), var(--surface) 70%);
  border-color: color-mix(in srgb, var(--coral) 35%, var(--line));
}
.callout h2 { font-size: 1.15rem; }
.callout p { margin-top: 4px; color: var(--muted); max-width: 30em; }

.join { border: 2px solid var(--teal); }
.join .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; }
.chip {
  border: 1.5px solid var(--line); background: var(--surface-2);
  border-radius: 999px; padding: 6px 12px; cursor: pointer; font-weight: 600;
}
.chip:hover { border-color: var(--teal); }

/* ------------------------------------------------------------------ goal */

.goal { overflow: hidden; }
.goal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.goal-head h2 { font-size: 1.5rem; }
.goal-head p { margin-top: 4px; font-size: .92rem; }

.headline { margin: 20px 0 16px; }
.big {
  font-family: var(--serif);
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -.02em;
  color: var(--teal-deep);
  font-variant-numeric: tabular-nums;
}
.big small { font-family: var(--sans); font-size: 1rem; font-weight: 500; letter-spacing: 0; color: var(--muted); }
.headline .muted { margin-top: 8px; }

.bar {
  display: flex;
  height: 14px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.seg { height: 100%; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.seg + .seg { box-shadow: inset 2px 0 0 var(--surface); }
.bar-legend {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 8px; font-size: .92rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bar-legend strong { color: var(--ink); }
.pace { font-weight: 600; font-size: .82rem; padding: 3px 10px; border-radius: 999px; }
.pace.ok, .pace.ahead { background: var(--teal-soft); color: var(--teal-deep); }
.pace.behind { background: var(--coral-soft); color: var(--coral-deep); }

.shares { list-style: none; padding: 0; margin: 18px 0 0; }
.shares li {
  display: grid; grid-template-columns: 12px 1fr auto auto; align-items: center; gap: 10px;
  padding: 9px 0; border-top: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.shares li.is-me .name { font-weight: 650; }
.shares li.former { opacity: .65; }
.shares .put { color: var(--muted); font-size: .9rem; }
.shares .need { min-width: 6.5em; text-align: right; color: var(--muted); font-size: .9rem; }
.shares .need strong { color: var(--ink); font-size: 1rem; }
.shares .ok { color: var(--teal-deep); font-weight: 600; }
.you {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: .72rem; font-weight: 600; color: var(--muted); vertical-align: 1px;
}
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.explain { margin-top: 10px; }

.add {
  display: grid; grid-template-columns: 1fr; gap: 8px;
  margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line);
}
.add .btns { display: flex; gap: 8px; }
.add .btns .btn.primary { flex: 1; }
@media (min-width: 560px) {
  .add { grid-template-columns: 9em 1fr auto; }
}

.goal.done { border-color: color-mix(in srgb, var(--teal) 50%, var(--line)); }
.goal.done .big { color: var(--teal); }
.party { display: inline-block; animation: wiggle 1.2s ease-in-out 2; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }

.burst { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.burst i {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: fall 2.2s cubic-bezier(.3, .6, .4, 1) forwards;
}
@keyframes fall { to { top: 105%; opacity: 0; transform: rotate(540deg); } }

/* -------------------------------------------------------- details / feed */

details.more > summary, .activity details > summary {
  cursor: pointer; font-weight: 600; color: var(--teal-deep); list-style: none;
}
details.more > summary::-webkit-details-marker, .activity details > summary::-webkit-details-marker { display: none; }
details.more { padding: 16px 22px; box-shadow: none; background: var(--surface-2); }
details.more[open] { background: var(--surface); box-shadow: var(--shadow); }
details.more[open] > summary { margin-bottom: 6px; }
details.more form .btn.primary { margin-top: 16px; }

.feed { list-style: none; padding: 0; margin: 0; }
.feed li {
  display: grid; grid-template-columns: 12px 1fr auto 32px; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.feed li:first-child { border-top: 0; }
.feed .note { color: var(--muted); font-size: .88rem; font-style: italic; }
.feed time { font-size: .8rem; white-space: nowrap; }
.feed .in { color: var(--teal-deep); }
.feed .out { color: var(--coral-deep); }
.feed .icon { opacity: 0; transition: opacity .15s; }
.feed li:hover .icon, .feed .icon:focus-visible { opacity: 1; }
@media (hover: none) { .feed .icon { opacity: .6; } }
.activity details { margin-top: 8px; }
.activity details .feed li:first-child { border-top: 1px solid var(--line); }

.members { list-style: none; padding: 0; margin: 0 0 14px; }
.members li {
  display: grid; grid-template-columns: 30px 1fr auto auto; align-items: center; gap: 10px;
  padding: 8px 0; border-top: 1px solid var(--line);
}
.members li:first-child { border-top: 0; }
.members .avatar { border-color: var(--surface); }
.linkbox { margin-top: 10px; }
.linkbox input { font-size: .85rem; }

/* ------------------------------------------------------------ footer/toast */

.foot { padding: 20px 0 48px; text-align: center; font-size: .85rem; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom));
  transform: translate(-50%, 140%);
  max-width: min(92vw, 460px);
  padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: var(--bg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
  font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .25s;
  z-index: 10;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { background: var(--coral-deep); color: #fff; }

@media (max-width: 420px) {
  .card { padding: 18px; }
  .shares li { grid-template-columns: 12px 1fr auto; }
  .shares .put { grid-column: 2; grid-row: 2; font-size: .8rem; margin-top: -6px; }
  .shares .need { grid-column: 3; grid-row: 1 / span 2; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .burst { display: none; }
}
