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

/* Skip link - visually hidden until focused */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  background: var(--orange);
  color: #FFFFFF;
  padding: 10px 20px;
  border-radius: 0 0 6px 6px;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
}

/* Focus visible - keyboard navigation */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
  border-radius: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* Color palette: orange (reddish), black, white */
:root {
  --orange: #E04E1B;
  --orange-dark: #B83A0F;
  --orange-light: #F0764A;
  --black: #111111;
  --near-black: #1A1A1A;
  --white: #FFFFFF;
  --off-white: #FAFAF8;
  --gray: #555555;
  --gray-light: #888888;
  --border: #E5E5E0;
  --code-bg: #F5F3F0;
  --content-width: 880px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Avatar shortcode default */
.avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--orange);
  display: inline-block;
}

/* About page */
.about-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--orange);
  box-shadow: 0 4px 16px rgba(224, 78, 27, 0.25);
  float: right;
  margin: 4px 0 12px 24px;
  shape-outside: circle();
}

/* Dark mode - manual override */
:root[data-theme="dark"] {
  --black: #F0F0F0;
  --near-black: #E0E0E0;
  --white: #111111;
  --off-white: #1A1A1A;
  --gray: #AAAAAA;
  --gray-light: #777777;
  --border: #2A2A2A;
  --code-bg: #1E1E1E;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Light mode - manual override */
:root[data-theme="light"] {
  --orange: #E04E1B;
  --orange-dark: #B83A0F;
  --orange-light: #F0764A;
  --black: #111111;
  --near-black: #1A1A1A;
  --white: #FFFFFF;
  --off-white: #FAFAF8;
  --gray: #555555;
  --gray-light: #888888;
  --border: #E5E5E0;
  --code-bg: #F5F3F0;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  color: var(--black);
  background-color: var(--white);
}

/* Links */
a {
  color: var(--orange);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--orange-dark);
  text-decoration: underline;
}

/* Header */
.site-header {
  background: rgba(17, 17, 17, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 2px solid var(--orange);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

:root[data-theme="dark"] .site-header {
  background: rgba(0, 0, 0, 0.92);
}


.header-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 68px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.site-logo:hover {
  text-decoration: none;
}

.site-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.site-logo:hover .site-logo-icon {
  transform: scale(1.1) rotate(-3deg);
  box-shadow: 0 0 16px rgba(224, 78, 27, 0.4);
}

.site-logo-text {
  color: #FFFFFF;
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 32px;
}

.site-nav a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  position: relative;
  padding: 6px 0;
  transition: color 0.2s ease;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background: var(--orange);
  border-radius: 2px;
  transition: width 0.25s ease;
}

.site-nav a:hover {
  color: #FFFFFF;
  text-decoration: none;
}

.site-nav a:hover::after {
  width: 100%;
}

.site-nav a.active {
  color: var(--orange-light);
}

.site-nav a.active::after {
  width: 100%;
}

/* Theme toggle */
.theme-toggle {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  cursor: pointer;
  padding: 8px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  color: var(--orange-light);
  border-color: var(--orange);
  background: rgba(224, 78, 27, 0.1);
  box-shadow: 0 0 12px rgba(224, 78, 27, 0.2);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}


:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

:root[data-theme="light"] .theme-toggle .icon-moon {
  display: block;
}

/* Main */
main {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* Hero (homepage) */
.hero {
  position: relative;
  margin: -48px -24px 0;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  background: linear-gradient(180deg, #1A1A1A 0%, #1A1A1A 35%, #2E1305 70%, #4A1E08 100%);
}

.hero-trees {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  z-index: 0;
  pointer-events: none;
}

.hero-rain {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.hero-cube {
  --fall-duration: 4s;
  --fall-delay: 0s;
  --cube-size: 8px;
  --blink-duration: 1.4s;
  --blink-delay: 0s;
  position: absolute;
  top: 0;
  width: var(--cube-size);
  height: var(--cube-size);
  background-color: var(--orange);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(224, 78, 27, 0.7), 0 0 16px rgba(224, 78, 27, 0.3);
  opacity: 0;
  animation:
    cube-fall var(--fall-duration) linear var(--fall-delay) infinite,
    cube-blink var(--blink-duration) ease-in-out var(--blink-delay) infinite;
}

@keyframes cube-fall {
  from { transform: translateY(-20px); }
  to   { transform: translateY(100vh); }
}

@keyframes cube-blink {
  0%, 100% { opacity: 0; }
  50%      { opacity: 0.7; }
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 64px 24px;
}

.hero-avatar {
  width: 180px;
  height: 180px;
  border-radius: 24px;
  object-fit: cover;
  margin-bottom: 28px;
  border: 4px solid var(--orange);
  box-shadow: 0 8px 32px rgba(224, 78, 27, 0.3);
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: #FFFFFF;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero-tagline {
  color: rgba(255, 255, 255, 0.85);
  max-width: 540px;
  margin: 0 auto 32px;
  font-size: 1.1rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.hero-btn {
  display: inline-block;
  padding: 12px 32px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.hero-btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.hero-btn-primary {
  background-color: var(--orange);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(224, 78, 27, 0.35);
}

.hero-btn-primary:hover {
  background-color: var(--orange-dark);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(224, 78, 27, 0.45);
}

.hero-btn-secondary {
  background-color: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  border: 2px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(4px);
}

.hero-btn-secondary:hover {
  border-color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.2);
  color: #FFFFFF;
}

/* Recent posts section */
.recent-posts {
  margin-top: 56px;
}

.recent-posts h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-bottom: 20px;
}

/* Featured projects section */
.featured-projects {
  margin-top: 56px;
}

.featured-projects h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-bottom: 20px;
}

/* Post list */
.post-list {
  list-style: none;
}

.post-list li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.post-list li:last-child {
  border-bottom: none;
}

.post-list a {
  font-weight: 600;
  font-size: 1rem;
}

.post-date {
  color: var(--gray-light);
  font-size: 0.82rem;
  white-space: nowrap;
}

/* Page header */
.page-header {
  margin-bottom: 36px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--black);
  letter-spacing: -0.02em;
}

.page-meta {
  color: var(--gray-light);
  font-size: 0.85rem;
}

/* Content typography */
.content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 40px;
  margin-bottom: 14px;
  color: var(--black);
  letter-spacing: -0.01em;
  clear: right;
}

.content h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 10px;
  color: var(--black);
}

.content p {
  margin-bottom: 16px;
}

.content ul, .content ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.content li {
  margin-bottom: 6px;
}

.content code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85em;
  background-color: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--orange-dark);
}

.content pre {
  background-color: var(--near-black);
  color: #E0E0E0;
  padding: 18px 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.content pre code {
  padding: 0;
  background: none;
  color: inherit;
}

.content blockquote {
  border-left: 4px solid var(--orange);
  padding: 8px 0 8px 18px;
  margin: 20px 0;
  color: var(--gray);
  font-style: italic;
}

.content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.content hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 32px 0;
}

/* Contact form */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 480px;
}

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

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--black);
}

.form-group input,
.form-group textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background-color: var(--white);
  color: var(--black);
  transition: border-color 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--orange);
}

.form-group textarea {
  resize: vertical;
}

.form-submit {
  align-self: flex-start;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 11px 28px;
  background-color: var(--orange);
  color: #FFFFFF;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.15s ease;
  letter-spacing: 0.02em;
}

.form-submit:hover {
  background-color: var(--orange-dark);
}

.form-status {
  font-size: 0.9rem;
  margin-top: 4px;
}

.form-success {
  color: var(--orange);
}

.form-error {
  color: #C0392B;
}

.form-rate-limit-notice {
  font-size: 0.8rem;
  color: var(--gray-light);
  margin-top: 4px;
}

/* Footer */
.site-footer {
  background: var(--near-black);
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
}

:root[data-theme="dark"] .site-footer {
  background: #000000;
}


.footer-content {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 48px 24px 0;
  display: flex;
  justify-content: center;
  text-align: center;
}

.footer-section h3 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange-light);
  margin-bottom: 16px;
}

.footer-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 28px;
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  transition: color 0.15s ease;
}

.footer-nav a:hover {
  color: var(--orange-light);
  text-decoration: none;
}

.footer-icon-link {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-icon-link svg {
  flex-shrink: 0;
}

.footer-bottom {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 24px 24px 32px;
  margin-top: 32px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  font-size: 0.8rem;
}

/* Selection color */
::selection {
  background: var(--orange);
  color: #FFFFFF;
}

/* Mobile */
@media (max-width: 600px) {
  html {
    font-size: 16px;
  }

  .header-content {
    height: 56px;
    padding: 0 16px;
  }

  .site-logo-text {
    display: none;
  }

  .site-nav {
    gap: 14px;
  }

  .site-nav a {
    font-size: 0.75rem;
    letter-spacing: 0.02em;
  }

  .theme-toggle {
    padding: 6px;
  }

  .hero {
    margin: -32px -20px 0;
  }

  .hero-content {
    padding: 48px 20px;
  }

  .hero-avatar {
    width: 140px;
    height: 140px;
    border-radius: 20px;
    margin-bottom: 20px;
  }

  .hero-title {
    font-size: 1.9rem;
  }

  .hero-tagline {
    font-size: 1rem;
    margin-bottom: 24px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-btn {
    width: 100%;
    max-width: 280px;
    text-align: center;
  }

  main {
    padding: 32px 20px 48px;
  }

  .footer-nav {
    gap: 10px 20px;
  }

  .post-list li {
    flex-direction: column;
    gap: 4px;
  }

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

  .portfolio-single-links {
    flex-direction: column;
  }

  .btn {
    width: 100%;
    text-align: center;
  }
}

/* Portfolio */
.page-description {
  color: var(--gray);
  font-size: 1.05rem;
  margin-top: 4px;
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.portfolio-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.portfolio-card:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  transform: translateY(-3px);
  border-color: var(--orange-light);
}

.portfolio-card-image {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--border);
}

.portfolio-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.portfolio-card-body {
  padding: 20px;
}

.portfolio-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.portfolio-card-title a {
  color: var(--black);
}

.portfolio-card-title a:hover {
  color: var(--orange);
}

.portfolio-card-desc {
  color: var(--gray);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 14px;
}

.portfolio-card-tech {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.portfolio-card-tech li {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(224, 78, 27, 0.08);
  color: var(--orange-dark);
  border: 1px solid rgba(224, 78, 27, 0.18);
}

.portfolio-card-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.portfolio-card-more,
.portfolio-card-live {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 7px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.portfolio-card-more {
  background: var(--black);
  color: var(--white);
}

.portfolio-card-more:hover {
  background: var(--orange);
  color: #FFFFFF;
}

.portfolio-card-live {
  border: 1.5px solid var(--border);
  color: var(--gray);
}

.portfolio-card-live:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* Portfolio single */
.portfolio-single-image {
  margin-bottom: 28px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.portfolio-single-image img {
  width: 100%;
  display: block;
}

.portfolio-single-desc {
  font-size: 1.1rem;
  color: var(--gray);
  line-height: 1.6;
  margin-bottom: 24px;
}

.portfolio-single-tech {
  margin: 28px 0;
}

.portfolio-single-tech h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--orange);
  margin-bottom: 12px;
}

.portfolio-single-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* Buttons (light background) */
.btn {
  display: inline-block;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background-color: var(--orange);
  color: #FFFFFF;
  box-shadow: 0 4px 14px rgba(224, 78, 27, 0.3);
}

.btn-primary:hover {
  background-color: var(--orange-dark);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(224, 78, 27, 0.4);
}

.btn-secondary {
  background-color: transparent;
  color: var(--black);
  border: 2px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--orange);
  color: var(--orange);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .hero-cube {
    animation: none;
    display: none;
  }

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