/* ===================================================================
   clampork-web — Styles
   Personal portfolio as an interactive terminal.
   Theme: Catppuccin Mocha
   =================================================================== */

/* ── Fonts (self-hosted) ── */

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/JetBrainsMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/SourceSerif4-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('../fonts/SourceSerif4-LightItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* ── Reset & variables ── */

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

:root {
  --border: #313244;
  --fg: #cdd6f4;
  --dim: #6c7086;
  --muted: #7f849c;
  --accent: #cba6f7;
  --sapphire: #74c7ec;
  --peach: #fab387;
  --mono: 'JetBrains Mono', 'SF Mono', monospace;
}

html { background: #11111b; }

body {
  font-family: var(--mono);
  font-size: 13.5px;
  background: transparent;
  -webkit-font-smoothing: antialiased;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 140px 48px;
  overflow: hidden;
}

/* ── Accessibility ── */

.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;
}

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

/* ── Background ── */

.bg-wallpaper {
  position: fixed;
  top: -200px; right: -200px; bottom: -200px; left: -200px;
  z-index: -1; pointer-events: none;
  background: center/cover no-repeat;
  animation: wallpaperDrift 8s ease-in-out infinite alternate;
}

@keyframes wallpaperDrift {
  0%   { transform: translate(0, 0) scale(1.05); }
  33%  { transform: translate(-2%, 1%) scale(1.15); }
  66%  { transform: translate(1%, -1.5%) scale(1.02); }
  100% { transform: translate(-1%, 2%) scale(1.12); }
}

/* ── Custom cursor (desktop only) ── */

@media (pointer: fine) {
  * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='21' viewBox='0 0 20 28'%3E%3Cpath d='M1 1 L1 22 L6 17 L10.5 26 L14 24.5 L9.5 15.5 L16 15.5 Z' fill='%23fab387'/%3E%3C/svg%3E") 1 1, auto !important;
  }
}

/* ── Tap ripple (mobile) ── */

.tap-ripple {
  position: fixed; pointer-events: none; z-index: 9998;
  width: 40px; height: 40px; border-radius: 50%;
  border: 2px solid var(--peach); opacity: 0.7;
  transform: translate(-50%, -50%) scale(0.3);
  animation: rippleOut 0.5s ease-out forwards;
}

@keyframes rippleOut {
  to { transform: translate(-50%, -50%) scale(1.5); opacity: 0; }
}

/* ── Window chrome ── */

.window {
  width: 100%; max-width: 880px; height: 100%;
  background: rgba(30, 30, 46, 0.72);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 10px;
  border: 1px solid rgba(49, 50, 68, 0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.titlebar {
  flex-shrink: 0;
  background: rgba(17, 17, 27, 0.95);
  padding: 0 12px;
  height: 38px;
  display: flex; align-items: center;
  font-size: 13px;
}

.traffic { display: flex; gap: 8px; align-items: center; }
.traffic span { width: 12px; height: 12px; border-radius: 50%; }
.traffic .t-close { background: #ff5f56; }
.traffic .t-min { background: #ffbd2e; }
.traffic .t-max { background: #27c93f; }

.titlebar-path { flex: 1; text-align: center; color: var(--muted); font-size: 13px; }
.titlebar-spacer { width: 52px; }

/* ── Scroll area ── */

.scroll {
  flex: 1 1 0; height: 0;
  overflow-y: auto; overflow-x: hidden;
}

.scroll-inner {
  min-height: 100%;
  display: flex; flex-direction: column;
  justify-content: center;
}

.scroll::-webkit-scrollbar { width: 6px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Bottom bar & input ── */

.bottom {
  flex-shrink: 0;
  display: flex; flex-direction: column;
  background: rgba(17, 17, 27, 0.95);
}

.input-line {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 20px;
}

.caret { color: var(--accent); font-weight: 500; user-select: none; }

.input-field { position: relative; flex: 1; }

#input {
  background: none; border: none; outline: none;
  color: var(--fg); font-family: var(--mono); font-size: 13.5px;
  caret-color: transparent; width: 100%;
}

#input::placeholder { color: var(--border); }

.block-cursor {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 8px; height: 17px;
  background: var(--accent);
  animation: cursorBlink 1s step-end infinite;
  pointer-events: none;
}

.block-cursor.hidden { display: none; }

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

/* ── Slash menu ── */

.slash-menu { display: none; border-top: 1px solid var(--accent); }
.slash-menu.visible { display: block; }

.slash-item {
  display: flex; align-items: baseline; gap: 1.5rem;
  padding: 0.25rem 20px; font-size: 13px;
}

.slash-item.active { background: rgba(110, 118, 129, 0.08); }
.slash-item-cmd { color: var(--fg); font-weight: 300; min-width: 10rem; }
.slash-item-desc { color: var(--dim); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Welcome screen ── */

.m-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 40px 24px 24px;
  flex-shrink: 0;
  position: relative;
}

.m-welcome-logo {
  width: 96px; height: 96px;
  margin-bottom: 20px;
  background-color: var(--sapphire);
  -webkit-mask: url('../images/clampork-logo.png') center/contain no-repeat;
  mask: url('../images/clampork-logo.png') center/contain no-repeat;
}

.m-welcome-name {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 32px;
  font-weight: 300;
  font-optical-sizing: auto;
  color: var(--fg);
  text-align: center;
  letter-spacing: -0.01em;
}

.m-welcome-sub {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 17px;
  font-weight: 300;
  font-optical-sizing: auto;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  letter-spacing: 0.01em;
}

/* ── Output ── */

.m-output { padding: 0 20px 20px; flex-shrink: 0; }

.m-output .m-prompt {
  color: var(--fg); font-weight: 500; font-size: 14px;
  margin-top: 24px; font-family: var(--mono);
}

.m-output .m-body {
  color: var(--muted); font-size: 13.5px; line-height: 1.7;
  margin-top: 10px; padding-left: 18px;
}

.m-output .m-body.has-bullet { position: relative; }
.m-output .m-body.has-bullet::before {
  content: ''; position: absolute; left: 0; top: 9px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted);
}

.m-output .m-body.tight { margin-top: 2px; }
.m-output .m-body a { color: var(--sapphire); text-decoration: none; transition: color 0.15s; }
.m-output .m-body a:hover { color: #b4befe; }

.m-output .m-quote {
  color: var(--accent); font-size: 13.5px; line-height: 1.7;
  margin-top: 10px; padding-left: 18px;
  border-left: 2px solid var(--muted);
}
.m-output .m-quote a { color: var(--sapphire); text-decoration: none; transition: color 0.15s; }
.m-output .m-quote a:hover { color: #b4befe; }

/* ── Mobile buttons (hidden on desktop via CSS, no JS toggle needed) ── */

.m-slash, .m-send { display: none; }

/* ===================================================================
   MOBILE — max-width: 600px
   =================================================================== */

@media (max-width: 600px) {
  html { min-height: 100%; }

  body {
    padding: 0;
    min-height: 100dvh;
    height: auto;
    overflow: visible;
  }

  .bg-wallpaper { display: none; }

  .window {
    border-radius: 0; border: none; box-shadow: none; max-width: none;
    background: #11111b;
    height: 100dvh;
  }

  /* Minimal titlebar: path only, no traffic lights */
  .titlebar {
    height: 36px;
    padding-top: env(safe-area-inset-top, 0px);
    background: transparent;
    justify-content: center;
    border-bottom: 1px solid var(--border);
  }
  .traffic { display: none; }
  .titlebar-path { font-size: 12px; color: var(--dim); }
  .titlebar-spacer { display: none; }

  .m-welcome-name { font-size: 24px; }
  .m-welcome-sub { font-size: 18px; }

  .m-welcome::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -55%);
    width: 420px; height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(116, 199, 236, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
  }

  /* Terminal-style bottom bar */
  .bottom {
    background: rgba(17, 17, 27, 0.6);
    border-top: 1px solid var(--border);
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .bottom .input-line {
    background: none;
    border: none;
    border-radius: 0;
    padding: 10px 16px;
    gap: 8px;
  }

  .bottom .caret { display: inline; font-size: 14px; }
  .bottom .block-cursor { display: none !important; }

  #input {
    caret-color: var(--accent);
    font-size: 16px;
  }

  #input::placeholder { color: var(--dim); }

  /* Hide send button — Enter submits */
  .m-send { display: none !important; }

  /* Minimal / button */
  .m-slash {
    display: flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 4px;
    background: none; border: 1px solid var(--border);
    flex-shrink: 0; color: var(--dim); font-size: 15px; font-weight: 500;
    font-family: var(--mono); -webkit-tap-highlight-color: transparent;
  }
  .m-slash:active { background: var(--border); }

  .slash-menu {
    border-radius: 0; margin: 0; overflow: hidden;
    border: none; border-top: 1px solid var(--border);
  }

  .slash-item {
    padding: 10px 16px;
    font-size: 14px;
  }

  .slash-item-cmd { font-size: 13px; }
  .slash-item-desc { font-size: 12px; }
}

/* ── Reduced motion ── */

@media (prefers-reduced-motion: reduce) {
  .bg-wallpaper { animation: none; }
  .tap-ripple { animation: none; opacity: 0; }
  .block-cursor { animation: none; }
}
