/*------------------------------------*\
    Minimal modern reset
    (replaces normalize.css v5, unneeded on evergreen browsers)
\*------------------------------------*/
*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

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

img, svg {
  display: block;
  max-width: 100%;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/*------------------------------------*\
    Apaxy
    by @adamwhitcroft

    Theme name: Apaxy
    Theme author: @adamwhitcroft
\*------------------------------------*/

:root {
  --bg-color: #101112;
  --bg-color-alt: #191b1d;
  --text-color: #f3f2ed;
  --muted-color: #898c90;
  --link-color: #ff6b35;
  --link-hover-color: #ff895e;
  --accent-soft: rgba(255, 107, 53, .12);
  --card-bg: #191b1d;
  --border-color: #2a2c2e;
  --row-alt: rgba(255, 107, 53, .035);
  --row-hover: rgba(255, 107, 53, .10);
  --focus-ring: rgba(255, 107, 53, .42);
  --shadow: 0 10px 30px rgba(0,0,0,.24);
  --radius: 5px;
  --radius-sm: 3px;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #101112;
    --bg-color-alt: #191b1d;
    --text-color: #f3f2ed;
    --muted-color: #898c90;
    --link-color: #ff6b35;
    --link-hover-color: #ff895e;
    --accent-soft: rgba(255, 107, 53, .12);
    --card-bg: #191b1d;
    --border-color: #2a2c2e;
    --row-alt: rgba(255, 107, 53, .035);
    --row-hover: rgba(255, 107, 53, .10);
    --focus-ring: rgba(255, 107, 53, .42);
    --shadow: 0 10px 30px rgba(0,0,0,.24);
  }
}

html {
  min-height: 100%;
  color: var(--text-color);
  background: var(--bg-color);
  background-image: radial-gradient(circle at 8% -10%, var(--bg-color-alt), var(--bg-color) 58%);
  background-attachment: fixed;
  font-weight: 400;
  font-size: 1em;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

body {
  padding: 24px;
  -webkit-backface-visibility: hidden;
  background: #101112;
}

h1, h2, h3, .page-title { font-family: 'Barlow Condensed', Impact, sans-serif; }

code {
  font-family: consolas,monospace;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.15s ease;
}

a, img {
  border: none;
  outline: none;
}

a > img:hover {
  opacity: 0.55;
}

a:hover {
  color: var(--link-hover-color);
}

a:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

/*------------------------------------*\
    Wrapper
\*------------------------------------*/

.wrapper {
  margin: 0 auto;
  padding-top: 18px;
  max-width: 1180px;
}

.public-nav {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -24px -24px 2rem;
  padding: .85rem max(1.5rem, calc((100vw - 1180px) / 2));
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-color);
  background: #111213;
  box-shadow: none;
}

.public-nav::after {
  content: '';
  position: absolute;
  right: 8%;
  bottom: -1px;
  left: 8%;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff6b35, transparent);
  opacity: .9;
}

.public-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--text-color);
  font-family: 'Barlow Condensed', Impact, sans-serif;
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.public-brand:hover { color: var(--link-hover-color); }

.public-nav .app-logo {
  width: 32px;
  height: 32px;
}

/* Fraghaus header structure used by the shared public listing templates. */
.public-nav.header { height: 72px; padding: 0 max(1.5rem, calc((100vw - 1180px) / 2)); margin-bottom: 2rem; gap: 3rem; }
.public-nav.header .brand { font-family: 'Barlow Condensed', Impact, sans-serif; font-size: 1.65rem; font-weight: 800; letter-spacing: .04em; color: #f3f2ed; text-transform: uppercase; }
.public-nav.header .brand > span:not(.brand-icon) { color: #a7a8a8; }
.public-nav.header .brand-icon { width: 32px; height: 32px; margin-right: .55rem; border-radius: 2px; transform: skew(-8deg); background: #ff6b35; }
.public-nav.header nav { display: flex; align-items: stretch; align-self: stretch; gap: 2rem; font-size: .72rem; font-weight: 600; color: #898c90; }
.public-nav.header nav a { display: flex; align-items: center; position: relative; color: inherit; }
.public-nav.header nav a:hover, .public-nav.header nav .nav-active { color: #fff; }
.public-nav.header nav .nav-active::after { content: ''; position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: #ff6b35; }
.public-nav.header .header-cta { margin-left: auto; border: 1px solid #45423f; border-radius: 3px; padding: .65rem .9rem; color: #f3f2ed; font-size: .72rem; font-weight: 600; }
.public-nav.header .header-cta span { margin-left: 1rem; color: #ff6b35; }

.app-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--accent-soft);
}

.app-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

.public-login {
  padding: .45rem .8rem;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-color);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.public-login:hover {
  color: var(--text-color);
  border-color: var(--link-color);
  background: var(--accent-soft);
}

/*------------------------------------*\
    Signed-in header state (right side of .public-nav.header when a
    session is active - see app_render_header() in app/lib/layout.php)
\*------------------------------------*/
.header-user {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-left: auto;
}

.header-username {
  color: #a7a8a8;
  font-size: .72rem;
  font-weight: 600;
}

.header-logout-form {
  margin: 0;
}

.header-user .header-cta {
  margin-left: 0;
}

button.header-cta {
  background: transparent;
  cursor: pointer;
  font-family: inherit;
}

/*------------------------------------*\
    Breadcrumb bar
\*------------------------------------*/
.crumbbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  margin-bottom: .75rem;
}

/*------------------------------------*\
    Language switch
\*------------------------------------*/
.langswitch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  flex-shrink: 0;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted-color);
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .03em;
  padding: .3em .65em;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.lang-btn:hover {
  color: var(--text-color);
}

.lang-btn[aria-pressed="true"] {
  background-color: #ff6b35;
  color: #fff;
}

/*------------------------------------*\
    Page header (title + search)
\*------------------------------------*/
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-title {
  font-family: 'Barlow Condensed', Impact, sans-serif;
  font-size: 2.1em;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  word-break: break-word;
  color: var(--text-color);
  text-wrap: balance;
}

.page-meta {
  margin-top: .25rem;
  font-size: .8125em;
  color: var(--muted-color);
}

/*------------------------------------*\
    Filter (search box)
\*------------------------------------*/
#filter {
  background-color: var(--card-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6F80' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: .85em center;
  background-size: 14px 14px;
  color: var(--text-color);
  font-size: .8125em;
  padding: .65em .9em .65em 2.4em;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  box-shadow: var(--shadow);
  width: 14em;
  min-height: 42px;
  flex-shrink: 0;
  transition: width 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

#indexlist { border: 1px solid #2a2c2e; border-radius: 5px; overflow: hidden; background: #191b1d; box-shadow: 0 12px 30px rgba(0,0,0,.2); }
#indexlist tr { border-color: #2a2c2e; }
#indexlist tr:not(.indexhead):not(.parent):hover { background: rgba(255,107,53,.09); }
#indexlist th { background: #202224; color: #898c90; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
#indexlist td, #indexlist th { border-color: #2a2c2e; }
#indexlist a { color: #f3f2ed; }
#indexlist a:hover { color: #ff895e; }
#filter:focus {
  width: 18em;
  border-color: var(--link-color);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}
#filter::placeholder {
  color: var(--muted-color);
}

@media (prefers-color-scheme: dark) {
  #filter {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2393939F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  }
}

/*------------------------------------*\
    Demo block / empty state
\*------------------------------------*/

.block {
  font-size: .875em;
  margin: 20px 0;
  padding: 44px 20px;
  background: var(--card-bg);
  border: 1px dashed var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--muted-color);
  text-align: center;
}

.block strong {
  color: var(--text-color);
  font-size: 1.1em;
}

.block p + p {
  margin-top: .25rem;
}

/*------------------------------------*\
    Table (directory listing)
\*------------------------------------*/

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875em;
  color: var(--text-color);
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.odd {
  background-color: var(--row-alt);
}

tr:hover {
  background-color: var(--row-hover);
}

#indexlist tbody tr:not(.parent) {
  transition: background-color .18s ease, transform .18s ease;
}

#indexlist tbody tr:not(.parent):hover {
  transform: translateX(2px);
}

tr {
  outline: 0;
  border: 0;
}

tr.indexhead th,
tr:first-child th {
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 600;
  color: var(--muted-color);
  background-color: var(--bg-color-alt);
}

th {
  text-align: left;
  font-size: .6875em;
  padding-right: 20px;
}

th, td {
  padding: .7em 1em;
  border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
  border-bottom: none;
}

/* 1st column: icon */
.indexcolicon {
  width: 2.75em;
}
.indexcolicon img {
  display: block;
  width: 22px;
  height: 22px;
  max-width: none;
  vertical-align: middle;
}

/* 2nd Column: Filename */

.indexcolname {
  width: auto;
  overflow-wrap: anywhere;
  font-weight: 500;
}

.indexcolname a {
  color: var(--text-color);
  font-weight: 600;
}

.indexcolname a:hover {
  color: var(--link-hover-color);
}

/* 3rd column: last modified */
.indexcollastmod {
  color: var(--muted-color);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: .9em;
}

/* 4th column: size */
th.indexcolsize {
  width: 5%;
}
.indexcolsize {
  color: var(--muted-color);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-size: .9em;
}

.indexcolsize.size-pending {
  animation: sizePulse 1.2s ease-in-out infinite;
}

@keyframes sizePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .3; }
}

@media (prefers-reduced-motion: reduce) {
  .indexcolsize.size-pending {
    animation: none;
  }
}

tr td:first-of-type {
  padding-left: 14px;
  padding-right: 10px;
}

td {
  outline: 0;
  vertical-align: middle;
  text-align: left;
  transition: background 150ms ease;
}

td a {
  display: block;
}

tr.parent a[href^="/"] {
  color: var(--muted-color);
}

.parent a[href^="/"]:hover {
  color: var(--link-color);
}

/*------------------------------------*\
    Footer
\*------------------------------------*/

.footer {
  text-align: center;
  font-size: .8125em;
  letter-spacing: .01em;
  margin-top: 3rem;
  padding-top: 1.5rem;
  padding-bottom: .5rem;
  color: var(--muted-color);
}

.footer a {
  position: relative;
  display: inline-block;
  color: var(--text-color);
  font-weight: 600;
  text-decoration: none;
}

.footer a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -2px;
  height: 1px;
  background-color: var(--link-color);
  transition: right .2s ease;
}

.footer a:hover {
  color: var(--link-color);
}

.footer a:hover::after {
  right: 0;
}

/*------------------------------------*\
    Media query for small screens
\*------------------------------------*/
@media (max-width: 768px) {
  body {
    padding: 14px;
  }
  .public-nav {
    margin: -14px -14px 1.5rem;
    padding: .8rem 1rem;
  }
  .public-nav.header { height: auto; min-height: 72px; gap: .5rem 1rem; padding: .8rem 1rem; flex-wrap: wrap; }
  .public-nav.header nav { gap: 1rem; order: 3; width: 100%; height: 30px; justify-content: space-between; }
  .header-user { gap: .5rem; }
  .header-username { display: none; }
  .indexcollastmod { display: none; }
  .wrapper { max-width: 100%; }
  #filter, #filter:focus {
    width: 100%;
  }
  .topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .page-title {
    font-size: 1.25em;
  }
}

@media (max-width: 480px) {
  #indexlist { table-layout: fixed; }
  #indexlist th, #indexlist td { padding: .8em .5em; }
  #indexlist .indexcolicon { width: 38px; }
  #indexlist .indexcolsize { width: 66px; }
  #indexlist .indexcolshare { width: 70px; }
  #indexlist .app-share-btn { padding: .5em; }
  .indexcolname a { overflow-wrap: anywhere; }
}

/*------------------------------------*\
    Error pages
\*------------------------------------*/
/* Animation */
@keyframes fadeDown {
  0% {
    opacity: 0;
    transform: translateY(-20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.fadeDown {
  animation: fadeDown 0.4s ease;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .fadeDown {
    animation: none;
  }
}

/* Center elements in error pages */
.fadeDown .center {
  text-align: center;
  max-width: 24em;
  padding: 40px 32px;
  background-color: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.fadeDown .langswitch {
  margin-bottom: 1.25rem;
}

.error-brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  margin-bottom: 1.5rem;
  color: var(--text-color);
  font-size: 1rem;
  font-weight: 800;
}

.error-brand:hover { color: var(--link-hover-color); }

.error-brand .app-logo {
  width: 36px;
  height: 36px;
}

.fadeDown h1 {
  font-size: .8125em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted-color);
}

/* Error code display */
.errorCode {
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--link-color), var(--link-hover-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.2;
}

.fadeDown p {
  color: var(--muted-color);
  margin-top: .5rem;
}

.errorHint {
  margin-top: 1.5rem;
  font-size: .875em;
}

.errorHint a {
  font-weight: 600;
  color: var(--link-color);
}

/*------------------------------------*\
    Breadcrumb
\*------------------------------------*/

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: .4rem;
  font-size: .75rem;
  font-weight: 500;
}

.breadcrumb li {
  color: var(--muted-color);
}

.breadcrumb li + li:before {
  content: '/';
  opacity: 0.35;
  margin-right: .4rem;
}

.breadcrumb li.active {
  color: var(--text-color);
}

.breadcrumb li a {
  color: var(--muted-color);
  text-decoration: none;
  transition: color .15s ease;
}

.breadcrumb li a:hover {
  color: var(--link-color);
}

/* Keep keyboard focus and touch targets clear across both themes. */
.lang-btn { min-width: 40px; min-height: 36px; }
button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 3px;
}
.breadcrumb { min-width: 0; overflow-wrap: anywhere; }
@media (pointer: coarse) {
  .lang-btn { min-height: 44px; min-width: 44px; }
  .indexcolname a { display: inline-block; padding-block: .3em; }
}
