/* noelbennettz.github.io — the index of the projects, and the specimen page
   for the shared M3 contract in m3.css. Roles come from there; this file only
   seeds them (warm paper, ink primary) and lays the index out.

   Signature: an editorial paper index. No elevation, a serif for the
   emphasised half of the title, and each row runs on its project's own colour
   in the primary role. */

:root {
  color-scheme: light;

  --md-sys-color-primary: #141311;
  --md-sys-color-on-primary: #f6f3ea;
  --md-sys-color-surface: #f4f2ec;
  --md-sys-color-surface-container-low: #efece2;
  --md-sys-color-surface-container: #e7e2d4;
  --md-sys-color-surface-container-high: #ded8c7;
  --md-sys-color-on-surface: #141311;
  --md-sys-color-on-surface-variant: #5b5649;
  --md-sys-color-outline: #6d685e;
  --md-sys-color-outline-variant: #d7d0c1;

  /* Old names are aliases of the roles, so nothing below had to be rewritten. */
  --paper: var(--md-sys-color-surface);
  --paper-2: var(--md-sys-color-surface-container-low);
  --ink: var(--md-sys-color-on-surface);
  --muted: var(--md-sys-color-on-surface-variant);
  --dim: var(--md-sys-color-on-surface-variant);
  --rule: var(--md-sys-color-outline-variant);

  --max: 1120px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Noto Sans TC", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia,
    "Noto Serif TC", "Noto Sans TC", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --md-sys-color-primary: #ece9e1;
  --md-sys-color-on-primary: #141311;
  --md-sys-color-surface: #0e0e10;
  --md-sys-color-surface-container-low: #16161a;
  --md-sys-color-surface-container: #1c1c21;
  --md-sys-color-surface-container-high: #232329;
  --md-sys-color-on-surface: #ece9e1;
  --md-sys-color-on-surface-variant: #a8a49a;
  --md-sys-color-outline: #8a8780;
  --md-sys-color-outline-variant: #2c2c31;
}

/* The index is neutral; every project is a primary colour. The role is scoped
   to the row, so the number, the focus ring and the hover state follow it. */
.entry.hy2 { --md-sys-color-primary: #456b00; --accent: var(--md-sys-color-primary); }
.entry.amnezia { --md-sys-color-primary: #9a4300; --accent: var(--md-sys-color-primary); }
.entry.imail { --md-sys-color-primary: #1a52b8; --accent: var(--md-sys-color-primary); }
.entry.flownotes { --md-sys-color-primary: #44566c; --accent: var(--md-sys-color-primary); }
:root[data-theme="dark"] .entry.hy2 { --md-sys-color-primary: #b6e34a; }
:root[data-theme="dark"] .entry.amnezia { --md-sys-color-primary: #ff9a4d; }
:root[data-theme="dark"] .entry.imail { --md-sys-color-primary: #7aa7ff; }
:root[data-theme="dark"] .entry.flownotes { --md-sys-color-primary: #b9cde3; }
/* Two rows have no page of their own and point straight at the repository, so
   they carry no screenshot; their colour still follows the row. */
.entry.headscale { --md-sys-color-primary: #6a3fbf; --accent: var(--md-sys-color-primary); }
.entry.openwrt { --md-sys-color-primary: #0e6b66; --accent: var(--md-sys-color-primary); }
:root[data-theme="dark"] .entry.headscale { --md-sys-color-primary: #c3a7ff; }
:root[data-theme="dark"] .entry.openwrt { --md-sys-color-primary: #7fd6cd; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--md-sys-color-surface);
  color: var(--md-sys-color-on-surface);
  font-family: var(--sans);
  font-size: var(--md-sys-type-body-size);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container {
  width: min(100% - 48px, var(--max));
  margin-inline: auto;
}

/* Top app bar */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--md-sys-color-surface) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--md-sys-type-label-lg-size);
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand img { width: 24px; height: 24px; }
.brand span {
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--mono);
  font-size: var(--md-sys-type-label-sm-size);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: var(--md-sys-type-label-lg-size);
  font-weight: 500;
}
.nav a {
  padding: 8px 4px;
  color: var(--md-sys-color-on-surface-variant);
  transition: color var(--md-sys-motion-short) var(--md-sys-easing-standard);
}
.nav a:hover { color: var(--md-sys-color-on-surface); }

/* Intro */

.intro {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 56px;
  align-items: end;
  padding: 64px 0 44px;
}
.kicker {
  margin: 0 0 18px;
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--mono);
  font-size: var(--md-sys-type-label-sm-size);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.kicker b {
  color: var(--md-sys-color-primary);
  font-weight: 500;
}
h1 {
  margin: 0;
  max-width: 700px;
  font-size: var(--md-sys-type-display-size);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.045em;
}
h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
}
.lede {
  margin: 0;
  padding-bottom: 5px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.98rem;
}

@media (max-width: 820px) {
  .intro { grid-template-columns: 1fr; gap: 20px; padding-top: 44px; }
}

/* Index: one grouped M3 list. Rows are list items, not cards — the group is
   the surface, and the hover state is the row's own colour. */

.list {
  margin-bottom: 48px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-xl);
  background: var(--md-sys-color-surface-container-low);
  overflow: hidden;
}
.list-head,
.entry {
  display: grid;
  grid-template-columns: 44px 1fr 150px 180px 24px;
  gap: 22px;
  align-items: center;
  padding-inline: 24px;
}
.list-head {
  padding-block: 12px;
  border-bottom: 1px solid var(--md-sys-color-outline-variant);
  background: var(--md-sys-color-surface-container);
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--mono);
  font-size: var(--md-sys-type-label-sm-size);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.entry {
  padding-block: 22px;
  transition: background-color var(--md-sys-motion-short) var(--md-sys-easing-standard);
}
.entry + .entry { border-top: 1px solid var(--md-sys-color-outline-variant); }
.entry:hover {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}
.entry:active {
  background-color: color-mix(in srgb, var(--md-sys-color-primary) 12%, transparent);
}
/* A repository-only row has no screenshot, so the fourth cell carries the
   repository path instead of an image. The columns stay where the header puts
   them, which is why these rows need no grid of their own. */
.repo {
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--mono);
  font-size: var(--md-sys-type-label-sm-size);
  line-height: 1.6;
  letter-spacing: 0.02em;
  overflow-wrap: break-word;
}

.num {
  color: var(--accent);
  font-family: var(--mono);
  font-size: var(--md-sys-type-label-sm-size);
  letter-spacing: 0.08em;
}
.copy h2 {
  margin: 0 0 4px;
  font-size: var(--md-sys-type-title-size);
  font-weight: 600;
  letter-spacing: -0.02em;
}
.copy p {
  margin: 0;
  max-width: 520px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.88rem;
}
.copy code {
  font-family: var(--mono);
  font-size: 0.94em;
}
.stack {
  color: var(--md-sys-color-on-surface-variant);
  font-family: var(--mono);
  font-size: var(--md-sys-type-label-sm-size);
  line-height: 1.9;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.shot {
  width: 180px;
  height: 108px;
  border: 1px solid var(--md-sys-color-outline-variant);
  border-radius: var(--md-sys-shape-md);
  background: var(--md-sys-color-surface-container-high);
  overflow: hidden;
  transition: border-color var(--md-sys-motion-short) var(--md-sys-easing-standard);
}
.shot.portrait {
  width: 70px;
  height: 108px;
  justify-self: start;
}
.shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform var(--md-sys-motion-medium) var(--md-sys-easing-emphasized);
}
.shot.portrait img { object-fit: contain; }
.entry:hover .shot { border-color: var(--accent); }
.entry:hover .shot img { transform: scale(1.025); }
.shot img.pos-phone { object-position: center 22%; }
.shot img.pos-dash { object-position: center 40%; }
.shot img.pos-login { object-position: center 50%; }
.shot img.pos-note { object-position: center 30%; }
.arrow {
  justify-self: end;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 1.1rem;
  transition: color var(--md-sys-motion-short) var(--md-sys-easing-standard),
    transform var(--md-sys-motion-short) var(--md-sys-easing-standard);
}
.entry:hover .arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--md-sys-color-outline-variant);
  padding: 28px 0 48px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.82rem;
}
.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px 40px;
}
.site-footer p { margin: 0; max-width: 560px; }

/* About: the index look, one narrow column of prose. Kept here rather than in a
   second stylesheet so it inherits the palette and the contrast checks. */

.about-head { grid-template-columns: 1fr; padding-bottom: 8px; }
.prose {
  width: min(100% - 48px, var(--max));
  margin: 16px auto 72px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 1rem;
  line-height: 1.7;
}
/* Paragraphs start on the same left edge as the heading, but keep a measure
   that is comfortable to read. */
.prose p { margin: 0 0 1.1em; max-width: 40rem; }
.prose a {
  color: var(--md-sys-color-on-surface);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.prose a:hover { color: var(--md-sys-color-primary); }
.prose code {
  font-family: var(--mono);
  font-size: 0.92em;
}

@media (max-width: 1020px) {
  .list-head, .entry { grid-template-columns: 36px 1fr 160px 22px; }
  /* The stack cells are gone and the fourth column is now the screenshot, so
     its heading would sit over the wrong column. */
  .list-head .h-stack, .list-head .h-site { display: none; }
  .stack { display: none; }
  .shot { width: 160px; height: 96px; }
}
@media (max-width: 760px) {
  .list-head, .entry { grid-template-columns: 28px 1fr 120px 20px; gap: 14px; }
  .shot { width: 120px; height: 76px; }
  .shot.portrait { width: 54px; height: 76px; }
  .copy h2 { font-size: 1.15rem; }
  .copy p { font-size: 0.84rem; }
  .site-footer .container { display: block; }
}
@media (max-width: 520px) {
  .container { width: min(100% - 32px, var(--max)); }
  .prose { width: min(100% - 32px, 40rem); }
  .brand span { display: none; }
  .nav {
    flex-wrap: nowrap;
    gap: 12px;
    font-size: var(--md-sys-type-label-md-size);
  }
  .nav a { white-space: nowrap; }
  .nav .lang,
  .theme-toggle {
    min-height: 34px;
    padding: 0 11px;
    font-size: var(--md-sys-type-label-sm-size);
    letter-spacing: 0;
  }
  .list-head { display: none; }
  .list { border-radius: var(--md-sys-shape-lg); }
  .list-head, .entry { padding-inline: 16px; }
  .entry {
    grid-template-columns: 24px 1fr 60px 18px;
    gap: 10px;
    padding-block: 18px;
    align-items: start;
  }
  .entry.noshot { grid-template-columns: 24px 1fr 18px; }
  .repo { display: none; }
  .num { padding-top: 3px; }
  .arrow { padding-top: 1px; }
  .shot { width: 60px; height: 40px; }
  .shot.portrait { width: 44px; height: 64px; }
  .copy h2 { font-size: 1.05rem; }
  .copy p { font-size: 0.78rem; line-height: 1.45; }
  h1 { font-size: clamp(2rem, 10vw, 2.6rem); }
}

