/*
 * Ceraelia's homepage (server/pages.ts). The same tokens, font and buttons as the apps
 * (../../oidc/src/index.css and public/op.css; keep them in step). A file, not inline, so the
 * Content-Security-Policy can forbid inline styles.
 */

@font-face {
  font-family: 'Inter Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/assets/fonts/inter-latin-wght-normal.woff2) format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
    U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f5f5f1;
  --surface: #fdfdfb;
  --surface-2: #efefea;
  --border: rgba(11, 11, 11, 0.1);
  --border-strong: rgba(11, 11, 11, 0.18);
  --text: #111413;
  --text-2: #52514e;
  --muted: #6b6a65;

  --accent: #2a78d6;
  /* The apps' favicon green, for icons and the hero's drawing; never for text. */
  --brand: #168a60;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 8px 24px -12px rgba(11, 11, 11, 0.12);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1211;
  --surface: #171b1a;
  --surface-2: #202524;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f1f3f2;
  --text-2: #c3c8c5;
  --muted: #8a918e;

  --accent: #3987e5;
  --brand: #1baf7a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
}

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

html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchored sections clear the sticky header. */
  scroll-padding-top: 4.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter Variable', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: color-mix(in oklab, var(--accent) 30%, transparent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 50;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.375rem;
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
}

.wrap {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 40rem) {
  .wrap {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

/* The header: the apps' sticky bar (AppShell), the brand on the left and the account on the right. */
.top {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
}

.bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 3.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: inherit;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-decoration: none;
  white-space: nowrap;
}

.logo {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  color: var(--brand);
}

.tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  color: var(--text-2);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* The theme button offers the other theme. */
:root[data-theme='dark'] .when-light,
:root:not([data-theme='dark']) .when-dark {
  display: none;
}

/* The apps' buttons (forms.tsx `primary` and `secondary`), sized to their text. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  border-color: transparent;
  background: var(--text);
  color: var(--bg);
}

.btn.primary:hover {
  opacity: 0.9;
}

.btn.small {
  padding: 0.375rem 0.75rem;
}

.btn.large {
  padding: 0.625rem 1.25rem;
  font-size: 0.9375rem;
}

/* The account menu: a <details> that home.js closes on Escape and outside clicks. */
.menu {
  position: relative;
  min-width: 0;
}

.menu-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 14rem;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.menu-button::-webkit-details-marker {
  display: none;
}

.menu-button:hover,
.menu[open] > .menu-button {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.avatar {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: var(--text);
  color: var(--bg);
  font-size: 0.8125rem;
  font-weight: 600;
}

.who {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chevron {
  color: var(--muted);
  transition: transform 120ms;
}

.menu[open] .chevron {
  transform: rotate(180deg);
}

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 30;
  width: min(18rem, calc(100vw - 2rem));
  padding: 0.375rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.75rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu-head {
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0.625rem 0.625rem;
  min-width: 0;
}

.menu-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.menu-meta {
  font-size: 0.8125rem;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.menu-list {
  list-style: none;
  margin: 0;
  padding: 0.375rem 0 0;
  border-top: 1px solid var(--border);
}

.menu-list + .menu-list {
  margin-top: 0.375rem;
}

.menu-item {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.menu-item:hover {
  background: var(--surface-2);
}

.menu-item .icon {
  margin-top: 0.125rem;
  color: var(--text-2);
}

.menu-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.menu-label {
  font-weight: 500;
}

.menu-desc {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--text-2);
}

main {
  flex: 1;
}

main:focus {
  outline: none;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 1rem 0 0;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface-2);
  font-size: 0.875rem;
  color: var(--text-2);
}

.notice .icon {
  margin-top: 0.125rem;
}

/* The hero: what Ceraelia is, and a pedigree bracket drawn beside it on wider screens. */
.hero {
  padding: 3.5rem 0 3rem;
}

.hero-grid {
  display: grid;
  gap: 2.5rem;
  align-items: center;
}

@media (min-width: 56rem) {
  .hero {
    padding: 5rem 0 4.5rem;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 3.5rem;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.25rem 0.75rem 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-2);
}

.eyebrow .icon {
  color: var(--brand);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 1.25rem + 3vw, 3.25rem);
  line-height: 1.08;
  font-weight: 650;
  letter-spacing: -0.035em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.hero-small h1 {
  font-size: 2rem;
}

.lede {
  margin: 1.25rem 0 0;
  max-width: 34rem;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-2);
  text-wrap: pretty;
}

.hero-go {
  margin: 2rem 0 0;
}

.hero-art {
  display: none;
}

@media (min-width: 56rem) {
  .hero-art {
    display: block;
    padding: 2rem;
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    background-color: var(--surface);
    background-image: radial-gradient(color-mix(in oklab, var(--text) 9%, transparent) 1px, transparent 1px);
    background-size: 1.25rem 1.25rem;
    box-shadow: var(--shadow);
  }
}

.tree {
  display: block;
  width: 100%;
  height: auto;
}

.tree .link {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 2;
}

.tree .node {
  fill: var(--surface);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.tree .node-dot {
  fill: color-mix(in oklab, var(--brand) 55%, var(--surface));
}

.tree .node-line {
  fill: var(--surface-2);
}

.tree .node-new {
  fill: var(--brand);
  stroke: none;
}

.tree .node-icon {
  stroke: #fff;
}

.tree .node-line-new {
  fill: rgba(255, 255, 255, 0.55);
}

/* What we make: one card per app. */
.apps {
  padding: 3.5rem 0;
  border-top: 1px solid var(--border);
}

.section-head h2 {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.03em;
}

.section-head p {
  margin: 0.5rem 0 0;
  max-width: 34rem;
  color: var(--text-2);
}

.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 1rem;
  margin-top: 2rem;
}

.product {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: var(--shadow);
}

@media (min-width: 40rem) {
  .product {
    padding: 2rem;
  }
}

.product-head {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.product-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  flex-shrink: 0;
  border-radius: 0.75rem;
  background: color-mix(in oklab, var(--brand) 14%, var(--surface));
  color: var(--brand);
}

.product-icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.product-name {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.product-host {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.product-tagline {
  margin: 1.25rem 0 0;
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.product-desc {
  margin: 0.5rem 0 0;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.product-for {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: var(--text-2);
}

.label {
  margin-right: 0.25rem;
  padding: 0.0625rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text);
}

.features {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 0.625rem;
}

.features li {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  font-size: 0.9375rem;
}

.features .icon {
  margin-top: 0.25rem;
  color: var(--brand);
}

.product-note {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin: 1.25rem 0 0;
  padding: 0.625rem 0.75rem;
  border-radius: 0.5rem;
  background: var(--surface-2);
  font-size: 0.8125rem;
  line-height: 1.25rem;
  color: var(--text-2);
}

.product-note .icon {
  margin-top: 0.125rem;
}

.product-go {
  margin: auto 0 0;
  padding-top: 1.5rem;
}

/* Why Ceraelia: three short points. */
.values {
  padding: 1rem 0 4rem;
}

.value-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  gap: 2rem;
}

.value-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  background: var(--surface);
  color: var(--brand);
}

.value-list h3 {
  margin: 0.875rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.value-list p {
  margin: 0.25rem 0 0;
  font-size: 0.9375rem;
  color: var(--text-2);
}

.foot {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.875rem;
  color: var(--text-2);
}

.foot-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 40rem) {
  .foot-grid {
    grid-template-columns: 1fr auto;
    align-items: start;
  }

  .foot-copy {
    grid-column: 1 / -1;
  }
}

.foot-brand p {
  margin: 0.375rem 0 0;
}

.foot-links ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.foot-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

.foot-links a:hover {
  text-decoration: underline;
}

.foot-copy {
  margin: 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* On a phone the menu button keeps just the avatar, so the brand fits on one line; the name stays
   the button's accessible name, and the open menu shows it in full. */
@media (max-width: 30rem) {
  .who {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    border: 0;
  }
}
