/*
 * core.css - http-nu design system
 *
 * Structure:
 * 1. CSS Variables (design tokens)
 * 2. Reset & Base Typography
 * 3. Utility Classes
 * 4. Design Palette
 */

/* ==========================================================================
   1. CSS VARIABLES
   ========================================================================== */

:root {
  --color-bg-body: #0077b6;
  --color-bg-html: var(--color-bg-body);
  --color-bg-card: var(--color-bg-body);
  --color-text-primary: rgba(255, 255, 255, 0.85);
  --color-text-header: #f4d9a0;
  --color-accent-orange: #e86f3a;
  --color-accent-green: #2a9d4a;
  --color-accent-purple: #8b7ab8;
  --color-accent-purple-dark: #4c1d95;
  --color-accent-blue-stream: #00d4ff;
  --color-accent-red: #e05252;
}

/* ==========================================================================
   2. RESET & BASE TYPOGRAPHY
   Naked HTML tags should look good by default
   ========================================================================== */

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

html {
  font: 1.125rem/1.6 "Source Sans 3", sans-serif;
  background: radial-gradient(
    ellipse at center,
    var(--color-bg-body) 0%,
    var(--color-bg-html) 100%
  );
  height: 100%;
}

body {
  max-width: 1020px;
  margin: 0 auto;
  background-color: var(--color-bg-body);
  color: var(--color-text-primary);
  height: 100%;
}

a {
  color: inherit;
  text-decoration: underline;
  transition: opacity 0.2s;
}
a:hover {
  opacity: 0.8;
}

p {
  margin-bottom: 1rem;
}
p:last-child {
  margin-bottom: 0;
}

svg {
  display: block;
  margin: 0 auto;
}

h2, h3, h4 {
  color: var(--color-text-header);
  line-height: 1.3;
}
h2 {
  font-size: 1.5rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
}
h3 {
  font-size: 1.25rem;
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}

pre {
  position: relative;
  margin: 0 0 1rem;
  padding: 1rem 1.25rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.5rem;
  overflow-x: auto;
  line-height: 1.5;
  font-size: 0.9375rem;
}
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  padding: 0.25rem;
  line-height: 1;
}
pre:hover > .copy-btn,
.code:hover > .copy-btn {
  opacity: 0.4;
}
.copy-btn:hover {
  opacity: 1 !important;
}

hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  margin: 2rem 0;
}

ul {
  list-style: disc;
  padding-left: 1.5em;
  margin: 1em 0;
}
li {
  margin: 0.4em 0;
  line-height: 1.5;
}

strong {
  color: var(--color-text-header);
}

/* ==========================================================================
   3. UTILITY CLASSES
   Single-purpose classes following Tailwind conventions
   ========================================================================== */

/* -- Flex Container (parent) -- */
.flex {
  display: flex;
}
.flex-row {
  flex-direction: row;
}
.flex-col {
  flex-direction: column;
}
.flex-wrap {
  flex-wrap: wrap;
}
.items-center {
  align-items: center;
}
.items-end {
  align-items: flex-end;
}
.items-baseline {
  align-items: baseline;
}
.justify-end {
  justify-content: flex-end;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}

/* -- Flex Item (child) -- */
.flex-1 {
  flex: 1 1 0%;
}
.flex-auto {
  flex: 1 1 auto;
}
.flex-none {
  flex: none;
}
.grow {
  flex-grow: 1;
}
.shrink-0 {
  flex-shrink: 0;
}
.basis-1\/2 {
  flex-basis: 50%;
}
.basis-1\/3 {
  flex-basis: 33.333%;
}
.basis-2\/3 {
  flex-basis: 66.667%;
}
.basis-1\/5 {
  flex-basis: 20%;
}
.basis-2\/5 {
  flex-basis: 40%;
}
.basis-3\/5 {
  flex-basis: 60%;
}
.basis-4\/5 {
  flex-basis: 80%;
}

.block {
  display: block;
}
.hidden {
  display: none;
}
.invisible {
  opacity: 0;
}
.relative {
  position: relative;
}
.absolute {
  position: absolute;
}

/* -- Spacing -- */
.gap-2 {
  gap: 0.5rem;
}
.gap-4 {
  gap: 1rem;
}
.gap-8 {
  gap: 2rem;
}

.p-1 {
  padding: 0.25rem;
}
.p-2 {
  padding: 0.5rem;
}
.p-4 {
  padding: 1rem;
}
.px-3 {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}
.px-5 {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}
.px-6 {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}
.py-1 {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}
.py-2 {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.py-3 {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}
.py-4 {
  padding-top: 1rem;
  padding-bottom: 1rem;
}
.pt-12 {
  padding-top: 3rem;
}
.pb-5 {
  padding-bottom: 1.25rem;
}
.pb-6 {
  padding-bottom: 1.5rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}
.my-2 {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}
.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-8 {
  margin-top: 2rem;
}
.mt-10 {
  margin-top: 2.5rem;
}
.mt-12 {
  margin-top: 3rem;
}
.mt-16 {
  margin-top: 4rem;
}
.mt-20 {
  margin-top: 5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-8 {
  margin-bottom: 2rem;
}
.ml-2 {
  margin-left: 0.5rem;
}
.pl-2 {
  padding-left: 0.5rem;
}

.top-2 {
  top: 0.5rem;
}
.right-3 {
  right: 0.75rem;
}

/* -- Sizing -- */
.w-3 {
  width: 0.75rem;
}
.h-3 {
  height: 0.75rem;
}
.w-fit {
  width: fit-content;
}
.w-full {
  width: 100%;
}
.max-w-xs {
  max-width: 20rem;
}
.max-w-sm {
  max-width: 24rem;
}
.max-w-md {
  max-width: 28rem;
}
.max-w-lg {
  max-width: 32rem;
}
.max-w-xl {
  max-width: 36rem;
}
.max-w-2xl {
  max-width: 42rem;
}
.max-w-3xl {
  max-width: 48rem;
}
.max-w-4xl {
  max-width: 56rem;
}
.max-w-5xl {
  max-width: 64rem;
}
.max-w-full {
  max-width: 100%;
}
.min-w-0 {
  min-width: 0;
}

/* -- Typography -- */
.font-mono {
  font-family: "Source Code Pro", "SF Mono", "Fira Code", "Consolas", monospace;
}
.font-bold {
  font-weight: bold;
}
.font-normal {
  font-weight: normal;
}

code {
  font-family: "Source Code Pro", "SF Mono", "Fira Code", "Consolas", monospace;
}

:not(pre) > code {
  background: rgba(0, 0, 0, 0.1);
  padding: 0em 0.15em 0.1em;
  border-radius: 5px;
}

.text-sm {
  font-size: 0.875rem;
}
.text-base {
  font-size: 1rem;
}
.text-lg {
  font-size: 1.125rem;
}
.text-xl {
  font-size: 1.25rem;
}
.text-2xl {
  font-size: 1.5rem;
}
.text-3xl {
  font-size: 1.875rem;
}
.text-4xl {
  font-size: 2.25rem;
}
.text-5xl {
  font-size: 3rem;
}
.text-fluid-xl {
  font-size: clamp(1.5rem, 4vw + 0.5rem, 3.5rem);
}
.text-left {
  text-align: left;
}
.text-center {
  text-align: center;
}
.leading-relaxed {
  line-height: 1.5;
}
.tracking-wide {
  letter-spacing: 0.1em;
}
.uppercase {
  text-transform: uppercase;
}

/* -- Colors (using CSS vars) -- */
.text-primary {
  color: var(--color-text-primary);
}
.text-header {
  color: var(--color-text-header);
}
.text-white {
  color: #fff;
}
.text-muted {
  color: #888;
}
.text-accent {
  color: var(--color-accent-orange);
}

.bg-body {
  background-color: var(--color-bg-body);
}
.bg-card {
  background-color: var(--color-bg-card);
}
.bg-orange {
  background-color: var(--color-accent-orange);
}
.bg-green {
  background-color: var(--color-accent-green);
}
.bg-purple {
  background-color: var(--color-accent-purple);
}
.bg-purple-dark {
  background-color: var(--color-accent-purple-dark);
}
.text-stream {
  color: var(--color-accent-blue-stream);
}
.bg-red {
  background-color: var(--color-accent-red);
}
.bg-white {
  background: #fff;
}
.bg-none {
  background: none;
}
.bg-dark {
  background: rgba(0, 0, 0, 0.25);
}

/* -- Borders & Rounded -- */
.rounded {
  border-radius: 0.25rem;
}
.rounded-lg {
  border-radius: 0.75rem;
}
.rounded-t-lg {
  border-top-left-radius: 0.75rem;
  border-top-right-radius: 0.75rem;
}
.rounded-b-lg {
  border-bottom-left-radius: 0.75rem;
  border-bottom-right-radius: 0.75rem;
}
.rounded-full {
  border-radius: 50%;
}
.rounded-5xl {
  border-radius: 5rem;
} /* approved: follows Tailwind pattern */
.border-none {
  border: none;
}
.border-b-2 {
  border-bottom: 2px solid;
}
.border-transparent {
  border-color: transparent;
}
.border-purple {
  border-color: var(--color-accent-purple);
}

/* -- Transforms -- */
.rotate-ccw-1 {
  transform: rotate(-1deg);
}
.rotate-ccw-3 {
  transform: rotate(-3deg);
}
.rotate-ccw-5 {
  transform: rotate(-5deg);
}
.rotate-cw-2 {
  transform: rotate(2deg);
}
.rotate-cw-4 {
  transform: rotate(4deg);
}

/* -- Overflow -- */
.overflow-hidden {
  overflow: hidden;
}
.overflow-x-auto {
  overflow-x: auto;
}

/* -- Interactivity -- */
.cursor-pointer {
  cursor: pointer;
}
.transition-colors {
  transition: color 0.2s;
}

/* -- Responsive (md: 900px+) -- */
@media (min-width: 900px) {
  .md\:flex-row {
    flex-direction: row;
  }
  .md\:items-start {
    align-items: flex-start;
  }
  .md\:shrink-0 {
    flex-shrink: 0;
  }
  .md\:grow {
    flex-grow: 1;
  }
  .md\:min-w-0 {
    min-width: 0;
  }
  .md\:min-w-code {
    min-width: 420px;
  }
  .md\:p-8 {
    padding: 2rem;
  }
}

/* ==========================================================================
   4. DESIGN PALETTE
   Project-specific design tokens and themed utilities
   ========================================================================== */

/*
 * Shadow Palette
 * Three shadow styles by visual effect, not by where they're used:
 * - offset: retro sticker/paper effect (hard edge, down-right)
 * - float: modern floating effect (soft blur, beneath)
 * - glow: warm ambient lighting effect
 */
.shadow-offset {
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.2);
}
.shadow-float {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.shadow-glow {
  box-shadow:
    0 0 20px rgba(255, 200, 100, 0.4),
    0 0 40px rgba(255, 150, 50, 0.2);
}

.text-code {
  font-size: 1.1rem;
}
.hover\:text-accent:hover {
  color: var(--color-accent-orange);
}
.hover\:text-white:hover {
  color: #fff;
}
.min-w-code {
  min-width: 420px;
}
.max-w-code {
  max-width: 600px;
}

/*
 * Window UI
 * Shared dimensions for terminal/browser window chrome
 */
.h-titlebar {
  height: 2.75rem;
}
