/* ametrien.dev: a quiet dark page, one blue accent, serif headings,
   hairlines instead of boxes. */

:root {
  --bg: #131417;
  --surface: #1a1b1f;
  --text: #ebe9e4;
  --body: #cfccc5;
  --muted: #9d9a93;
  --faint: #77756f;
  --rule: #2a2b30;
  --rule-strong: #3a3b41;
  --accent: #8fb0ec;
  --accent-deep: #2f5596;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --radius: 10px; /* the same rounding as the SAI picture */

  /* Fonts already on the visitor's device: nothing is downloaded. */
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Hiragino Sans", "Noto Sans JP", "Yu Gothic", Meiryo, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(143, 176, 236, 0.18); color: var(--text); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--serif); color: var(--text); font-weight: 600; letter-spacing: -0.01em; margin: 0; }

.wrap { max-width: 72rem; margin: 0 auto; padding: 0 2rem; }
@media (max-width: 640px) { .wrap { padding: 0 1.25rem; } }

.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 10; background: var(--surface); padding: 0.5rem 0.75rem; }

/* Links: an underline that draws in from the left. */
.line {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  padding-bottom: 1px;
  transition: background-size 0.35s var(--ease), color 0.25s ease;
}
.line:hover, .line:focus-visible { background-size: 100% 1px; color: var(--accent); }

/* Running head */
.top {
  position: sticky; top: 0; z-index: 5;
  background: rgba(19, 20, 23, 0.94);
  border-bottom: 1px solid var(--rule);
}
.top-row { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; }
.top-name { font-family: var(--serif); font-weight: 600; color: var(--text); text-decoration: none; font-size: 1.1rem; }
.top-name:hover { color: var(--accent); }
.top nav { display: flex; gap: 1.5rem; font-size: 0.95rem; color: var(--muted); }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: end;
  min-height: 78vh;
  padding-top: 4rem;
  padding-bottom: 4.5rem;
}
.hero h1 {
  font-size: clamp(3.4rem, 9vw, 6.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
  animation: rise 0.8s var(--ease) both;
}
.lede {
  font-size: 1.3rem; line-height: 1.5; color: var(--muted);
  max-width: 32rem; margin: 0 0 2.25rem;
  animation: rise 0.8s var(--ease) 0.12s both;
}
.hero-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0; color: var(--text); animation: rise 0.8s var(--ease) 0.24s both; }
.hero-art { margin: 0; animation: fade 1s var(--ease) 0.2s both; }
.hero-art img { width: 100%; max-width: 30rem; margin-left: auto; border: 1px solid var(--rule); border-radius: var(--radius); }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; min-height: 0; gap: 2.5rem; padding-top: 3rem; }
  .hero-art { order: -1; }
  .hero-art img { margin: 0; max-width: 22rem; }
}

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Sections */
.block { border-top: 1px solid var(--rule); padding-top: 3.5rem; padding-bottom: 4.5rem; }
.block-head { margin-bottom: 2.25rem; }
.block-head h2 { font-size: 1.9rem; }
.sub { margin: 0.35rem 0 0; color: var(--faint); font-size: 0.95rem; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 3rem; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; gap: 2rem; } }

.prose { max-width: 36rem; }
.prose p { margin: 0 0 1.1rem; }
.prose strong { color: var(--text); font-weight: 600; }

.ticks { list-style: none; padding: 0; margin: 0 0 1.4rem; }
.ticks li { position: relative; padding: 0.55rem 0 0.55rem 1.4rem; border-bottom: 1px solid var(--rule); }
.ticks li:first-child { border-top: 1px solid var(--rule); }
.ticks li::before { content: ""; position: absolute; left: 0; top: 1.15rem; width: 0.55rem; height: 1px; background: var(--accent); }

.note { color: var(--muted); font-size: 0.95rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; margin-top: 1.75rem !important; color: var(--text); }
.button {
  display: inline-block; text-decoration: none;
  background: var(--accent); color: #0f1726; font-weight: 600;
  padding: 0.6rem 1.1rem;
  transition: background-color 0.25s ease;
}
.button:hover { background: #a9c3f2; }
.ja { color: var(--faint); font-size: 0.95rem; margin-top: 1.75rem !important; }

.shot { margin: 0; }
.shot img { width: 100%; border: 1px solid var(--rule); }
.shot figcaption { margin-top: 0.6rem; font-size: 0.85rem; color: var(--faint); }

.also { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); max-width: 36rem; }
.also h3 { font-size: 1.2rem; margin-bottom: 0.4rem; }
.also p { margin: 0; }
.also a { color: var(--text); }
.fine { margin: 2.5rem 0 0; font-size: 0.85rem; color: var(--faint); }

/* Art */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 2rem 1.5rem; }
.art { margin: 0; }
.art button { all: unset; display: block; cursor: zoom-in; width: 100%; }
.art button:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }
.art img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 1px solid var(--rule); border-radius: var(--radius); transition: opacity 0.3s ease; }
.art button:hover img { opacity: 0.85; }
.art figcaption { margin-top: 0.6rem; display: flex; justify-content: space-between; gap: 1rem; font-size: 0.9rem; }
.art .title { color: var(--text); }
.art time { color: var(--faint); white-space: nowrap; }
.art .tl { display: inline-block; margin-top: 0.35rem; font-size: 0.9rem; color: var(--accent); }
.art .tl::before { content: "▶"; font-size: 0.7em; margin-right: 0.45em; position: relative; top: -0.1em; }

/* Full-size viewer */
.viewer {
  border: 0; padding: 0; background: transparent; color: var(--body);
  max-width: min(92vw, 70rem); max-height: 92vh;
}
.viewer::backdrop { background: rgba(10, 10, 12, 0.92); }
.viewer img, .viewer video { display: block; max-width: 100%; max-height: calc(92vh - 3rem); width: auto; margin: 0 auto; }
.viewer [hidden] { display: none; }
.viewer-caption { margin: 0.75rem 0 0; text-align: center; font-size: 0.9rem; color: var(--muted); }
.viewer-close {
  position: fixed; top: 1rem; right: 1.25rem;
  background: none; border: 0; color: var(--text); font-size: 2rem; line-height: 1; cursor: pointer;
}
.viewer-close:hover { color: var(--accent); }

/* On X: plain text cards until the visitor asks for X's own */
/* One row that scrolls sideways, cards snapping into place */
.posts {
  display: flex; gap: 1.25rem; align-items: flex-start;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; scroll-padding-left: 0;
  padding-bottom: 0.75rem; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
}
.posts > * { flex: 0 0 min(22rem, 84vw); scroll-snap-align: start; }
.posts::-webkit-scrollbar { height: 6px; }
.posts::-webkit-scrollbar-thumb { background: var(--rule-strong); border-radius: 3px; }
.posts-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; }
.posts-arrows { display: flex; gap: 0.5rem; }
.posts-arrows button {
  font: inherit; font-size: 1.1rem; line-height: 1; color: var(--muted); cursor: pointer;
  background: none; border: 1px solid var(--rule-strong); width: 2.4rem; height: 2.4rem; border-radius: 50%;
  transition: border-color 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}
.posts-arrows button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.posts-arrows button:disabled { opacity: 0.35; cursor: default; }
@media (hover: none) { .posts-arrows { display: none; } }
.post {
  margin: 0; padding: 1.1rem 1.25rem; border-radius: 12px;
  border: 1px solid var(--rule); background: var(--surface);
  color: var(--body); font-size: 1rem; line-height: 1.55;
}
.post p { margin: 0; overflow-wrap: anywhere; }
.post a { color: var(--accent); text-decoration: none; }
.post a:hover { text-decoration: underline; text-underline-offset: 3px; }
.post .post-meta { display: flex; justify-content: space-between; gap: 1rem; margin-top: 0.9rem; padding-top: 0.7rem; border-top: 1px solid var(--rule); font-size: 0.85rem; }
.post .post-meta a { color: var(--faint); margin-left: auto; }
.post .post-meta a:hover { color: var(--text); }
.post-pic { color: var(--faint); }
.post-pic::before { content: "▣"; margin-right: 0.4em; }
/* X's cards, once loaded */
.posts .twitter-tweet-rendered { margin: 0 !important; width: auto !important; }
.posts .twitter-tweet-rendered iframe { width: 100% !important; }
/* X's card is a light page painted dark. If its frame inherits the page's
   dark scheme, the browser paints the frame white behind the card's rounded
   corners. Same scheme as the card means a clear frame; the radius clips the rest. */
.posts iframe { color-scheme: light; border-radius: 12px; }

.posts-load { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin: 1.75rem 0 0; font-size: 0.85rem; color: var(--faint); }
.posts-load[hidden] { display: none; }
.button-quiet {
  font: inherit; font-size: 0.95rem; color: var(--text); cursor: pointer;
  background: none; border: 1px solid var(--rule-strong); padding: 0.5rem 1rem;
  transition: border-color 0.25s ease, color 0.25s ease;
}
.button-quiet:hover { border-color: var(--accent); color: var(--accent); }
.button-quiet:disabled { cursor: default; opacity: 0.6; }

/* Links */
.link-list { list-style: none; padding: 0; margin: 0; max-width: 36rem; }
.link-list li { display: flex; gap: 1.5rem; align-items: baseline; padding: 0.8rem 0; border-bottom: 1px solid var(--rule); }
.link-list li:first-child { border-top: 1px solid var(--rule); }
.link-list a { color: var(--text); min-width: 5rem; font-weight: 600; }
.link-list span { color: var(--muted); }

.foot { border-top: 1px solid var(--rule); padding-top: 1.5rem; padding-bottom: 2.5rem; font-size: 0.85rem; color: var(--faint); }
.foot { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.foot p { margin: 0; }
.foot-link { font: inherit; color: var(--faint); background: none; border: 0; padding: 0; cursor: pointer; }
.foot-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* Cookie question: a flat panel with a hairline, both answers the same weight */
.consent {
  position: fixed; z-index: 20; left: 1rem; right: 1rem; bottom: 1rem;
  max-width: 34rem; margin-left: auto;
  background: var(--surface); border: 1px solid var(--rule-strong);
  padding: 1.1rem 1.25rem; font-size: 0.92rem; color: var(--body);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.consent[hidden] { display: none; }
.consent p { margin: 0 0 0.5rem; }
.consent .consent-ja { color: var(--faint); font-size: 0.85rem; }
.consent-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 0.9rem; }

/* Blocks fade up the first time they scroll in. Only once main.js has
   marked them, so without JS everything stays visible. */
.reveal { opacity: 0; transform: translateY(6px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .hero h1, .lede, .hero-links, .hero-art { animation: none; }
  .line { transition: none; }
}

/* ── Blog ─────────────────────────────────────────────────────────────── */
.blog-list { list-style: none; padding: 0; margin: 0; max-width: 46rem; }
.entry { display: grid; grid-template-columns: 7rem 1fr; gap: 0.25rem 1.5rem; padding: 1.1rem 0; border-bottom: 1px solid var(--rule); }
.entry:first-child { border-top: 1px solid var(--rule); }
.entry time { color: var(--faint); font-size: 0.9rem; padding-top: 0.2rem; }
.entry-title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; color: var(--text); text-decoration: none; }
.entry-title:hover { color: var(--accent); }
.entry-lang { margin-left: 0.6rem; font-size: 0.75rem; color: var(--faint); border: 1px solid var(--rule-strong); padding: 0.05rem 0.4rem; border-radius: 3px; vertical-align: 0.2em; }
.entry p { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 560px) { .entry { grid-template-columns: 1fr; } }
.blog-all { margin: 1.5rem 0 0; color: var(--text); }

.page { padding-top: 3.5rem; padding-bottom: 5rem; min-height: 70vh; }
.page-head h1 { font-size: clamp(2.4rem, 6vw, 3.4rem); }

.article { max-width: 42rem; margin: 0 auto; }
.crumb { margin: 0 0 1.5rem; font-size: 0.9rem; color: var(--muted); }
.article h1 { font-size: clamp(2.1rem, 5vw, 3rem); line-height: 1.1; letter-spacing: -0.02em; }
.article-info { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 1rem 0 2rem; color: var(--faint); font-size: 0.9rem; }
.tag { border: 1px solid var(--rule-strong); border-radius: 3px; padding: 0.05rem 0.45rem; font-size: 0.8rem; color: var(--muted); }
.article-cover { margin: 0 0 2.25rem; }
.article-cover img, .article-body figure img { width: 100%; border-radius: var(--radius); border: 1px solid var(--rule); }
.article-body { font-size: 1.08rem; line-height: 1.75; color: var(--body); }
.article-body > * { margin: 0 0 1.25rem; }
.article-body h2 { font-size: 1.6rem; margin-top: 2.5rem; }
.article-body h3 { font-size: 1.25rem; margin-top: 2rem; }
.article-body a { color: var(--accent); text-underline-offset: 3px; }
.article-body strong { color: var(--text); font-weight: 600; }
.article-body blockquote { margin-left: 0; padding-left: 1.25rem; border-left: 2px solid var(--accent); color: var(--muted); }
.article-body blockquote p { margin: 0; }
.article-body ul, .article-body ol { padding-left: 1.4rem; }
.article-body li { margin: 0.35rem 0; }
.article-body figure { margin: 2rem 0; }
.article-body figcaption { margin-top: 0.6rem; font-size: 0.85rem; color: var(--faint); text-align: center; }
.article-body code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: 0.05rem 0.35rem; }
.code { margin: 1.75rem 0; border: 1px solid var(--rule); border-radius: 8px; background: var(--surface); overflow: hidden; }
.code-name { font-size: 0.8rem; color: var(--faint); padding: 0.45rem 0.9rem; border-bottom: 1px solid var(--rule); }
.code pre { margin: 0; padding: 0.9rem 1rem; overflow-x: auto; font-size: 0.88rem; line-height: 1.6; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; }
.article-end { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); color: var(--text); }

/* Narrow screens: the menu stays on one line, and can scroll sideways if it must */
@media (max-width: 560px) {
  .top-row { gap: 1rem; }
  .top-name { font-size: 1rem; flex: none; }
  .top nav { gap: 0.9rem; font-size: 0.88rem; white-space: nowrap; overflow-x: auto; scrollbar-width: none; }
  .top nav::-webkit-scrollbar { display: none; }
}
