/* renzo · style.css — shared by index.html and 404.html
   1 fonts · 2 colours · 3 background · 4 box · 5 text · 6 languages · 7 corner buttons · 8 phones · 9 motion */


/* ---------- 1. Fonts (self-hosted, in /fonts) ---------- */

@font-face { font-family: "Syne Mono"; src: url("fonts/syne-mono.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Syne"; src: url("fonts/syne.woff2") format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Kufam"; src: url("fonts/kufam.woff2") format("woff2"); font-weight: 400 900; font-display: swap; }


/* ---------- 2. Colours: light, dark, disco ----------
   With no choice saved, the page follows the device's light/dark setting. */

:root {
  --bg: #f4f1ea;
  --fg: #1d1c1a;
  --dim: #a8a295;                 /* background ASCII */
  --iri: #ff3fa4, #ff8a5c, #c05cff, #39b6ff, #ff3fa4;   /* pink iridescent, seen in the window */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #121211; --fg: #ebe7dd; --dim: #4a4740;
    --iri: #ff8fd0, #ffc1a1, #d9a8ff, #9fe6ff, #ff8fd0;
    color-scheme: dark;
  }
}
[data-theme="dark"] {
  --bg: #121211; --fg: #ebe7dd; --dim: #4a4740;
  --iri: #ff8fd0, #ffc1a1, #d9a8ff, #9fe6ff, #ff8fd0;
  color-scheme: dark;
}

/* disco: background and characters cycle through hues, driven by --h (0 -> 360) */
@property --h { syntax: "<number>"; inherits: true; initial-value: 0; }
[data-theme="disco"] {
  --bg: hsl(calc(var(--h) * 1deg) 80% 12%);
  --fg: hsl(calc((var(--h) + 180) * 1deg) 100% 85%);
  --dim: hsl(calc((var(--h) + 90) * 1deg) 90% 45%);
  --iri: #ff8fd0, #ffc1a1, #d9a8ff, #9fe6ff, #ff8fd0;
  color-scheme: dark;
  animation: disco-hue 10s linear infinite;
}
@keyframes disco-hue { to { --h: 360; } }

/* ...plus a moving rainbow laid over everything with mix-blend-mode: difference,
   which inverts whatever is underneath wherever the rainbow is bright */
.disco-layer { display: none; }
[data-theme="disco"] .disco-layer {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  mix-blend-mode: difference;
  background: linear-gradient(115deg, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00) 0 0 / 300% 300%;
  animation: disco-slide 6s linear infinite;
}
@keyframes disco-slide { to { background-position: 300% 300%; } }


/* ---------- 3. ASCII background ---------- */

html { background: var(--bg); color: var(--fg); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.6 "Syne Mono", ui-monospace, Menlo, monospace; }

.ascii {
  position: fixed;
  inset: 0;
  z-index: -1;                    /* behind the box */
  overflow: hidden;
  pointer-events: none;
}
.ascii pre {
  margin: 0;
  font: 13px/15px "Syne Mono", ui-monospace, Menlo, monospace;
  color: var(--dim);
}
/* the pink copy: drawn above the box, but main.js clips it to the window's rectangle */
.ascii-lit {
  z-index: 1;
  background: var(--bg);
  clip-path: inset(100%);
}
.ascii-lit pre {
  color: transparent;
  background: linear-gradient(120deg, var(--iri)) 0 0 / 300% 300%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: iridescence 8s ease-in-out infinite alternate;
}
@keyframes iridescence { to { background-position: 100% 100%; } }


/* ---------- 4. The box: centred, bordered, starts half-way down the screen ---------- */

.box {
  max-width: 42rem;
  margin: 50vh auto 3rem;
  margin-top: 50svh;
  padding: 1.25rem 1.75rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--fg);
}
.window {
  height: 7.5rem;
  margin: 0 0 0.5rem;
  border: 1px solid var(--fg);
}

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


/* ---------- 5. Text: two weights, regular and bold ---------- */

a { color: inherit; text-underline-offset: 0.2em; }
a:hover { background: var(--fg); color: var(--bg); text-decoration: none; }
:focus-visible { outline: 2px dashed var(--fg); outline-offset: 2px; }
::selection { background: var(--fg); color: var(--bg); }

.mark {
  margin: 0 0 1.25rem;
  font: 15px/1.1 "Syne Mono", ui-monospace, Menlo, monospace;
  text-align: center;
  direction: ltr;                 /* the art never flips, even in Arabic */
}
.mark-stack { display: none; }

h1, h2 {
  font: 800 1.3rem/1.2 "Syne", sans-serif;
  margin: 1.75rem 0 0.6rem;
}
h2::after {                       /* dashed rule under each heading, cut to the box width */
  content: "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -";
  display: block;
  overflow: hidden;
  white-space: nowrap;
  font: 400 15px/1.4 "Syne Mono", monospace;
}
h3 { font: inherit; margin: 0.9rem 0 0; }
p { margin: 0 0 0.6rem; }
ul { list-style: none; margin: 0; padding: 0; }

.list li { position: relative; padding-inline-start: 2ch; }
.list li::before { content: "-"; position: absolute; inset-inline-start: 0; }

.links li { display: grid; grid-template-columns: 12ch 1fr; }
.links a { justify-self: start; }

.qa dt { margin-top: 0.75rem; }
.qa dd { margin: 0; }

footer { margin-top: 2rem; }


/* ---------- 6. Languages ----------
   Every .bi element holds <span lang="en"> and <span lang="ar">. Hide the one not wanted. */

body [lang="ar"] { font-family: "Kufam", sans-serif; font-weight: 400; }
h1 [lang="ar"], h2 [lang="ar"] { font-weight: 800; }

[data-lang="en"] .bi > [lang="ar"],
[data-lang="ar"] .bi > [lang="en"],
[data-lang="mix"] .bi[data-show="en"] > [lang="ar"],
[data-lang="mix"] .bi[data-show="ar"] > [lang="en"],
[data-lang="mix"] .bi:not([data-show]) > [lang="ar"] {
  display: none;
}


/* ---------- 7. Corner buttons ---------- */

.corner {
  position: fixed;
  top: 0.75rem;
  z-index: 10;
  display: flex;
  border: 1px solid var(--fg);
  background: var(--bg);
}
.corner-left { left: 0.75rem; }
.corner-right { right: 0.75rem; }
.corner button {
  font: 12px/1 "Syne Mono", ui-monospace, monospace;
  color: var(--fg);
  background: none;
  border: 0;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}
.corner button[lang="ar"] { font-family: "Kufam", sans-serif; }
.corner button:hover,
.corner button[aria-pressed="true"] { background: var(--fg); color: var(--bg); }


/* ---------- 8. Phones ---------- */

@media (max-width: 640px) {
  body { font-size: 14px; }
  .box { margin-inline: 0.75rem; padding: 1rem 1rem 1.25rem; }
  .mark-wide { display: none; }
  .mark-stack { display: block; font-size: min(14px, calc((100vw - 3.75rem) / 21)); }
  .window { height: 5.5rem; }
}


/* ---------- 9. Motion: respect the device's "reduce motion" setting ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  [data-theme="disco"] { --h: 290; }
}
