/*
 * TABLE OF CONTENTS
 * -----------------
 * 1.  VARIABLES & GLOBAL STYLES
 * 2.  TYPOGRAPHY
 * 3.  LAYOUT
 * 4.  COMPONENTS
 * 5.  MEDIA QUERIES
 */

/* 1. VARIABLES & GLOBAL STYLES */
:root {
  --bg: #e6e7e9;
  --ink: #073f37;
  --muted: #6b6b6b;
  --rule: rgba(24, 25, 26, 0.13);
  --accent: #5a5a5a;
  --main-font: 'Outfit', serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
}

body.theme-dark {
  --bg: #232426;
  --ink: #e6e7e9;
  --muted: #b0b3b8;
  --rule: rgba(230, 231, 233, 0.10);
  --accent: #b0b3b8;
}

* {
  box-sizing: border-box;
}

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

html,
body,
#app {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--main-font);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 1em;
  transition: background-color 300ms, color 300ms;
}

a,
button {
  background: none !important;
  box-shadow: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* 2. TYPOGRAPHY */
.display,
.subtitle,
span:not(#bio-content),
a {
  -webkit-tap-highlight-color: transparent !important;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.display {
  margin-top: 0;
  cursor: pointer;
  font-family: 'Outfit', 'JetBrains Mono', sans-serif;
  font-weight: 700;
  font-size: 44px;
  letter-spacing: 0.05em;
  margin-bottom: 0px;
  line-height: 1em;
}

.subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  margin-top: 0px;
  text-transform: uppercase;
  color: var(--muted);
}

.bio {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  text-align: justify;
  position: relative;
  min-height: 80px;
  white-space: pre-line;
  transition: color 0.2s ease-out;
}

.bio a {
  color: var(--ink);
  text-decoration: none;
  transition: color 0.18s;
}

.bio a:visited {
  color: var(--ink);
}

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

.lead {
  font-size: 16px
}

/* 3. LAYOUT */
#app {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  min-height: 100vh;
  justify-content: center;
  padding: 48px 20px;
  position: relative
}

#app::before {
  content: '';
  position: fixed;
  pointer-events: none;
  inset: 0;
  background: linear-gradient(to right, var(--rule) 1.2px, transparent 1.2px) 12px 12px/68px 1.2px no-repeat, linear-gradient(to bottom, var(--rule) 1.2px, transparent 1.2px) 12px 12px/1.2px 68px no-repeat, linear-gradient(to left, var(--rule) 1.2px, transparent 1.2px) calc(100% - 12px) calc(100% - 12px)/68px 1.2px no-repeat, linear-gradient(to top, var(--rule) 1.2px, transparent 1.2px) calc(100% - 12px) calc(100% - 12px)/1.2px 68px no-repeat;
  opacity: 1;
  z-index: 1;
  pointer-events: none;
  mix-blend-mode: normal;
}

.rule {
  width: 56px;
  border: none;
  border-top: 3px solid var(--rule);
  margin: 10px 0
}

.section-rule {
  height: 1px;
  background: var(--rule);
  margin: 20px 0
}

/* 4. COMPONENTS */

/* Links */
.links {
  display: flex;
  gap: 5em;
  margin-top: 2.5em;
}

.link {
  font-weight: 400;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 2px;
  transition: opacity .18s ease, transform .18s ease, color .14s ease, border-color .14s ease;
}

.link:hover {
  opacity: 0.9;
  color: var(--accent);
  border-color: var(--ink)
}

.back-link {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
  margin: 0 auto;
  display: block;
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  font-size: .5em;
  margin-top: 0;
  margin-bottom: 15px;
}

/* Toggles */
.music-toggle,
.theme-toggle {
  position: absolute;
  top: 18px;
  border: none;
  outline: none;
  opacity: .3;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  text-transform: uppercase;
  font-size: 2em;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
}

.music-toggle {
  right: 68px;
}

.theme-toggle {
  right: 18px;
}

body.theme-dark .theme-toggle {
  --toggle-bg: rgba(20, 20, 30, 0.32);
  --toggle-hover: rgba(255, 255, 255, 0.10);
}

/* Cards */
.typography-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 28px 8px;
  background: transparent;
  z-index: 2;
  margin: auto 0;
}

/* Skills */
.skills-line-separator {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0 8px;
  margin: 0 0 8px 0;
  width: 100%;
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  padding: 12px 0;
  position: relative;
  min-height: 38px;
  line-height: 1.2;
  text-align: center;
}

.skills-line-item {
  all: unset;
  box-sizing: border-box;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.8px;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: none;
  padding: 0 1px;
  user-select: text;
  line-height: 1.2;
  flex: 0 0 auto;
  text-align: center;
  cursor: pointer;
  transition: color 0.18s;
  align-self: center;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  white-space: nowrap;
}

.skills-line-item span {
  padding: 2px 4px;
}

.skills-line-item.active {
  text-decoration: none;
}

.skills-line-item.active span {
  background-color: var(--ink);
  color: var(--bg);
  border-radius: 4px;
}

.skills-line-item.active::after {
  color: var(--ink);
}

.skills-line-item::after {
  content: '·';
  font-size: 11px;
  color: var(--accent);
  opacity: 0.7;
  font-weight: 900;
  text-decoration: none;
  margin-left: 8px;
  user-select: none;
  line-height: 1.2;
  transition: color 0.18s;
}

.skills-line-item:last-child::after,
.skills-line-item.end-of-line::after,
.skills-line-item:not(:has(+ .skills-line-item))::after {
  display: none;
}

.skill-inline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 0;
  user-select: text;
}

.skills-section {
  width: 100%;
  margin: 36px 0 32px 0;
  display: flex;
  justify-content: center;
}

.skills-card-grid {
  border: 2px solid var(--rule);
  min-width: 260px;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.03);
  padding: 0;
  background: none;
}

.skills-title-grid {
  font-family: 'JetBrains Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 2px solid var(--rule);
  padding: 18px 0 14px 0;
  text-align: center;
  background: none;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 2px solid var(--rule);
  border-bottom: 2px solid var(--rule);
  background: none;
}

.skill-grid-item {
  font-family: 'JetBrains Mono', monospace;
  font-size: 15px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  padding: 22px 0 20px 0;
  border-right: 2px solid var(--rule);
  border-bottom: 1.5px solid var(--rule);
  background: none;
  user-select: text;
}

.skill-grid-item:nth-child(3n) {
  border-right: none;
}

.skill-grid-item:nth-last-child(-n+3) {
  border-bottom: none;
}

/* Skeleton Loader */
.skeleton-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  display: flex;
  flex-direction: column;
}

.skeleton-loader {
  width: 100%;
  height: 1.6em;
  background: var(--ink);
  -webkit-mask-image: linear-gradient(to right, black 100%, transparent 100%);
  mask-image: linear-gradient(to right, black 100%, transparent 100%);
  transform-origin: left;
}

.loading-start .skeleton-loader {
  animation: skeleton-redact 0.4s ease-out forwards, skeleton-mask 0.4s 0.1s ease-out forwards;
}

@keyframes skeleton-redact {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@keyframes skeleton-mask {
  0% {
    -webkit-mask-image: linear-gradient(to right, black 100%, transparent 100%);
    mask-image: linear-gradient(to right, black 100%, transparent 100%);
  }
  100% {
    -webkit-mask-image: linear-gradient(to right, black 60%, transparent 100%);
    mask-image: linear-gradient(to right, black 60%, transparent 100%);
  }
}

/* Overlay */
#overlay {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 150px;
  height: 150px;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  border-radius: 25px;
}

#overlay.visible {
  opacity: 1;
  pointer-events: all;
}

#overlay-icon {
  width: 100px;
  height: 100px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.play-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="white"><path d="M8 5v14l11-7z"/></svg>');
}

.pause-icon {
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 24 24" fill="white"><path d="M6 19h4V5H6v14zm8-14v14h4V5h-4z"/></svg>');
}

/* Focus visible */
a:focus-visible,
button:focus-visible,
.music-toggle:focus-visible,
.theme-toggle:focus-visible,
.back-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skills-line-item:focus-visible {
  outline: none;
}

.skills-line-item:focus-visible span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 5. MEDIA QUERIES */
@media (hover: hover) {
  .skills-line-item:hover span {
    background-color: var(--ink);
    color: var(--bg);
    opacity: .9;
    border-radius: 4px;
  }
}

@media (max-width: 760px) {
  .skills-line-item:hover span {
    background-color: var(--ink);
    color: var(--bg);
    opacity: 1;
    border-radius: 4px;
  }
}

@media (max-width: 600px) {
  .skills-line-separator {
    gap: 4px 4px;
    padding: 8px 0;
    margin: 14px 0;
  }
  .skills-line-item::after {
    font-size: 9px;
    margin-left: 4px;
  }
  .skills-inline {
    font-size: 13px;
    padding: 1px 0;
  }
}

@media(min-width: 720px) {
  .display {
    font-size: 3.5em;
  }
  .subtitle {
    font-size: 14px;
  }
  .bio {
    max-width: 54ch;
  }
  .rule {
    width: 120px;
  }
}

@media(min-width: 760px) {
  body {
    padding: 48px;
  }
  #app {
    padding: 72px;
  }
  .typography-card {
    padding: 2em;
  }
  .bio {
    font-size: 16px;
  }
}
