/* Norfila – site styles. System fonts only: nothing is loaded from other servers. */

/* Dark only. Neutral greys throughout; the only colours are the link/focus
   accent, the thread in the heading and the app icons. On an app's own pages
   the accent becomes that app's colour (generated from content/apps.mjs). */

:root {
  color-scheme: dark;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;

  --bg: #0A0A0A;
  --surface: #121212;
  --surface-2: #171717;
  --text: #EDEDED;
  --muted: #A0A0A0;
  --line: #262626;
  --line-strong: #3A3A3A;
  --accent: #6EA8FF;
  --accent-soft: #14233D;
  --ok: #4CC38A;
  --warn: #F2C46B;
  --thread: #E9BC63; /* the stitched line under the first heading; the gold of the logo */
  --logo-door: #8FBF9A;          /* outer arch of the logo (forest green, lightened for the dark page) */
  --logo-inner: var(--thread);   /* inner door of the logo */
  --tint: color-mix(in srgb, var(--text) 6%, transparent);

  --icon-shadow: 0 0 0 1px rgb(255 255 255 / .08);

  --radius: 16px;   /* cards and blocks */
  --radius-s: 10px; /* buttons and small controls */
  --max: 1120px;
  --head: 680px;    /* width of every heading block */
  --gutter: clamp(16px, 4vw, 32px);
}

/* ------------------------------------------------------------ base */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.i { width: 20px; height: 20px; flex: none; }

.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: var(--radius-s); background: var(--text); color: var(--bg); text-decoration: none; font-weight: 600; }
.skip:focus { top: 12px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Everything holds still, with one exception: the needle that sews the line
     under the home heading (.stitched::after, .needle and its svg). It is small,
     runs once for about three seconds and then stops. To switch it off as well,
     put back the plain selector:  *, *::before, *::after  */
  *:not(.needle, .needle > svg), *::before, *:not(.stitched)::after { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------ header */

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(16px);
  backdrop-filter: saturate(1.5) blur(16px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; height: 60px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; font-size: 1.05rem; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; }

.nav { margin-left: auto; display: flex; align-items: center; gap: clamp(14px, 2.4vw, 28px); }
.nav a { padding-block: 8px; color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500; transition: color .15s; }
.nav a:hover { color: var(--text); }
@media (max-width: 560px) { .nav .hide-sm { display: none; } }

/* ------------------------------------------------------------ buttons */

/* One shape, two kinds: .primary for the main action, plain for the rest. */
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px;
  border-radius: var(--radius-s); border: 1px solid var(--line-strong);
  background: transparent; color: var(--text);
  font: 600 .95rem/1.2 var(--font); text-decoration: none;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--tint); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: color-mix(in srgb, var(--text) 84%, var(--bg)); border-color: transparent; }
.btn .i { width: 18px; height: 18px; }
/* A button that shows only a logo; its label is in aria-label and title. */
.btn.icon-only { width: 48px; min-height: 48px; padding: 0; }
.btn.icon-only .i { width: 24px; height: 24px; }

/* ------------------------------------------------------------ headings and sections */

/* Every heading block is centred and has the same width. */
.section-head { max-width: var(--head); margin: 0 auto clamp(32px, 4.5vw, 52px); text-align: center; }
.section-head h2, .h-section { font-size: clamp(1.8rem, 3.6vw, 2.5rem); letter-spacing: -.03em; }
.h-section { margin-bottom: clamp(28px, 4vw, 44px); text-align: center; }

.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.lead { margin: 16px auto 0; font-size: clamp(1.08rem, 1.8vw, 1.22rem); color: var(--muted); max-width: 34em; }

.section { padding: clamp(64px, 9vw, 112px) 0; }
.section-tight { padding: 0 0 clamp(32px, 5vw, 56px); }

.intro { padding: clamp(56px, 9vw, 112px) 0 clamp(64px, 9vw, 112px); }
.intro h1 { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; }
.intro .lead { margin-top: 20px; }

/* The stitched heading: a needle sews a line of stitches under the first
   sentence, once, when the page loads. The rules below describe the finished
   picture (stitches done, needle resting at the end); the keyframes only
   describe where it starts. So if the animation is ever switched off (see the
   reduced-motion rule above, which lets this one play), the finished picture
   is simply there. */
.intro { overflow-x: clip; } /* the needle may reach past the text on narrow screens */
/* max-width leaves room beside the text for the resting needle on narrow screens. */
.stitched { position: relative; display: block; width: fit-content; max-width: calc(100% - 1.2em); margin-inline: auto; padding-bottom: .14em; }
.stitched::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: max(3px, .06em); border-radius: 99px;
  background: repeating-linear-gradient(90deg, var(--thread) 0 .34em, transparent .34em .52em);
  animation: sew-thread 2.2s linear .5s both;
}
.needle {
  position: absolute; left: 100%; bottom: -.03em; width: 1em; height: .5em; color: #D6D6D6;
  animation: sew-run 2.2s linear .5s both;
}
.needle svg {
  width: 100%; height: 100%; overflow: visible;
  transform-origin: 0 87.5%; /* where the thread leaves the last stitch */
  transform: rotate(-38deg);
  /* While sewing, the needle dips once per stitch; then it tilts up to rest. */
  animation: sew-rest .5s ease-out 2.7s backwards, sew-bob .275s ease-in-out .5s 8;
}
.needle-thread { stroke: var(--thread); }
.needle-body { fill: currentColor; }
.needle-eye { stroke: var(--bg); }
@keyframes sew-thread { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes sew-run { from { left: 0; } }
@keyframes sew-bob { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-12deg) translateY(-.05em); } }
@keyframes sew-rest { from { transform: rotate(0deg); } }

/* ------------------------------------------------------------ app icons and status labels */

.app-icon { border-radius: 23%; box-shadow: var(--icon-shadow); flex: none; background: var(--surface-2); }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 2px 9px; border-radius: 6px; font-size: .78rem; font-weight: 600; line-height: 1.6; background: var(--tint); color: var(--muted); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.pill.live .dot, .pill.github .dot { background: var(--ok); }

/* ------------------------------------------------------------ app cards */

.app-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .app-grid { grid-template-columns: repeat(2, 1fr); } }

.app-card {
  position: relative; display: flex; flex-direction: column; gap: 16px;
  padding: clamp(22px, 3vw, 28px);
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .15s;
}
.app-card:hover { border-color: var(--line-strong); }
.app-card:has(h3 a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.app-card-top { display: flex; align-items: center; gap: 16px; }
.app-card-top .app-icon { width: 56px; height: 56px; }
.app-card h3 { font-size: 1.3rem; margin-bottom: 5px; }
.app-card h3 a { color: var(--text); text-decoration: none; }
.app-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.app-card h3 a:focus-visible { outline: none; }
.app-card .tagline { color: var(--muted); }

.facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .97rem; }
.facts li { display: flex; gap: 10px; align-items: flex-start; }
.facts .i { color: var(--muted); margin-top: 3px; width: 18px; height: 18px; }

.card-links { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 22px; align-items: center; font-size: .93rem; font-weight: 500; }
.card-links .more { display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.card-links .more .i { width: 16px; height: 16px; transition: transform .2s; }
.app-card:hover .more .i { transform: translateX(3px); }
.card-links a { position: relative; z-index: 1; color: var(--muted); text-decoration: none; }
.card-links a:hover { color: var(--text); text-decoration: underline; }

/* ------------------------------------------------------------ spotlight and screenshots */

.spotlight { background: var(--surface-2); border-block: 1px solid var(--line); }
.spot-name { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 14px 0 12px; }
.spot-name .app-icon { width: 52px; height: 52px; }

.shots {
  display: flex; gap: clamp(14px, 2vw, 20px);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  margin-inline: calc(-1 * var(--gutter));
  padding: 4px var(--gutter) 20px;
  scroll-padding-inline: var(--gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.shots:focus-visible { outline-offset: -2px; }
.shots figure { margin: 0; flex: 0 0 auto; width: clamp(196px, 23vw, 248px); scroll-snap-align: start; }
.shots img { width: 100%; height: auto; aspect-ratio: 9 / 16; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); }
/* Desktop screenshots: wider, in their own proportions. */
.shots figure.wide { width: clamp(280px, 78vw, 640px); }
.shots figure.wide img { aspect-ratio: auto; border-radius: 12px; }
.shots figcaption { margin-top: 12px; text-align: center; font-size: .88rem; color: var(--muted); }

/* ------------------------------------------------------------ principles */

.principles { display: grid; gap: 32px 28px; }
/* As many equal columns as there are principles, stacked on phones. */
@media (min-width: 760px) { .principles { grid-auto-flow: column; grid-auto-columns: 1fr; } }
.principle { padding-top: 22px; border-top: 1px solid var(--line); }
.principle h3 { font-size: 1.08rem; margin-bottom: 8px; }
.principle p { color: var(--muted); font-size: .97rem; }
.p-ico { color: var(--text); margin-bottom: 16px; }
.p-ico .i { width: 24px; height: 24px; }

/* ------------------------------------------------------------ contact */

.contact-section { padding-top: 0; }
.cta {
  padding: clamp(36px, 6vw, 64px) var(--gutter);
  border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line);
  text-align: center;
}
.cta h2 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); letter-spacing: -.03em; }
.cta p { margin-top: 10px; color: var(--muted); }

/* ------------------------------------------------------------ app page */

.app-hero { padding: clamp(20px, 3vw, 32px) 0 clamp(40px, 6vw, 64px); text-align: center; }
.back { display: flex; width: fit-content; align-items: center; gap: 6px; margin-bottom: clamp(28px, 5vw, 48px); color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500; }
.back:hover { color: var(--text); }
.back .i { width: 16px; height: 16px; }
.app-head { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.app-head .app-icon.xl { width: clamp(84px, 12vw, 104px); height: auto; aspect-ratio: 1; margin-bottom: 8px; }
.app-head h1 { font-size: clamp(2.3rem, 5.6vw, 3.6rem); letter-spacing: -.04em; font-weight: 700; line-height: 1.05; }
.app-tagline { margin: clamp(20px, 3vw, 28px) auto 0; font-size: clamp(1.15rem, 2.2vw, 1.4rem); line-height: 1.4; font-weight: 500; max-width: 30em; text-wrap: balance; }
.app-desc { margin: 12px auto 0; color: var(--muted); max-width: 40em; }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; margin: 24px 0 0; padding: 0; color: var(--muted); font-size: .88rem; }
.chips li + li::before { content: "·"; margin-right: 10px; }
@media (max-width: 560px) {
  .chips { flex-direction: column; align-items: center; gap: 2px; }
  .chips li + li::before { content: none; }
}

.glance {
  display: grid; gap: clamp(24px, 4vw, 48px);
  padding: clamp(24px, 4vw, 40px);
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
}
@media (min-width: 880px) { .glance { grid-template-columns: minmax(240px, 320px) 1fr; } }
.glance-intro h2 { font-size: clamp(1.4rem, 2.6vw, 1.7rem); letter-spacing: -.025em; }
.glance-intro p { margin-top: 10px; color: var(--muted); }
.glance-intro .muted-note { font-size: .93rem; padding: 12px 14px; border-radius: var(--radius-s); background: var(--tint); margin-top: 18px; }
.link-strong { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.link-strong .i { width: 16px; height: 16px; }

.glance-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.glance-list li { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.glance-list li:first-child { border-top: 0; padding-top: 0; }
.g-ico { width: 34px; height: 34px; flex: none; border-radius: var(--radius-s); display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.g-ico .i { width: 18px; height: 18px; }
.g-net .g-ico { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.g-perm .g-ico { background: var(--tint); color: var(--muted); }
.g-kind { display: block; font-size: .74rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }

.features { display: grid; gap: 20px; }
@media (min-width: 680px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1040px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature { padding: 24px 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.feature h3 { font-size: 1.08rem; margin-bottom: 12px; display: flex; align-items: center; gap: 10px; }
.feature h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.feature ul { margin: 0; padding-left: 1.1em; display: grid; gap: 7px; color: var(--muted); font-size: .97rem; }
.feature li::marker { color: var(--line-strong); }

/* ------------------------------------------------------------ prose (privacy, imprint) */

.prose { max-width: calc(720px + 2 * var(--gutter)); padding-top: clamp(20px, 3vw, 32px); padding-bottom: clamp(56px, 8vw, 96px); }
.prose-app { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; font-weight: 600; color: var(--muted); }
.prose-app .app-icon { width: 40px; height: 40px; border-radius: 10px; }
.prose h1 { font-size: clamp(2.1rem, 5vw, 3rem); letter-spacing: -.035em; font-weight: 700; }
.prose .meta { margin-top: 12px; margin-bottom: 28px; color: var(--muted); font-size: .95rem; }
.prose h2 { margin: 44px 0 12px; padding-top: 28px; border-top: 1px solid var(--line); font-size: 1.3rem; letter-spacing: -.015em; }
.prose p, .prose ul, .prose address { margin: 0 0 14px; }
.prose ul { padding-left: 1.25em; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--muted); }
.prose address { font-style: normal; line-height: 1.7; }
.prose b, .prose strong { font-weight: 600; }

/* ------------------------------------------------------------ 404 */

.not-found { padding: clamp(56px, 10vw, 120px) 0; }
.big-404 { font-size: clamp(5rem, 18vw, 10rem); font-weight: 760; letter-spacing: -.06em; line-height: 1; color: var(--surface-2); -webkit-text-stroke: 1px var(--line-strong); }
.nf-grid { display: grid; gap: 32px; margin-top: 24px; }
@media (min-width: 760px) { .nf-grid { grid-template-columns: 1fr 1fr; } }
.nf-grid h2 { font-size: 1.6rem; }
.nf-grid p { margin-top: 10px; color: var(--muted); }
.nf-grid .btn { margin-top: 10px; }

/* ------------------------------------------------------------ footer */

.site-footer { border-top: 1px solid var(--line); padding: clamp(40px, 6vw, 64px) 0 28px; color: var(--muted); font-size: .94rem; }
.footer-grid { display: grid; gap: 32px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-brand p { margin-top: 12px; }
.site-footer h2 { font-size: .78rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--text); margin-bottom: 14px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer a:not(.brand) { color: var(--muted); text-decoration: none; }
.site-footer a:not(.brand):hover { color: var(--text); text-decoration: underline; }
.footer-base { margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--line); font-size: .86rem; }

/* App accents (generated from content/apps.mjs) */
.accent-local-gallery{--accent:#A3CBA6;--accent-soft:#1D2A1F}
.accent-song-player{--accent:#74E0B4;--accent-soft:#12281F}
