@layer base, components, utilities;

@import "/css/stylecheat.css";
@import "./nodemodules/@ape-egg/vibe/vibe.css";
@import "./nodemodules/@ape-egg/codie/codie.css";
@import "/css/fonts.css";
@import "/css/colors.css";
@import "/css/nav.css";
@import "/css/scrollbar.css";
@import "/css/demo-styles.css";
@import "/css/tutorial-styles.css";
@import "/css/aside.css";
@import "/css/utilities.css";
@import "/css/page-root.css";
@import "/css/intro-overlay.css";

:root {
  --attached: oklch(0.55 0.02 250);
  --attached-muted: oklch(0.55 0.02 250 / 0.2);
  --manifested: oklch(0.55 0.02 250);
  --manifested-muted: oklch(0.55 0.02 250 / 0.2);
  --observer: oklch(0.6 0.11 240);
  --observer-muted: oklch(0.6 0.11 240 / 0.2);
  --cleanup: oklch(0.55 0.02 250);
  --cleanup-muted: oklch(0.55 0.02 250 / 0.2);

  --parsed: oklch(0.62 0.12 50);
  --parsed-muted: oklch(0.62 0.12 50 / 0.2);
  --hydrated: oklch(0.6 0.12 340);
  --hydrated-muted: oklch(0.6 0.12 340 / 0.2);
  --iterated: oklch(0.58 0.11 142);
  --iterated-muted: oklch(0.58 0.11 142 / 0.2);
  --evaluated: oklch(0.58 0.11 142);
  --evaluated-muted: oklch(0.58 0.11 142 / 0.2);
  --fetched: oklch(0.59 0.12 307);
  --fetched-muted: oklch(0.59 0.12 307 / 0.2);

  --error: oklch(0.58 0.12 25);
  --error-muted: oklch(0.58 0.12 25 / 0.2);
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.25s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

layout,
.layout {
  display: flex;
  height: 100%;
  align-items: flex-start;
  justify-content: flex-start;
}

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--background);
  color: oklch(
    from var(--foreground) calc(l + 0.075 + (0.125 * var(--theme-sign))) c h
  );
  font-family: "Geist", sans-serif;
  -webkit-font-smoothing: antialiased;
}

[syntax-demo] {
  font-family: "Geist Mono", monospace;
  font-size: calc(var(--unit) * 4);
}
[vibe-syntax] {
  color: var(--codie-vibe);
}
[vibe-syntax]:hover {
  color: oklch(from var(--codie-vibe) calc(l + 0.1) c h);
}
[state-syntax] {
  color: var(--codie-vibe);
}
[state-syntax]:hover {
  color: oklch(from var(--codie-vibe) calc(l + 0.1) c h);
}
[conditional-syntax] {
  color: var(--codie-comment);
}
[conditional-syntax]:hover {
  color: oklch(from var(--codie-comment) calc(l + 0.1) c h);
}

sticky,
.sticky {
  white-space: nowrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  right: 0;
  width: 100%;
  padding: calc(var(--unit) * 3);
  order: -1;
  font-size: calc(var(--unit) * 4);
  margin-top: 0;
}

sticky::after,
.sticky::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border));
}

sticky h3,
.sticky h3 {
  font-size: 1em;
  font-weight: 500;
}
sticky crow,
.sticky crow {
  opacity: 0;
  transition: opacity 250ms ease-in-out;
}

sticky icon,
.sticky icon {
  outline: 1px solid var(--border);
  transition: background 150ms ease-in-out;
}

textarea {
  width: 100%;
}
main-area,
.main-area {
  display: flex;
  height: 100vh;
  flex-direction: column;
  flex: 1;
}

header {
  display: flex;
  justify-content: flex-end;
  padding: calc(var(--unit) * 3);
}

main {
  overflow-y: scroll;
  overflow-x: hidden;
  margin-right: -11px;
  background: var(--card);
  border-top-left-radius: var(--radius);
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex: 1;
}

body:not([page-component-test-suite]) main {
  scroll-behavior: smooth;
  scroll-snap-type: y mandatory;
}

body:not([page-codie]) article {
  padding: calc(var(--unit) * 6) calc(var(--unit) * 6);
  min-width: 0;
  min-height: 100%;
  overflow-wrap: break-word;
  width: 100%;
  display: flex;
  flex-direction: column;
}

constrain-width,
.constrain-width {
  width: 100%;
}

body:not([page-codie]) constrain-width,
body:not([page-codie]) .constrain-width {
  max-width: 800px;
  margin: 0 auto;
}

tutorial,
.tutorial {
  display: flex;
  flex-direction: column;
  max-width: 1080px;
  width: 100%;
}

tutorial template[codie],
.tutorial template[codie] {
  border: 1px solid var(--border);
}

[emphasis] {
  color: var(--foreground);
  font-style: italic;
}

card[gray] card-content {
  border-top: 0;
  box-shadow: inset 0 0px 1px oklch(0 0 0 / 0.4);
}

sticky-footer,
.sticky-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-bottom: calc(var(--unit) * 4);
  position: sticky;
  bottom: 0;
  margin-inline: calc(var(--unit) * -1);
  margin-bottom: calc(var(--unit) * -6);
  background: var(--card);
}

sticky-footer > span,
.sticky-footer > span {
  color: var(--muted-foreground);
  font-size: calc(var(--unit) * 3);
}

sticky-footer a,
.sticky-footer a {
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 2);
  padding: calc(var(--unit) * 2) calc(var(--unit) * 3);
  border-radius: calc(var(--radius) / 2);
  color: var(--primary);
  text-decoration: none;
  transition: background 150ms ease;
}
sticky-footer a:hover,
.sticky-footer a:hover {
  background: oklch(from var(--primary) l c h / 0.1);
}

sticky-footer[quests],
.sticky-footer[quests] {
  flex-direction: column;
  padding-top: calc(var(--unit) * 4);
  padding-bottom: 0;
  border-top: none;
}

sticky-footer[quests] card,
.sticky-footer[quests] card {
  width: 100%;
  margin-bottom: calc(var(--unit) * 4);
}

sticky-footer[quests] footer-pagination,
.sticky-footer[quests] footer-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding-block: calc(var(--unit) * 4);
}

sticky-footer[quests] footer-pagination [pagination-next],
.sticky-footer[quests] footer-pagination [pagination-next] {
  margin-left: auto;
}

pre[dark][static] {
  position: relative;
  border-radius: calc(var(--radius) - var(--unit) * 3)
    calc(var(--radius) - var(--unit) * 3) 0 0;
  background: linear-gradient(
    to bottom,
    oklch(from var(--muted-foreground) 0.4 0.01 270),
    #1e1e1e
  );
}

pre[dark][static] .filename {
  position: absolute;
  top: calc(var(--unit) * 2);
  right: calc(var(--unit) * 2);
  display: flex;
  align-items: center;
  gap: calc(var(--unit) * 2);
  padding: calc(var(--unit) * 1) calc(var(--unit) * 2);
  font-size: 12px;
  color: white;
  background: #1e1e1e;
  border-radius: calc(var(--unit) * 1);
}

pre[dark][static] .filename icon {
  opacity: 0.5;
  vertical-align: middle;
}

pre[dark][static]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    to right,
    transparent 0%,
    oklch(from var(--muted-foreground) 0.4 0.01 270) 50%,
    transparent 100%
  );
}
