/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

body {
  background-color: #ffffff;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg width='800' height='400' viewBox='0 0 800 400' xmlns='http://www.w3.org/2000/svg'%3E%3Ctext x='400' y='200' font-family='IBM Plex Sans, sans-serif' font-size='80' font-weight='500' letter-spacing='0.5em' fill='rgba(0,0,0,0.015)' text-anchor='middle' dominant-baseline='middle' transform='rotate(-15, 400, 200)'%3EFOHNIKK%3C/text%3E%3C/svg%3E");
  background-attachment: fixed;
  background-repeat: repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out;
  pointer-events: none;
}

body.bg-visible::before {
  opacity: 1;
}

:is(a, button, input, textarea, select):where(:focus-visible) {
  outline: 2px solid #4a4a4a;
  outline-offset: 2px;
  border-radius: 2px;
}

.window-cluster {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: min(100%, 42rem);
  position: relative;
  z-index: 0;
  isolation: isolate;
}

@media (min-width: 640px) {
  .window-cluster {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.window-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: #fafaf9;
  border: 1px solid #a8a29e;
  min-height: 7.5rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.is-entering .window-card {
  animation: windowIn 0.5s ease-out both;
  animation-delay: var(--stagger, 0ms);
}

.window-card:hover {
  transform: translateY(-2px);
  border-color: #57534e;
}

.window-card:hover .window-titlebar {
  background: #e7e5e4;
}

.window-titlebar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid #d6d3d1;
  padding: 0.35rem 0.55rem;
  background: #f5f5f4;
  min-height: 1.75rem;
}

.window-title {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: #2c2c2c;
  margin: 0;
  flex: 1;
}

.window-preview {
  font-size: 0.7rem;
  line-height: 1.5;
  color: #4a4a4a;
  padding: 0.75rem 0.7rem;
}

.window-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1rem;
  height: 1.1rem;
  font-size: 0.85rem;
  line-height: 1;
  color: #4a4a4a;
  text-decoration: none;
  border: 1px solid #d6d3d1;
  flex-shrink: 0;
}

.window-close:hover {
  color: #1a1a1a;
  border-color: #57534e;
}

.window-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(250, 250, 249, 0.15);
  font-size: 0;
  color: transparent;
}

.window-cluster.is-faded,
nav.is-faded {
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
  transition: opacity 0.4s ease;
}

.window-cluster.is-faded .window-card {
  animation: none;
}

.window-card.is-expanded {
  position: fixed;
  z-index: 50;
  top: 8vh;
  left: 1rem;
  right: 1rem;
  width: min(42rem, calc(100vw - 2rem));
  margin-inline: auto;
  height: min(80vh, 44rem);
  min-height: 0;
  animation: none;
  display: flex;
  flex-direction: column;
}

.window-card.is-expanded:focus {
  outline: none;
}

.window-card.is-expanded:hover {
  transform: none;
  border-color: #a8a29e;
}

.window-body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.35rem 1.75rem;
  font-size: 0.8rem;
  line-height: 1.7;
  color: #2c2c2c;
}

.window-body p + p,
.window-body h2 + p,
.window-body h3 + p {
  margin-top: 1rem;
}

.window-body h2,
.window-body h3 {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  font-weight: 500;
  margin-top: 1.5rem;
  scroll-margin-top: 0.5rem;
}

.window-body h2:focus {
  outline: 2px solid #4a4a4a;
  outline-offset: 2px;
}

.window-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  flex-shrink: 0;
  padding: 0.5rem 0.7rem 0.55rem;
  border-bottom: 1px solid #e7e5e4;
  background: #fafaf9;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.65rem;
  letter-spacing: 0.06em;
}

.window-toc a {
  color: #4a4a4a;
  text-decoration: none;
}

.window-toc a:hover,
.window-toc a[aria-current="page"] {
  color: #1a1a1a;
}

.window-toc a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@keyframes windowIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html:active-view-transition .window-card {
  animation: none;
  transition: none;
  transform: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

::view-transition-group(root) {
  z-index: 0;
}

::view-transition-group(window-opening),
::view-transition-group(window-portrait),
::view-transition-group(window-origin),
::view-transition-group(window-paper),
::view-transition-group(window-method),
::view-transition-group(window-horizon) {
  z-index: 60;
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-group(window-page) {
  z-index: 61;
}

html[data-slide="forward"]::view-transition-old(window-page) {
  animation: 0.35s ease both slideOutLeft;
}

html[data-slide="forward"]::view-transition-new(window-page) {
  animation: 0.35s ease both slideInRight;
}

html[data-slide="back"]::view-transition-old(window-page) {
  animation: 0.35s ease both slideOutRight;
}

html[data-slide="back"]::view-transition-new(window-page) {
  animation: 0.35s ease both slideInLeft;
}

@keyframes slideOutLeft {
  to {
    transform: translateX(-20%);
    opacity: 0;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(20%);
    opacity: 0;
  }
}

@keyframes slideOutRight {
  to {
    transform: translateX(20%);
    opacity: 0;
  }
}

@keyframes slideInLeft {
  from {
    transform: translateX(-20%);
    opacity: 0;
  }
}

.window-title,
.window-toc,
.window-body h2,
.window-body h3 {
  font-family: "IBM Plex Mono", "Noto Sans JP", "Noto Sans SC", "Noto Sans TC", ui-monospace, monospace;
}

html[lang="ja"] .window-title,
html[lang="ja"] .window-toc,
html[lang="ja"] .window-body h2,
html[lang="ja"] .window-preview,
html[lang="zh-Hans"] .window-title,
html[lang="zh-Hans"] .window-toc,
html[lang="zh-Hans"] .window-body h2,
html[lang="zh-Hans"] .window-preview,
html[lang="zh-Hant"] .window-title,
html[lang="zh-Hant"] .window-toc,
html[lang="zh-Hant"] .window-body h2,
html[lang="zh-Hant"] .window-preview {
  letter-spacing: 0;
}

.site-lang {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.site-lang__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: color 300ms ease;
}

.site-lang__trigger:hover {
  color: #1a1a1a;
}

.site-lang__icon {
  width: 0.85rem;
  height: 0.85rem;
}

.site-lang__menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 80;
  display: none;
  min-width: 8.5rem;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  border: 1px solid #d6d3d1;
  background: #fafaf9;
}

.site-lang.is-open .site-lang__menu {
  display: flex;
  flex-direction: column;
}

.site-lang__option {
  display: block;
  padding: 0.4rem 0.75rem;
  color: #4a4a4a;
  font-size: 0.7rem;
  text-decoration: none;
  font-family: "IBM Plex Sans", "Noto Sans JP", "Noto Sans SC", "Noto Sans TC", sans-serif;
}

.site-lang__option:hover,
.site-lang__option.is-active {
  color: #1a1a1a;
}

.site-lang__option.is-active {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.site-language-banner {
  position: sticky;
  top: 0;
  z-index: 70;
  background: #f5f5f4;
  border-bottom: 1px solid #e7e5e4;
}

.site-language-banner__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0.65rem 2.5rem;
  font-size: 0.75rem;
  color: #4a4a4a;
  font-family: "IBM Plex Sans", "Noto Sans JP", "Noto Sans SC", "Noto Sans TC", sans-serif;
}

.site-language-banner__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-language-banner__switch {
  background: none;
  border: 0;
  padding: 0;
  color: #1a1a1a;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  font: inherit;
}

.site-language-banner__close {
  background: none;
  border: 0;
  padding: 0 0.25rem;
  color: #4a4a4a;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {

  *,
  ::before,
  ::after {
    animation-delay: -1ms !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    background-attachment: initial !important;
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
  }
}
