/* phucngu.dev — terminal-flavoured, but built to be read. */

:root {
  --bg:        #0b0f0e;
  --bg-raised: #111716;
  --rule:      #1e2927;
  --text:      #c7d3cf;
  --text-dim:  #74857f;
  --heading:   #eaf2ef;
  --accent:    #4ade9b;
  --accent-2:  #58b7c9;
  --amber:     #e3b341;
  --shadow:    0 1px 0 rgba(255,255,255,.03), 0 18px 40px -24px rgba(0,0,0,.8);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo,
          Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  --bg:        #f7f8f6;
  --bg-raised: #ffffff;
  --rule:      #e0e4df;
  --text:      #3c4a45;
  --text-dim:  #7c8a84;
  --heading:   #16211d;
  --accent:    #16915b;
  --accent-2:  #1c7f92;
  --amber:     #9a6f10;
  --shadow:    0 1px 0 rgba(0,0,0,.02), 0 14px 32px -26px rgba(0,0,0,.45);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg:        #f7f8f6;
    --bg-raised: #ffffff;
    --rule:      #e0e4df;
    --text:      #3c4a45;
    --text-dim:  #7c8a84;
    --heading:   #16211d;
    --accent:    #16915b;
    --accent-2:  #1c7f92;
    --amber:     #9a6f10;
    --shadow:    0 1px 0 rgba(0,0,0,.02), 0 14px 32px -26px rgba(0,0,0,.45);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.75;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  /* faint scanline-free grid: just a soft glow behind the fold */
  background-image: radial-gradient(1100px 420px at 50% -12%,
                    color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
  background-repeat: no-repeat;
}

main {
  max-width: 46rem;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1.15rem, 4vw, 2rem) 4rem;
}

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

/* ── prompt lines ─────────────────────────────────────────── */

.line {
  margin: 3.25rem 0 .85rem;
  color: var(--text-dim);
  font-size: .875rem;
}
.hero .line { margin-top: 1.75rem; }
.prompt { color: var(--accent); }
.prompt::after { content: " $"; color: var(--text-dim); }
.cmd { color: var(--heading); }

/* ── hero ─────────────────────────────────────────────────── */

.hero {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--bg-raised);
  box-shadow: var(--shadow);
  padding: 0 clamp(1.1rem, 3.5vw, 1.9rem) clamp(1.5rem, 4vw, 2rem);
  overflow: hidden;
}

.titlebar {
  display: flex;
  align-items: center;
  gap: .45rem;
  margin: 0 clamp(-1.9rem, -3.5vw, -1.1rem) 0;
  padding: .6rem clamp(1.1rem, 3.5vw, 1.9rem);
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--rule) 35%, transparent);
}
.dot { width: .62rem; height: .62rem; border-radius: 50%; display: block; }
.dot-a { background: #ff5f57; }
.dot-b { background: #febc2e; }
.dot-c { background: #28c840; }
.titlebar-name {
  margin-left: auto;
  font-size: .72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

h1 {
  margin: .1rem 0 .55rem;
  font-size: clamp(1.85rem, 6.5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--heading);
  font-weight: 700;
}

.tagline {
  margin: 0;
  color: var(--text);
  font-size: clamp(.95rem, 2.7vw, 1.05rem);
  min-height: 3.4em;
}
@media (min-width: 34rem) { .tagline { min-height: 1.75em; } }

.cursor {
  display: inline-block;
  width: .55em;
  height: 1.05em;
  margin-left: .12em;
  vertical-align: -0.18em;
  background: var(--accent);
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── prose ────────────────────────────────────────────────── */

.prose p { margin: 0 0 1.05rem; max-width: 40rem; }
.prose p:last-child { margin-bottom: 0; }
.prose em { color: var(--heading); font-style: normal; border-bottom: 1px dashed var(--accent-2); }

/* ── projects ─────────────────────────────────────────────── */

.projects { list-style: none; margin: 0; padding: 0; }

.project + .project { margin-top: .55rem; }

.project a {
  display: block;
  padding: .95rem 1.05rem;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-raised);
  color: inherit;
  text-decoration: none;
  transition: border-color .16s ease, transform .16s ease, background-color .16s ease;
}
.project a:hover,
.project a:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--rule));
  transform: translateX(3px);
  outline: none;
}
.project a:focus-visible { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent); }

.p-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .55rem;
  margin-bottom: .3rem;
}
.p-name {
  color: var(--heading);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.project a:hover .p-name { color: var(--accent); }
.p-name::before { content: "./"; color: var(--text-dim); font-weight: 400; }

.p-lang {
  font-size: .72rem;
  padding: .05rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--text-dim);
}
.p-lang[data-lang="swift"] { color: #f0845c; }
.p-lang[data-lang="kotlin"] { color: #a97bff; }
.p-lang[data-lang="c"]      { color: var(--accent-2); }
.p-lang[data-lang="js"]     { color: var(--amber); }
.p-lang[data-lang="shell"]  { color: var(--accent); }
.p-lang[data-lang="ts"]     { color: #4f9bd9; }

.p-status {
  font-size: .72rem;
  color: var(--amber);
}
.p-status::before { content: "● "; font-size: .7em; vertical-align: .15em; }

.p-note {
  font-size: .72rem;
  color: var(--text-dim);
}
.p-note::before { content: "⑂ "; }

.p-desc {
  display: block;
  color: var(--text-dim);
  font-size: .875rem;
  max-width: 40rem;
}
.p-desc code {
  color: var(--accent-2);
  font-size: .95em;
}
.p-desc em { font-style: italic; color: var(--text); }

.more { margin: 1.1rem 0 0; font-size: .875rem; }

/* ── now + contact ────────────────────────────────────────── */

.now { list-style: none; margin: 0; padding: 0; }
.now li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: .5rem;
  color: var(--text-dim);
  font-size: .9rem;
  max-width: 40rem;
}
.now li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.contact { list-style: none; margin: 0; padding: 0; }
.contact li {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  margin-bottom: .35rem;
}
.contact .k {
  color: var(--text-dim);
  font-size: .8rem;
  min-width: 4.25rem;
}
.contact .k::after { content: ":"; }

/* ── links ────────────────────────────────────────────────── */

a { color: var(--accent); }
.prose a, .now a, .contact a, .more a {
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color .15s ease, color .15s ease;
}
.prose a:hover, .now a:hover, .contact a:hover, .more a:hover {
  border-bottom-color: var(--accent);
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── footer ───────────────────────────────────────────────── */

footer { margin-top: 1rem; }
footer .line { margin-bottom: .5rem; }
.fine {
  margin: 0;
  color: var(--text-dim);
  font-size: .78rem;
}

/* ── theme toggle ─────────────────────────────────────────── */

#theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  width: 2.35rem;
  height: 2.35rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg-raised);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: .95rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
#theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
#theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 30rem) {
  #theme-toggle { top: .6rem; right: .6rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
