/* ECS Home. Warm ivory by day, ink by night; gold for the brand, one quiet colour per app. */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400 650; font-display: swap; src: url("fonts/inter.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif.woff2") format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-style: italic; font-weight: 400; font-display: swap; src: url("fonts/instrument-serif-italic.woff2") format("woff2"); }

:root {
  color-scheme: light dark;
  --bg: #f4f1ea;
  --glow-a: rgba(190, 150, 80, .20);
  --glow-b: rgba(120, 130, 200, .10);
  --panel: rgba(255, 253, 249, .74);
  --panel-solid: #fffdf9;
  --panel-hover: rgba(255, 253, 249, .96);
  --line: rgba(40, 32, 20, .09);
  --line-strong: rgba(40, 32, 20, .17);
  --ink: #17140f;
  --ink-2: #4b4439;
  --muted: #847b6c;
  --gold: #946f2f;
  --gold-soft: rgba(148, 111, 47, .11);
  --shadow: 0 1px 2px rgba(23, 20, 15, .04), 0 14px 34px -16px rgba(23, 20, 15, .18);
  --shadow-hover: 0 2px 4px rgba(23, 20, 15, .05), 0 26px 48px -20px rgba(23, 20, 15, .26);
  --up: #2f8f62;
  --slow: #b7791f;
  --down: #c2412d;
  --mark-tile: #17140f;
  --mark-gold: #d9bb7f;
  --mark-light: #f6ecd6;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 22px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d10;
    --glow-a: rgba(214, 183, 122, .13);
    --glow-b: rgba(120, 130, 255, .08);
    --panel: rgba(255, 255, 255, .035);
    --panel-solid: #15161b;
    --panel-hover: rgba(255, 255, 255, .06);
    --line: rgba(255, 255, 255, .075);
    --line-strong: rgba(255, 255, 255, .16);
    --ink: #f3efe7;
    --ink-2: #c4beb2;
    --muted: #8b867d;
    --gold: #d9bb7f;
    --gold-soft: rgba(217, 187, 127, .12);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 18px 40px -22px rgba(0, 0, 0, .7);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .3), 0 30px 60px -24px rgba(0, 0, 0, .85);
    --up: #4fc48d;
    --slow: #e3a53f;
    --down: #f06c55;
    --mark-tile: #1b1c22;
  }
}

/* One colour per app: --tint for marks and lines, --tint-soft for fills. */
[data-app="tracker"] { --tint: #2b8a68; --tint-soft: rgba(43, 138, 104, .11); }
[data-app="studio"] { --tint: #c4583d; --tint-soft: rgba(196, 88, 61, .10); }
[data-app="coaching"] { --tint: #5f56d6; --tint-soft: rgba(95, 86, 214, .10); }
[data-app="board"] { --tint: #2a74b8; --tint-soft: rgba(42, 116, 184, .10); }
[data-app="ai"] { --tint: var(--gold); --tint-soft: var(--gold-soft); }
[data-app="site"] { --tint: #8a6fd1; --tint-soft: rgba(138, 111, 209, .10); }
@media (prefers-color-scheme: dark) {
  [data-app="tracker"] { --tint: #5fcfa4; --tint-soft: rgba(95, 207, 164, .12); }
  [data-app="studio"] { --tint: #f29277; --tint-soft: rgba(242, 146, 119, .12); }
  [data-app="coaching"] { --tint: #a39cff; --tint-soft: rgba(163, 156, 255, .13); }
  [data-app="board"] { --tint: #73b6f2; --tint-soft: rgba(115, 182, 242, .12); }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
kbd {
  display: inline-grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 .45em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  font: 500 11px/1 var(--sans);
  color: var(--muted);
  background: var(--panel);
}
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* The backdrop: two soft glows and a fine grain, fixed behind everything. */
.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 560px at 8% -8%, var(--glow-a), transparent 62%),
    radial-gradient(760px 520px at 100% 4%, var(--glow-b), transparent 60%);
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  mix-blend-mode: soft-light;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Top bar */
.top, main, .foot { width: min(1120px, 100% - 32px); margin-inline: auto; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 0;
}
.brand { display: flex; align-items: center; gap: 12px; border-radius: 12px; }
.mark { width: 36px; height: 36px; flex: none; stroke: none; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .14)); }
.mark-tile { fill: var(--mark-tile); }
.mark-arc { fill: none; stroke: var(--mark-gold); stroke-width: 2.2; stroke-linecap: round; }
.mark-needle { fill: none; stroke: var(--mark-light); stroke-width: 2.2; stroke-linecap: round; }
.mark-hub { fill: var(--mark-light); }
.brand-text { display: grid; line-height: 1.15; }
.brand-text b { font-weight: 600; font-size: 14px; letter-spacing: -.005em; }
.brand-text small { font-size: 12px; color: var(--muted); letter-spacing: .02em; }

.search-button {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 8px 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--muted);
  font-size: 13.5px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .2s, color .2s, background .2s;
}
.search-button svg { width: 16px; height: 16px; }
.search-button:hover { border-color: var(--line-strong); color: var(--ink); background: var(--panel-hover); }
.search-label { min-width: 13em; text-align: left; }

/* Hero */
main { flex: 1; padding: clamp(48px, 9vh, 96px) 0 40px; }
.hero { margin-bottom: clamp(40px, 7vh, 72px); }
.today {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
}
h1 {
  margin: 0;
  font: 400 clamp(48px, 7.4vw, 84px)/1 var(--serif);
  letter-spacing: -.018em;
}
h1 em { font-style: italic; color: var(--gold); }
.lede { margin: 18px 0 0; max-width: 34em; font-size: clamp(16px, 1.6vw, 18px); color: var(--ink-2); }

/* Section heads */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 2px 16px; }
.section-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.hint { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
section + section { margin-top: 48px; }

/* App cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
/* Each card spans two rows of the grid (its main part and its shortcuts) through a subgrid, so the
   dividers line up across a row even when one card's shortcuts wrap. */
.card {
  position: relative;
  display: grid;
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 0;
  min-height: 268px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  overflow: hidden;
  isolation: isolate;
  transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .3s, background .3s;
  animation: rise .7s var(--ease) both;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(520px 260px at 0% 0%, var(--tint-soft), transparent 70%);
  opacity: .55;
  transition: opacity .45s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: color-mix(in srgb, var(--tint) 32%, var(--line)); background: var(--panel-hover); }
.card:hover::before { opacity: 1; }
.grid .card:nth-child(2) { animation-delay: .06s; }
.grid .card:nth-child(3) { animation-delay: .12s; }
.grid .card:nth-child(4) { animation-delay: .18s; }

.card-main { display: flex; flex-direction: column; flex: 1; padding: 26px 26px 22px; border-radius: var(--radius) var(--radius) 0 0; }
.card-main:focus-visible { outline-offset: -4px; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 26px; }
.app-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--tint);
  background: var(--tint-soft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tint) 18%, transparent);
}
.app-icon svg { width: 23px; height: 23px; }
.card h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  font: 400 34px/1.05 var(--serif);
  letter-spacing: -.01em;
}
.go {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: var(--muted);
  border: 1px solid var(--line);
  transition: transform .45s var(--ease), color .3s, border-color .3s, background .3s;
}
.go svg { width: 14px; height: 14px; stroke-width: 2; }
.card:hover .go { color: var(--tint); border-color: color-mix(in srgb, var(--tint) 40%, transparent); background: var(--tint-soft); transform: translate(2px, -2px); }
.card p.summary-text { margin: 0; max-width: 40ch; color: var(--ink-2); font-size: 14.5px; }
.owner { margin-top: auto; padding-top: 18px; font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.owner kbd { margin-left: auto; }

.links { display: flex; flex-wrap: wrap; align-content: flex-start; gap: 8px; padding: 16px 26px 22px; border-top: 1px solid var(--line); }
.links a {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--panel-solid) 55%, transparent);
  transition: color .2s, border-color .2s, background .2s;
}
.links a:hover { color: var(--tint); border-color: color-mix(in srgb, var(--tint) 45%, transparent); background: var(--tint-soft); }

/* Status pill */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-solid) 60%, transparent);
  white-space: nowrap;
}
.dot { position: relative; width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--line-strong); }
.dot[data-state="up"] { background: var(--up); }
.dot[data-state="slow"] { background: var(--slow); }
.dot[data-state="down"] { background: var(--down); }
.dot[data-state="up"]::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--up);
  opacity: 0;
  animation: ping 2.8s var(--ease) infinite;
}
.dot[data-state="checking"] { animation: breathe 1.4s ease-in-out infinite; }

/* Behind the scenes: compact rows */
.more { display: grid; gap: 12px; }
.row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  transition: transform .45s var(--ease), border-color .3s, background .3s;
  animation: rise .7s var(--ease) .24s both;
}
.row:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--tint) 32%, var(--line)); background: var(--panel-hover); }
.row .app-icon { width: 40px; height: 40px; border-radius: 12px; }
.row .app-icon svg { width: 19px; height: 19px; }
.row-text { flex: 1; min-width: 0; display: grid; }
.row-text b { font-weight: 600; font-size: 14.5px; }
.row-text span { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row:hover .go { color: var(--tint); border-color: color-mix(in srgb, var(--tint) 40%, transparent); background: var(--tint-soft); transform: translate(2px, -2px); }

/* Loading and failure */
.skeleton { grid-row: span 1; display: block; min-height: 268px; background: linear-gradient(100deg, var(--panel) 30%, var(--panel-hover) 50%, var(--panel) 70%) 0 0 / 300% 100%; animation: shimmer 1.6s linear infinite; }
.problem {
  grid-column: 1 / -1;
  grid-row: span 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink-2);
}
.button {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--panel-solid);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
}
.button:hover { border-color: var(--gold); color: var(--gold); }

/* Footer */
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 22px 2px 30px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.foot p { margin: 0; }
.summary { display: flex; align-items: center; gap: 10px; }

/* Search: a command palette over every app and page */
.palette {
  width: min(640px, 100% - 32px);
  max-height: min(560px, 100dvh - 64px);
  margin: 12vh auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--panel-solid);
  color: var(--ink);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .5), 0 0 0 1px rgba(0, 0, 0, .02);
  overflow: hidden;
}
.palette[open] { display: flex; flex-direction: column; animation: pop .22s var(--ease); }
.palette::backdrop { background: rgba(12, 11, 9, .38); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.palette-search { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette-search svg { width: 19px; height: 19px; color: var(--muted); flex: none; }
.palette-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 400 17px/1.4 var(--sans);
}
.palette-search input::placeholder { color: var(--muted); }
.palette-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.palette-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
}
.palette-list li[aria-selected="true"] { background: var(--tint-soft); }
.palette-list .app-icon { width: 32px; height: 32px; border-radius: 9px; flex: none; }
.palette-list .app-icon svg { width: 16px; height: 16px; }
.palette-list .label { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.palette-list .label b { font-weight: 500; font-size: 14.5px; }
.palette-list .label span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-list .enter { opacity: 0; color: var(--tint); }
.palette-list .enter svg { width: 16px; height: 16px; }
.palette-list li[aria-selected="true"] .enter { opacity: 1; }
.palette-empty { margin: 0; padding: 28px 20px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; gap: 18px; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.palette-foot span { display: flex; align-items: center; gap: 5px; }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes ping { 0% { opacity: .55; transform: scale(.6); } 70%, 100% { opacity: 0; transform: scale(1.5); } }
@keyframes breathe { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -300% 0; } }

/* Phones and narrow windows */
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .card, .skeleton { min-height: 0; }
  .skeleton { height: 220px; }
  .card-main { padding: 22px 20px 18px; }
  .card-top { margin-bottom: 20px; }
  .card h3 { font-size: 30px; }
  .links { padding: 14px 20px 18px; }
  .hint, .owner kbd { display: none; }
  .search-label, #search-key { display: none; }
  .search-button { width: 42px; padding: 0; justify-content: center; }
  .brand-text small { display: none; }
  .row-text span { white-space: normal; }
  .row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "icon text go" "icon status go";
    gap: 10px 14px;
  }
  .row .app-icon { grid-area: icon; align-self: start; }
  .row-text { grid-area: text; }
  .row .status { grid-area: status; justify-self: start; }
  .row .go { grid-area: go; }
}

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