/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #031e11;
  --bg-card: #042a18;
  --border: #0c4a2e;
  --text: #14f2fd;
  --text-dim: #0cb8c8;
  --text-bright: #80f0ff;
  --accent: #80f0ff;
  --accent-dim: #0a5a6a;
  --accent2: #ff6644;
  --accent3: #44bbff;
  --mono: 'VT323', 'SF Mono', 'Fira Code', Consolas, monospace;

  /* Tile palette */
  --tile-dark: rgba(0, 0, 0, 0.88);
  --tile-dark-border: rgba(40, 70, 50, 0.6);
  --tile-light: rgba(146, 212, 160, 0.45);
  --tile-light-hi: rgba(176, 232, 188, 0.45);
  --tile-light-lo: rgba(114, 184, 130, 0.45);
  --tile-light-text: #0a2010;
}

@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: #222;
  color: var(--text);
  font-family: var(--mono);
  font-size: 26px;
  line-height: 1.55;
  letter-spacing: 0.02em;
}

a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 2px solid var(--text);
  transition: color 0.15s, border-color 0.15s, text-shadow 0.15s;
}

a:hover, a:active, a:focus {
  color: #ff6644;
  border-bottom-color: #ff6644;
  text-shadow: 0 0 8px rgba(255, 102, 68, 0.6), 0 0 20px rgba(255, 102, 68, 0.2);
  background: transparent;
}

::selection {
  background: var(--accent);
  color: var(--bg);
}

/* === SCREEN: the green CRT area, scrollable === */
.screen {
  position: absolute;
  top: calc(2% + 1rem);
  left: calc(2% + 1rem);
  width: calc(96% - 2rem);
  height: calc(96% - 2rem);
  background-color: var(--bg);
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 2rem;
  z-index: 1;
}

/* Canvas sits behind content inside the screen — pixelated upscale */
#bg-canvas {
  position: fixed;
  top: calc(2% + 1rem);
  left: calc(2% + 1rem);
  width: calc(96% - 2rem);
  height: calc(96% - 2rem);
  z-index: 0;
  pointer-events: none;
  border-radius: 2rem;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity: 0.35;
}

.screen-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-shadow: none;
}


/* === CRT FRAME: overlays on top === */
.crt-frame {
  position: fixed;
  top: 2%;
  left: 2%;
  width: 96%;
  height: 96%;
  border-radius: 3rem;
  border: 1rem solid;
  border-bottom-color: #121212;
  border-left-color: #080808;
  border-right-color: #080808;
  border-top-color: #020202;
  box-shadow:
    inset 0 0 18rem black,
    inset 0 0 3rem black,
    0 0 10rem black;
  pointer-events: none;
  z-index: 10;
}

.crt-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 3rem;
  background: linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0),
    rgba(255, 255, 255, 0) 50%,
    rgba(0, 0, 0, 0.2) 70%,
    rgba(0, 0, 0, 0.6)
  );
  background-size: 100% 0.3rem;
  pointer-events: none;
}

.crt-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 3rem;
  background: radial-gradient(
    circle at center,
    #1bd459 0%,
    rgba(27, 212, 89, 0.88) 58%,
    rgba(21, 235, 92, 0.57) 80%,
    rgba(19, 94, 29, 0.27) 93%,
    rgba(10, 23, 12, 0) 100%
  );
  opacity: 0.15;
  pointer-events: none;
}

/* === TILE SYSTEM === */
/* Beveled tile border mixin via shared properties */

/* Base tile: light green backdrop for dark text (content sections) */
.tile {
  background: var(--tile-light);
  color: var(--tile-light-text);
  text-shadow: none;
  border: 3px solid;
  border-top-color: var(--tile-light-hi);
  border-left-color: var(--tile-light-hi);
  border-right-color: var(--tile-light-lo);
  border-bottom-color: var(--tile-light-lo);
  padding: 24px;
  box-shadow:
    inset 1px 1px 0 rgba(255, 255, 255, 0.2),
    inset -1px -1px 0 rgba(0, 0, 0, 0.1);
}

/* Header tile: transparent, just content */
.tile--inv {
  background: transparent;
  color: var(--text);
  text-shadow: 0 0 8px rgba(20, 242, 253, 0.6), 0 0 2px rgba(20, 242, 253, 0.9);
  border: none;
  box-shadow: none;
}

/* === HEADER === */
header {
  margin-bottom: 0;
}

.header-top {
  display: flex;
  align-items: center;
  gap: 24px;
}

.ascii-logo {
  font-size: 10px;
  line-height: 1.1;
  color: var(--tile-light-text);
  text-shadow: none;
  margin-bottom: 20px;
  user-select: none;
  font-family: var(--mono);
}

.name {
  font-family: var(--mono);
  font-size: 3.5rem;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 0;
}

.tagline {
  color: #5a6a5e;
  text-shadow: none;
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: none;
}

/* Portrait photo */
.portrait {
  width: 140px;
  flex-shrink: 0;
  border: 3px solid var(--tile-dark-border);
}

.header-right {
  flex: 1;
  min-width: 0;
}

nav {
  margin-top: 0.5rem;
  display: flex;
  gap: 0;
  flex-wrap: wrap;
}

nav a {
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 16px;
  background: rgba(0, 0, 0, 0.5);
  border: 2px solid;
  border-top-color: var(--tile-dark-border);
  border-left-color: var(--tile-dark-border);
  border-right-color: rgba(20, 40, 30, 0.6);
  border-bottom-color: rgba(20, 40, 30, 0.6);
  transition: all 0.15s;
}

nav a:hover {
  background: #ff6644;
  color: #fff;
  border-top-color: rgba(20, 40, 30, 0.6);
  border-left-color: rgba(20, 40, 30, 0.6);
  border-right-color: var(--tile-dark-border);
  border-bottom-color: var(--tile-dark-border);
  text-shadow: none;
}

/* === SECTIONS === */
.section {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-title {
  font-size: 28px;
  font-weight: 400;
  color: #ff6644;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(255, 102, 68, 0.6), 0 0 2px rgba(255, 102, 68, 0.9);
  margin-bottom: 0;
  padding: 14px 24px;
  border-bottom: none;
  background: transparent;
  border: none;
}

.prompt {
  color: #ff6644;
  margin-right: 8px;
}

/* Section content: dark opaque tile backdrop for blue text */
.section-content {
  background: var(--tile-dark);
  border: 3px solid var(--tile-dark-border);
  padding: 24px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-content p {
  margin-bottom: 0;
  max-width: 80ch;
}

.section-content > p {
  padding: 16px 20px;
  border: none;
}

.section-content > p a {
  color: var(--text);
  border-bottom: 2px solid var(--text);
}

.section-content > p a:hover {
  color: #ff6644;
  border-bottom-color: #ff6644;
  text-shadow: 0 0 8px rgba(255, 102, 68, 0.6);
  background: transparent;
}

/* === PUBLICATION CARDS === */
.pub-card {
  display: block;
  border: 1px solid var(--tile-dark-border);
  padding: 20px 24px;
  margin-bottom: 0;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.pub-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent3), var(--accent2));
  opacity: 0;
  transition: opacity 0.3s;
}

.pub-card:hover {
  border-color: #ff6644;
  transform: translateY(-2px);
  box-shadow: 0 4px 30px rgba(255, 102, 68, 0.12);
}

.pub-card:hover::before {
  opacity: 1;
  background: linear-gradient(90deg, #ff6644, var(--accent3), var(--accent));
}

.pub-year {
  display: inline-block;
  font-size: 18px;
  color: var(--text);
  background: var(--tile-dark);
  text-shadow: 0 0 8px rgba(20, 242, 253, 0.6);
  padding: 2px 8px;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.pub-card:hover .pub-year {
  background: #ff6644;
  color: #fff;
}

.pub-title {
  display: block;
  font-size: 22px;
  color: var(--text-bright);
  line-height: 1.35;
  margin-bottom: 6px;
  border-bottom: none;
  transition: color 0.15s, text-shadow 0.15s;
}

.pub-card:hover .pub-title {
  color: #ff6644;
  text-shadow: 0 0 8px rgba(255, 102, 68, 0.4);
}

.pub-authors {
  display: block;
  font-size: 16px;
  color: var(--text-bright);
  line-height: 1.3;
  margin-bottom: 6px;
}

.pub-blurb {
  display: block;
  font-size: 20px;
  color: var(--text);
  line-height: 1.4;
}

.pub-note {
  color: var(--text-dim);
  font-size: 18px;
  margin-top: 12px;
}

.blink {
  animation: blink 0.5s linear infinite;
  color: #ff6644;
}

@keyframes blink {
  50% { opacity: 0; }
}

.terminal-cursor {
  margin-top: 0;
  font-size: 28px;
  background: transparent;
  border: none;
  padding: 12px 24px;
}

/* === WRITING === */
.writing-card {
  display: block;
  border: 1px solid var(--tile-dark-border);
  padding: 24px;
  transition: all 0.15s;
  position: relative;
  overflow: hidden;
}

.writing-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent3), var(--accent2));
  opacity: 0;
  transition: opacity 0.3s;
}

.writing-card:hover {
  border-color: #ff6644;
  transform: translateY(-2px);
  box-shadow: 0 4px 30px rgba(255, 102, 68, 0.12);
}

.writing-card:hover::before {
  opacity: 1;
  background: linear-gradient(90deg, #ff6644, var(--accent3), var(--accent));
}

.writing-source {
  display: inline-block;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text);
  background: var(--tile-dark);
  text-shadow: 0 0 8px rgba(20, 242, 253, 0.6);
  padding: 2px 8px;
  margin-bottom: 8px;
}

.writing-title {
  display: block;
  font-size: 22px;
  font-weight: 400;
  color: var(--text-bright);
  margin-bottom: 8px;
  line-height: 1.35;
}

.writing-card:hover .writing-title {
  color: #ff6644;
  text-shadow: 0 0 8px rgba(255, 102, 68, 0.4);
}

.writing-card:hover .writing-source {
  background: #ff6644;
  color: #fff;
}

.writing-desc {
  display: block;
  font-size: 20px;
  color: var(--text);
  line-height: 1.4;
}

/* === LINKS GRID === */
.links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}

.link-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--tile-dark);
  border: 1px solid var(--tile-dark-border);
  padding: 14px 18px;
  transition: all 0.15s;
}

.link-card:hover {
  border-color: #ff6644;
  box-shadow: 0 0 12px rgba(255, 102, 68, 0.2);
}

.link-icon {
  font-size: 24px;
  color: var(--accent);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.15s;
}

.link-card:hover .link-icon {
  color: #ff6644;
}

.link-label {
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0.03em;
  transition: color 0.15s;
}

.link-card:hover .link-label {
  color: #ff6644;
  text-shadow: 0 0 6px rgba(255, 102, 68, 0.4);
}

/* === FOOTER === */
footer {
  margin-top: 0;
}

.footer-line {
  display: none;
}

footer p {
  font-size: 16px;
  color: var(--text-dim);
  text-align: center;
  background: var(--tile-dark);
  border: 3px solid var(--tile-dark-border);
  padding: 12px 24px;
}

/* === RESPONSIVE === */
@media (max-width: 700px) {
  body {
    font-size: 18px;
    line-height: 1.45;
  }

  .screen {
    top: 1%;
    left: 1%;
    width: 98%;
    height: 98%;
    border-radius: 1rem;
  }

  #bg-canvas {
    top: 1%;
    left: 1%;
    width: 98%;
    height: 98%;
    border-radius: 1rem;
  }

  .screen-content {
    padding: 1rem 0.75rem 5rem 0.75rem;
    gap: 4px;
  }

  .crt-frame {
    top: 1%;
    left: 1%;
    width: 98%;
    height: 98%;
    border-width: 0.4rem;
    border-radius: 1.5rem;
    box-shadow:
      inset 0 0 3rem black,
      inset 0 0 1rem black,
      0 0 3rem black;
  }

  .crt-scanlines,
  .crt-glow {
    border-radius: 1.5rem;
  }

  .ascii-logo {
    font-size: 6px;
    margin-bottom: 10px;
  }

  .header-top {
    gap: 12px;
  }

  .name {
    font-size: 1.6rem;
  }

  .tagline {
    font-size: 14px;
  }

  .portrait {
    width: 80px;
  }

  nav a {
    font-size: 14px;
    padding: 4px 10px;
  }

  .tile {
    padding: 14px 12px;
  }

  .section-title {
    font-size: 22px;
    padding: 10px 14px;
  }

  .section-content {
    padding: 12px 10px;
    gap: 4px;
  }

  .section-content > p {
    padding: 10px 12px;
    font-size: 16px;
  }

  .pub-card {
    padding: 14px 12px;
  }

  .pub-title {
    font-size: 18px;
  }

  .pub-authors {
    font-size: 14px;
  }

  .pub-blurb {
    font-size: 16px;
  }

  .pub-year {
    font-size: 14px;
  }

  .writing-card {
    padding: 14px 12px;
  }

  .writing-source {
    font-size: 14px;
  }

  .writing-title {
    font-size: 18px;
  }

  .writing-desc {
    font-size: 16px;
  }

  .links-grid {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .link-card {
    padding: 10px 12px;
    gap: 8px;
  }

  .link-icon {
    font-size: 18px;
    width: 22px;
  }

  .link-label {
    font-size: 14px;
  }

  .terminal-cursor {
    font-size: 22px;
    padding: 8px 14px;
  }

  footer p {
    font-size: 14px;
    padding: 8px 12px;
  }
}

@media (max-width: 380px) {
  body {
    font-size: 16px;
  }

  .screen-content {
    padding: 0.75rem 0.5rem;
  }

  .name {
    font-size: 1.3rem;
  }

  .portrait {
    width: 60px;
  }

  .links-grid {
    grid-template-columns: 1fr;
  }

  .section-content > p {
    font-size: 15px;
  }
}

/* === SCROLLBAR === */
.screen::-webkit-scrollbar {
  width: 10px;
}
.screen::-webkit-scrollbar-track {
  background: #041a0e;
}
.screen::-webkit-scrollbar-thumb {
  background: #0c4a2e;
}
.screen::-webkit-scrollbar-thumb:hover {
  background: var(--accent-dim);
}
