/* style.css - baisyoukin.dev */

/* -- fonts -- */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/Inter-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/Inter-SemiBold.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/JetBrainsMono-Medium.woff2") format("woff2");
}

/* -- tokens -- */

:root {
  color-scheme: dark;

  /* Everforest Dark surfaces: calm green-grey layers instead of pure black */
  --bg: #272e33;
  --bg-surface: #2d353b;
  --bg-elevated: #343f44;

  /* Everforest foreground and neutral grey tones */
  --text: #d3c6aa;
  --text-dim: #a7b0a0;
  --muted: #859289;

  --line: #475258;
  --line-strong: #56635f;

  /* primary accent: Everforest green */
  --accent: #7FBBB3;
  --accent-dim: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 40%, transparent);
  --accent-glow: color-mix(in srgb, var(--accent) 18%, transparent);

  --font-display: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "SF Mono", ui-monospace, monospace;

  /* retro: hard corners everywhere */
  --radius: 0;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --fast: 0.18s var(--ease);
  --base: 0.28s var(--ease);
}

/* -- reset -- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* -- base -- */

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: clamp(14px, 0.28vw + 13.3px, 15.5px);
  line-height: 1.7;
  min-height: 100vh;
  padding: clamp(40px, 7vw, 88px) clamp(20px, 5vw, 40px) 72px;
  animation: fade-in 0.5s var(--ease) both;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
}

/* base link style so links outside a styled component are still readable */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-line);
  text-underline-offset: 3px;
  transition: color var(--fast), text-decoration-color var(--fast);
}

a:hover {
  color: var(--text);
  text-decoration-color: var(--accent);
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

::selection {
  background: rgba(167, 192, 128, 0.28);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -- layout -- */

.page {
  max-width: 940px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  grid-template-areas:
    "header header"
    "main   nav"
    "footer footer";
  column-gap: clamp(32px, 5vw, 56px);
}

header {
  grid-area: header;
  margin-bottom: clamp(36px, 6vw, 60px);
}

main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  gap: clamp(32px, 5vw, 52px);
}

nav {
  grid-area: nav;
}

.site-footer {
  grid-area: footer;
  margin-top: clamp(56px, 9vw, 96px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  transition: color var(--fast);
}

.site-footer a:hover {
  color: var(--accent);
}

/* -- header -- */

.name {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.2vw, 30px);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.025em;
  text-decoration: none;
  transition: color var(--base);
}

.name:hover {
  color: var(--accent);
}

.cursor {
  display: inline-block;
  width: 11px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  margin-left: 3px;
  animation: blink 1.2s step-end infinite;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.header-rule {
  border: none;
  height: 1px;
  margin-top: 18px;
  background: var(--line);
}

/* -- nav -- */

nav {
  position: sticky;
  top: clamp(40px, 7vw, 88px);
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 14px;
}

nav::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 1px;
  background: var(--line);
}

nav a {
  position: relative;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--fast), transform var(--fast);
}

nav a::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 1px;
  height: 0;
  background: var(--accent);
  transform: translateY(-50%);
  transition: height var(--base), background var(--base);
}

nav a:hover {
  color: var(--text);
}

nav a:hover::before {
  height: 100%;
  background: var(--muted);
}

nav a.active {
  color: var(--text);
}

nav a.active::before {
  height: 100%;
  box-shadow: 0 0 8px var(--accent-glow);
}

nav hr {
  border: none;
  border-top: 1px solid var(--line);
  width: 24px;
  margin: 2px 0;
}

/* -- section chrome -- */

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

/* retro double-ruled frame: hard corners, no gradients, no glow */
.panel {
  border: 1px double var(--line-strong);
  border-radius: var(--radius);
  outline: 1px solid var(--line-strong);
  outline-offset: 1px;
  background: var(--bg-surface);
  transition: border-color var(--base), outline-color var(--base);
}


.panel-row {
  position: relative;
  display: block;
  padding: 14px clamp(16px, 2.4vw, 22px);
  border-top: 1px solid var(--line);
  transition: background var(--base);
}

.panel-row:first-child {
  border-top: none;
}

.panel-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--base);
}


.panel-row:hover::before {
  opacity: 1;
}

.empty-state {
  padding: 22px clamp(16px, 2.4vw, 22px);
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}


/* -- home: intro -- */

.intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

/* neofetch-style card: ascii logo on the left, key/value info on the right */
.fetch {
  display: flex;
  align-items: flex-start;
  gap: clamp(20px, 4vw, 40px);
  width: 100%;
  padding: clamp(18px, 3vw, 28px) clamp(16px, 2.4vw, 26px);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.75;
}

/* The fetch content remains, while the enclosing background panel is hidden. */
.fetch.panel {
  background: transparent;
  border-color: transparent;
  outline-color: transparent;
}

.fetch-logo {
  flex-shrink: 0;
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.2;
  text-shadow: 0 0 12px var(--accent-glow);
}

/* neofetch "image source": the logo slot renders an image when one is present,
   with the ASCII art kept as a fallback for when it is absent or fails to load. */
.fetch-image {
  flex-shrink: 0;
  width: clamp(96px, 10vw, 140px);
  height: auto;
  border-radius: 12px;
  object-fit: contain;
}

/* When the image is present it owns the slot, so the ASCII art steps aside. */
.fetch-image + .fetch-logo {
  display: none;
}

/* site.js adds this class if the image fails to load; the ASCII returns. */
.fetch-image.is-broken {
  display: none;
}

.fetch-image.is-broken + .fetch-logo {
  display: block;
}

.fetch-info {
  min-width: 0;
}

.fetch-prompt {
  color: var(--muted);
}

.fetch-user {
  color: var(--accent);
  font-weight: 500;
}

.fetch-sep {
  color: var(--line-strong);
  overflow: hidden;
  white-space: nowrap;
}

.fetch-list > div {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.6ch;
}

.fetch-list dt {
  color: var(--accent);
  font-weight: 500;
}

.fetch-list dt::after {
  content: ":";
  color: var(--muted);
}

.fetch-list dd {
  color: var(--text-dim);
}

.fetch-colors {
  display: flex;
  margin-top: 14px;
}

.fetch-colors span {
  width: 22px;
  height: 14px;
}

.c-red { background: #e67e80; }
.c-orange { background: #e69875; }
.c-yellow { background: #dbbc7f; }
.c-green { background: #a7c080; }
.c-aqua { background: #83c092; }
.c-blue { background: #7fbbb3; }
.c-purple { background: #d699b6; }
.c-fg { background: var(--text); }

@media (max-width: 560px) {
  .fetch {
    flex-direction: column;
    gap: 16px;
  }

  .fetch-logo {
    font-size: 12px;
  }
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border: none;
  background: var(--bg-surface);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: color var(--fast), border-color var(--fast), background var(--fast);
}

.btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

/* -- notes -- */

.note-item {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 0 20px;
  align-items: baseline;
  color: inherit;
  text-decoration: none;
}

.note-date {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.note-title {
  color: var(--text);
  font-size: 14.5px;
  text-decoration: none;
  transition: color var(--base), text-shadow var(--base);
}

.note-item:hover .note-title {
  color: var(--accent);
  text-shadow: 0 0 14px var(--accent-glow);
}

.note-tag {
  display: inline-block;
  margin-left: 10px;
  padding: 1px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  vertical-align: 1px;
}

/* -- scroll reveal (only when scripting is available) -- */

/* Hiding is gated on scripting support: with JS off — or in a browser that does
   not understand this query — the content simply stays visible. */
@media (scripting: enabled) {
  .reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
    transition-delay: var(--d, 0s);
  }

  .reveal.visible {
    opacity: 1;
    transform: none;
  }
}

/* stagger helpers: kept in CSS so no inline style attribute is needed */
.reveal-delay-1 {
  --d: 0.06s;
}

.reveal-delay-2 {
  --d: 0.12s;
}

.reveal-delay-3 {
  --d: 0.18s;
}

.reveal-delay-4 {
  --d: 0.24s;
}

/* -- scrollbar -- */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: var(--radius);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* -- responsive -- */

@media (max-width: 720px) {
  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "nav"
      "main"
      "footer";
  }

  header {
    margin-bottom: 22px;
  }

  nav {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-left: 0;
    margin-bottom: 32px;
  }

  nav::before {
    display: none;
  }

  nav a {
    padding: 6px 14px;
    background: var(--bg-surface);
  }

  nav a:hover {
    transform: none;
  }

  nav a::before {
    display: none;
  }

  nav a.active {
    border-color: var(--accent-line);
    color: var(--accent);
    background: var(--accent-dim);
  }

  nav hr {
    display: none;
  }

  .note-item {
    grid-template-columns: 88px minmax(0, 1fr);
  }
}

/* -- home: tech stack marquee -- */

.stack {
  margin-top: clamp(24px, 4vw, 40px);
}

/* Fade the edges of the marquee only; the section title stays fully visible. */
.stack-viewport {
  overflow: hidden;
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

/* Two identical lists side by side; shifting by half loops seamlessly. */
.stack-track {
  display: flex;
  width: max-content;
  animation: stack-scroll 15s linear infinite;
}

.stack:hover .stack-track {
  animation-play-state: paused;
}

.stack-list {
  display: flex;
  gap: clamp(28px, 5vw, 48px);
  margin: 0;
  padding: 8px clamp(14px, 2.5vw, 24px);
  list-style: none;
}

.stack-list img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

@keyframes stack-scroll {
  to {
    transform: translateX(-50%);
  }
}

/* -- motion preferences -- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }

  .stack-viewport {
    mask-image: none;
  }

  .stack-track {
    width: auto;
    animation: none;
  }

  .stack-list {
    flex-wrap: wrap;
  }

  .stack-list[aria-hidden="true"] {
    display: none;
  }
}

/* -- feedback form -- */

.feedback-anon-note {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.feedback-panel {
  padding: clamp(20px, 3vw, 32px) clamp(16px, 2.4vw, 22px);
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.form-field input,
.form-field textarea {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  padding: 10px 14px;
  transition: border-color var(--fast), box-shadow var(--fast);
}

.form-field input::placeholder,
.form-field textarea::placeholder {
  color: var(--muted);
  opacity: 0.6;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
}

.form-field textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-submit {
  align-self: flex-start;
  cursor: pointer;
}

/* -- feedback thanks -- */

.feedback-status:empty {
  display: none;
}

.feedback-status {
  margin-top: 16px;
}

.feedback-thanks-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* -- feedback: validation + limits -- */

.form-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.feedback-error-text {
  font-family: var(--font-mono);
  font-size: 13px;
  color: #e69875;
  letter-spacing: 0.02em;
}

/* -- notes: list extras -- */

.note-draft {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 1px;
}

/* -- notes: single note -- */

.note-header {
  padding-bottom: 18px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.note-heading {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(20px, 2.6vw, 26px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  text-wrap: balance;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.note-meta-sep {
  color: var(--line-strong);
}

/* Prose is the one place text is meant to be selected and copied. */
.note-prose {
  user-select: text;
  max-width: 68ch;
}

.note-prose > * + * {
  margin-top: 1.1em;
}

.note-prose h2,
.note-prose h3 {
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.35;
  margin-top: 2em;
}

.note-prose h2 {
  font-size: 1.15rem;
}

.note-prose h3 {
  font-size: 1rem;
}

.note-prose p,
.note-prose li {
  color: var(--text-dim);
  line-height: 1.85;
  text-wrap: pretty;
}

.note-prose ul,
.note-prose ol {
  padding-left: 1.4em;
}

.note-prose li + li {
  margin-top: 0.35em;
}

.note-prose strong {
  color: var(--text);
  font-weight: 600;
}

.note-prose code {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 1px 5px;
}

.note-prose pre {
  overflow-x: auto;
  padding: 16px 18px;
  border: 1px double var(--line-strong);
  border-radius: var(--radius);
  outline: 1px solid var(--line-strong);
  outline-offset: 1px;
  background: var(--bg-surface);
}

.note-prose pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre;
}

.note-prose blockquote {
  padding-left: 16px;
  border-left: 1px solid var(--accent-line);
  color: var(--muted);
}

.note-prose hr {
  border: none;
  border-top: 1px solid var(--line);
}

.note-prose table {
  border-collapse: collapse;
  font-size: 13.5px;
  width: 100%;
}

.note-prose th,
.note-prose td {
  border: 1px solid var(--line);
  padding: 7px 12px;
  text-align: left;
}

.note-prose th {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.note-back {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.note-back a {
  text-decoration: none;
  color: var(--muted);
}

.note-back a:hover {
  color: var(--accent);
}
