/*
 * oinam.com
 *
 * Oinam UI, in its own layers, then Navy (color 1, Oinam's own), then this site's few rules,
 * outside any layer so they win without a fight. Only the parts of the system the site uses are
 * imported; ui.css would fetch some thirty files for a site of six pages.
 *
 * The look is a variation of agora.xyz: one column of reading, set left of center on a wide
 * screen, with a hairline running down its right side; a serif for what is said, the system sans
 * for everything else, and space doing the work a border or a box would. Calm, not empty.
 */

@layer tokens, base, layout, components;

@import url("/ui/tokens.css") layer(tokens);
@import url("/ui/base.css") layer(base);
@import url("/ui/text.css") layer(base);
@import url("/ui/layout.css") layer(layout);
@import url("/ui/button.css") layer(components);
@import url("/ui/form.css") layer(components);
@import url("/ui/facts.css") layer(components);
@import url("/ui/table.css") layer(components);
@import url("/assets/navy.css") layer(tokens);

/* Slower than Base, on purpose: the site moves only when the reader does, and then gently. */
:root {
  --site-column: 38rem;
  --site-duration: 0.45s;
}

/* The column. Its right edge is the hairline; on a narrow screen it is the screen's own edge. */
.site {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  box-sizing: content-box;
  min-height: 100vh;
  max-width: var(--site-column);
  margin-inline: auto;
  padding: var(--space-8) var(--space-4) var(--space-12);
}

@media (width >= 64rem) {
  .site {
    margin-inline: max(var(--space-8), calc(50vw - var(--site-column) * 0.8)) auto;
    padding-inline: 0 var(--space-12);
    border-right: 1px solid var(--color-line);
  }
}

/* Header: the mark on the left, three words on the right. */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.site-mark {
  display: inline-flex;
  color: var(--color-ink);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
}

.site-nav a {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  color: var(--color-ink-soft);
  text-decoration: none;
  transition:
    background-color var(--site-duration) var(--ease),
    color var(--site-duration) var(--ease);
}

/* On a phone, four words and the mark must share one line. */
@media (width < 24rem) {
  .site-nav a {
    padding-inline: var(--space-2);
  }
}

.site-nav a:hover {
  background-color: var(--color-wash);
  color: var(--color-ink);
}

.site-nav a[aria-current="page"] {
  background-color: var(--color-ink);
  color: var(--color-cloud);
}

.site-main {
  flex: 1;
}

.site-footer {
  color: var(--color-ink-faint);
  font-size: var(--text-sm);
}

/* The opening of a page: what is said, large and set in the serif, then a line of plain words. */
.site-intro h1 {
  font-size: clamp(2.25rem, 1.6rem + 2.6vw, 3.25rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.site-intro .lede {
  max-width: 34rem;
  font-size: var(--text-lg);
  text-wrap: pretty;
}

/* A group of places: a hairline above, a heading like a sentence, then the list. */
.places {
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-line);
}

.places h2 {
  font-size: var(--text-xl);
  font-weight: 400;
}

.places ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* One place: its address leads, as on agora.xyz, and a few words say what is there. */
.places li {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: var(--space-1) var(--space-6);
  padding-block: var(--space-2);
}

@media (width < 36rem) {
  .places li {
    grid-template-columns: minmax(0, 1fr);
  }
}

.places a {
  color: var(--color-ink);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-decoration-color: var(--color-line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
  transition: text-decoration-color var(--site-duration) var(--ease);
}

.places a:hover {
  text-decoration-color: var(--color-ink);
}

.places li span {
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
}

/* A form from another service, framed by the page and no wider than the column. */
.site-frame {
  display: block;
  width: 100%;
  min-height: 40rem;
  border: 0;
}

/* The contact form: one column, no wider than a letter. */
.contact-form {
  max-width: 34rem;
}

/*
 * A field's edge must stand at 3 to 1 against the page (WCAG 2.2, 1.4.11). Base draws it in
 * --color-line-strong, which measures 1.7 to 1 here in light and 1.8 in dark, so the field is
 * hard to find. The faint ink is the nearest token that passes. Hover and focus already go to
 * the full ink. Written up for oinam.dev as a design need; drop this when Base mends it.
 */
.input:not(:hover, :focus, :focus-visible, :user-invalid, [aria-invalid="true"]) {
  border-color: var(--color-ink-faint);
}

.contact-after {
  color: var(--color-ink-soft);
  font-size: var(--text-sm);
}

/* The field only bots fill in. Off the screen rather than hidden, since some bots skip hidden ones. */
.contact-trap {
  position: absolute;
  left: -100vw;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Moving gently is still moving. A reader who asked for none gets none. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --site-duration: 0s;
  }
}
