/*  shide.css - minimal semantic CSS template
 *
 *  Provides responsive, accessible typography and layout
 *  for text-oriented pages and documentation.
 *
 *  Features:
 *      • Light and dark color support
 *      • Flexible grid and container system
 *      • Styled headings, lists, tables, code, and forms
 *      • Accessible skip links and focus-visible outlines
 *      • Media queries for reduced motion and small screens
 *
 *  Part of the issei ecosystem.
 *
 *  SPDX-License-Identifier: ISC
 *  Copyright (c) 2026 Sergiy Duras
 */

@font-face {
  font-family: "Seravek";
  src: url("/fonts/sans.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Seravek";
  src: url("/fonts/sans-bold.woff") format("woff");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Agave";
  src: url("/fonts/mono.woff") format("woff");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;
  --font-sans: "Seravek", system-ui, -apple-system, sans-serif;
  --font-mono: "Agave", ui-monospace, monospace;
  --gap: 1.5rem;
  --radius: 4px;
  --container-width: 760px;
  --border: color-mix(in srgb, GrayText 40%, transparent);
}

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

html {
  font-family: var(--font-sans);
  font-size: clamp(100%, 1rem + 0.5vw, 1.25rem);
  line-height: 1.6;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

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

body {
  margin: 0 auto;
  padding: var(--gap);
  width: min(var(--container-width), 100%);
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: Canvas;
  color: CanvasText;
  overflow-wrap: break-word;
}

main {
  flex: 1;
}

footer {
  font-size: 0.85em;
  color: GrayText;
  text-align: center;
  margin-top: var(--gap);
}

footer a {
  text-decoration: none;
}

section + section {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 1.5rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
  margin: 1.5em 0 0.5em;
  text-wrap: balance;
  max-width: 30ch;
}

h1 {
  font-size: 2rem;
  letter-spacing: -0.05em;
}
h2 {
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}
h3 {
  font-size: 1.5rem;
}
h4 {
  font-size: 1.25rem;
}
h5 {
  font-size: 1.1rem;
}
h6 {
  font-size: 1rem;
}

p,
ul,
ol,
dl,
blockquote,
details,
pre,
.table-wrap {
  max-width: 65ch;
  margin: 0 0 var(--gap);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

ul,
ol {
  padding-left: var(--gap);
}

li {
  margin-bottom: 0.25rem;
}

dt {
  font-weight: 700;
}

a {
  color: LinkText;
  text-decoration-skip-ink: auto;
}
@media (hover: hover) {
  a:hover {
    text-decoration: none;
  }
}

small {
  font-size: 0.85em;
}

nav ul {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0;
}

nav a {
  opacity: 0.75;
}

nav a:hover,
nav a.active {
  opacity: 1;
}

nav a.active {
  border-bottom: 2px solid;
}

code,
pre,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

code {
  padding: 0.15em 0.3em;
  background: color-mix(in srgb, CanvasText 10%, transparent);
  border-radius: 3px;
  word-wrap: break-word;
}

a > code {
  color: inherit;
}

pre {
  padding: 1rem;
  overflow: auto;
  background: color-mix(in srgb, CanvasText 5%, Canvas);
  border-radius: var(--radius);
}

pre code {
  padding: 0;
  background: transparent;
}

blockquote {
  border-left: 3px solid GrayText;
  padding-left: 1rem;
  margin-left: 0;
  color: GrayText;
}

blockquote footer::before {
  content: "\FE63  ";
  color: CanvasText;
}

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  min-width: max-content;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

th {
  font-weight: 700;
  background: Canvas;
}

tbody tr:nth-child(even) {
  background-color: color-mix(in srgb, CanvasText 5%, transparent);
}

@media (hover: hover) {
  tbody tr:hover {
    background-color: color-mix(in srgb, CanvasText 8%, transparent);
  }
}

caption {
  caption-side: bottom;
  text-align: left;
  color: GrayText;
  font-size: 0.85em;
  padding-top: 0.5rem;
}

details {
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
}

summary {
  display: list-item;
  cursor: pointer;
  font-weight: bold;
}

progress {
  vertical-align: middle;
}

img,
video {
  max-width: 100%;
  height: auto;
  display: block;
  margin-bottom: var(--gap);
  border-radius: var(--radius);
}

svg {
  max-width: 100%;
  height: auto;
  display: block;
  overflow: hidden;
}

input,
textarea,
select,
button {
  font: inherit;
  line-height: inherit;
  padding: 0.4rem 0.6rem;
  border: 1px solid GrayText;
  border-radius: var(--radius);
  background: Canvas;
  color: inherit;
  accent-color: LinkText;
}

textarea {
  resize: vertical;
}

fieldset {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

output {
  display: inline-block;
}

button {
  cursor: pointer;
  background: ButtonFace;
  color: ButtonText;
  border: 1px solid transparent;
}

:focus-visible {
  outline: 2px solid LinkText;
  outline-offset: 2px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}

.col-2 {
  grid-column: span 2;
}

.col-full {
  grid-column: 1 / -1;
}

@media (max-width: 600px) {
  .grid {
    grid-template-columns: 1fr;
  }
  .col-2 {
    grid-column: 1 / -1;
  }
}

.skip-link:not(:focus) {
  clip-path: inset(50%);
  height: 1px;
  width: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
}

.skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: Canvas;
  color: CanvasText;
  border: 2px solid LinkText;
  border-radius: var(--radius);
  text-decoration: none;
}
