/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS (and SCSS file if present) file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It's generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

/* ==========================================================================
   BASE STYLES
   ========================================================================== */

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  margin: 0;
  padding: 0;
  color: #333;
  background-color: #fff;
}

/* ==========================================================================
   HTML ELEMENT STYLES
   ========================================================================== */

/* Header */
header {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 1rem;
  width: 100%;
  justify-content: space-between;
}

/* Navigation */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Inline header links */
header ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  margin: 0;
  padding: 0;
}

header ul li {
  padding: 0;
}

header ul a {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

/* Mobile stacking behavior */
@media (max-width: 640px) {
  header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  nav {
    width: 100%;
    padding: 0;
    justify-content: flex-start;
  }
}

/* Sections */
section {
  margin-bottom: 3rem;
}

/* Articles and project cards */
article {
  background: #fff;
}

h1, h2, h3, h4 {
  font-weight: 600;
  margin: 0.5rem 0;
}

article p {
  color: inherit;
}

/* Lists */
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

li {
  padding: 0.5rem 0;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  image-rendering: auto;
  image-rendering: -webkit-optimize-contrast;
}

/* Figures and images */
figure {
  margin: 0;
  position: relative;
  overflow: hidden;
}

figure img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* Links */
a {
  color: inherit;
  transition: color 0.2s;
  text-decoration: none;
}

a:hover {
  color: #6366f1;
}

/* Form elements */
form {
  display: flex;
}

label {
  display: block;
  cursor: pointer;
  width: 100%;
  text-transform: none;
  font-size: 1rem;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons */
button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background-color: #000;
  border-color: #000;
  color: #ffffff;
}

button:hover, input[type="submit"]:hover {
  background-color: #444;
  border-color: #444;
}

/* Form inputs */
input[type="email"], input[type="password"], input[type="text"], input[type="date"], input[type="time"], input[type="datetime-local"], textarea {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.25rem;
  color: #374151;
  background-color: #ffffff;
  border: 1px solid #d1d5db;
}

/* Checkboxes */
input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Paragraphs */
p {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: #333;
}

/* Blockquotes */
blockquote {
  margin: 1.5rem 0;
  padding: 0 1.25rem;
  border-left: 4px solid #e5e7eb;
  color: #4B5563;
  font-style: italic;
  line-height: 1.8;
}

blockquote p {
  margin: 0 0 0.5rem 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

blockquote cite {
  display: block;
  margin-top: 0.5rem;
  font-style: normal;
  color: #6b7280;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

/* Layout & Positioning */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.block { display: block; }
.inline-block { display: inline-block; }
.inline { display: inline; }
.hidden { display: none; }
.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; }

/* Flexbox */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.items-stretch { align-items: stretch; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.flex-1 { flex: 1 1 0%; }
.flex-auto { flex: 1 1 auto; }
.flex-initial { flex: 0 1 auto; }
.flex-none { flex: none; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

/* Spacing */
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }
.space-y-16 > * + * { margin-top: 4rem; }

/* Width & Height */
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.h-auto { height: auto; }
.max-w-none { max-width: none; }
.max-w-full { max-width: 100%; }
.max-w-3xl { max-width: 48rem; }
.max-h-screen { max-height: 100vh; }
.max-w-screen { max-width: 100vw; }

/* Padding */
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.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.25rem; padding-bottom: 0.25rem; }
.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; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.pr-2 { padding-right: 0.5rem; }
.pl-2 { padding-left: 0.5rem; }

/* Margin */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-6 { margin: 1.5rem; }
.m-8 { margin: 2rem; }
.m-16 { margin: 4rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mr-2 { margin-right: 0.5rem; }
.ml-4 { margin-left: 1rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-14 { margin-top: 3.5rem; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }

.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-thin { font-weight: 100; }
.font-serif { font-family: Georgia, serif; }

.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.text-red-500 { color: #ef4444; }
.text-neutral-100 { color: #f5f5f5; }

.uppercase { text-transform: uppercase; }
.normal-case { text-transform: none; }

.antialiased { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* Text overflow */
.truncate { display: block; width: 100%; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Borders */
.border { border: 1px solid #e5e7eb; }
.border-t { border-top: 1px solid #e5e7eb; }
.border-b { border-bottom: 1px solid #e5e7eb; }
.border-l { border-left: 1px solid #e5e7eb; }
.border-r { border-right: 1px solid #e5e7eb; }

.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }

/* Backgrounds */
.bg-white { background-color: #ffffff; }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }

/* Shadows */
.shadow { box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.shadow-none { box-shadow: none; }

/* ==========================================================================
   GRID LAYOUT UTILITIES
   ========================================================================== */

/* Removed duplicate grid utilities */

/* Responsive grid utilities */
@media (min-width: 640px) {
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sm\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ==========================================================================
   RESPONSIVE UTILITIES
   ========================================================================== */

@media (min-width: 640px) {
  .sm\:hidden { display: none; }
  .sm\:block { display: block; }
  .sm\:flex { display: flex; }
}

@media (min-width: 768px) {
  .md\:hidden { display: none; }
  .md\:block { display: block; }
  .md\:flex { display: flex; }
  .md\:grid { display: grid; }
}

@media (min-width: 1024px) {
  .lg\:hidden { display: none; }
  .lg\:block { display: block; }
  .lg\:flex { display: flex; }
  .lg\:grid { display: grid; }
}

/* ==========================================================================
   FLASH / NOTIFICATIONS
   ========================================================================== */

.flash-container {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  width: calc(100% - 2rem);
  max-width: 36rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.flash-item {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.875rem;
  border-radius: 9999px;
  color: #ffffff;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  opacity: 1;
  transition: opacity 300ms ease-in-out;
}

.flash-item.notice {
  background-color: #4f46e5;
}

.flash-item.alert {
  background-color: #ef4444;
}

.flash-message {
  margin: 0;
}

.opacity-0 {
  opacity: 0;
}

/* ==========================================================================
   CODE / PRE STYLES
   ========================================================================== */

:not(pre) > code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95em;
  background-color: #f3f4f6;
  color: #111827;
  padding: 0.125rem 0.375rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  word-break: break-word;
}

pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.95rem;
  line-height: 1.7;
  background-color: #f8fafc;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 0.95em;
  color: inherit;
  white-space: inherit;
}

.wysiwyg pre, .ql-editor pre {
  margin: 1.25rem 0;
}

/* ==========================================================================
   ACTION TEXT ATTACHMENTS (inline images)
   ========================================================================== */

action-text-attachment {
  display: block;
  margin: 1rem 0 0;
  max-width: 100%;
}

action-text-attachment figure {
  margin: 0;
  display: inline-block;
  max-width: 100%;
}

/* Override generic figure img rules so inline images don't get cropped */
action-text-attachment figure img {
  display: block;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  margin-left: auto;
  margin-right: auto;
}

action-text-attachment .attachment__caption {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  text-align: center;
}

/* ==========================================================================
   CUSTOM
   ========================================================================== */

#bio a {
  text-decoration: underline;
}

.center-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wysiwyg, .ql-editor {
  font-size: 16px;
}
.wysiwyg > div, .ql-editor > div {
  margin-bottom: 1rem;
  line-height: 1.8;
  color: #333;
}
.wysiwyg a, .ql-editor a {
  text-decoration: underline;
}

@media (min-width: 768px) {
  #photos figure {
    height: 150px;
  }
  #photos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.5rem;
  font-size: inherit;
  color: #111827;
  background: transparent;
}

.pagination a:hover {
  text-decoration: underline;
}

.pagination .current,
.pagination span[aria-current="page"] {
  color: #6366f1;
}

.pagination > *:first-child a,
.pagination > *:first-child span {
  padding-left: 0;
}

.pagination > *:last-child a,
.pagination > *:last-child span {
  padding-right: 0;
}
